From owner-svn-src-all@FreeBSD.ORG Thu Feb 26 12:33:23 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 388CA1065692; Thu, 26 Feb 2009 12:33:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24CA28FC22; Thu, 26 Feb 2009 12:33:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1QCXNBd027815; Thu, 26 Feb 2009 12:33:23 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1QCXNXd027813; Thu, 26 Feb 2009 12:33:23 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200902261233.n1QCXNXd027813@svn.freebsd.org> From: Andriy Gapon Date: Thu, 26 Feb 2009 12:33:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189070 - head/sys/fs/udf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Feb 2009 12:33:28 -0000 Author: avg Date: Thu Feb 26 12:33:22 2009 New Revision: 189070 URL: http://svn.freebsd.org/changeset/base/189070 Log: udf: add read-ahead support modeled after cd9660 Reviewed by: scottl Approved by: jhb (mentor) Modified: head/sys/fs/udf/udf_vfsops.c head/sys/fs/udf/udf_vnops.c Modified: head/sys/fs/udf/udf_vfsops.c ============================================================================== --- head/sys/fs/udf/udf_vfsops.c Thu Feb 26 12:33:17 2009 (r189069) +++ head/sys/fs/udf/udf_vfsops.c Thu Feb 26 12:33:22 2009 (r189070) @@ -334,6 +334,11 @@ udf_mountfs(struct vnode *devvp, struct bo = &devvp->v_bufobj; + if (devvp->v_rdev->si_iosize_max != 0) + mp->mnt_iosize_max = devvp->v_rdev->si_iosize_max; + if (mp->mnt_iosize_max > MAXPHYS) + mp->mnt_iosize_max = MAXPHYS; + /* XXX: should be M_WAITOK */ udfmp = malloc(sizeof(struct udf_mnt), M_UDFMOUNT, M_NOWAIT | M_ZERO); Modified: head/sys/fs/udf/udf_vnops.c ============================================================================== --- head/sys/fs/udf/udf_vnops.c Thu Feb 26 12:33:17 2009 (r189069) +++ head/sys/fs/udf/udf_vnops.c Thu Feb 26 12:33:22 2009 (r189070) @@ -1045,6 +1045,7 @@ udf_bmap(struct vop_bmap_args *a) struct udf_node *node; uint32_t max_size; daddr_t lsector; + int nblk; int error; node = VTON(a->a_vp); @@ -1075,9 +1076,23 @@ udf_bmap(struct vop_bmap_args *a) /* Translate logical to physical sector number */ *a->a_bnp = lsector << (node->udfmp->bshift - DEV_BSHIFT); - /* Punt on read-ahead for now */ - if (a->a_runp) - *a->a_runp = 0; + /* + * Determine maximum number of readahead blocks following the + * requested block. + */ + if (a->a_runp) { + nblk = (max_size >> node->udfmp->bshift) - 1; + if (nblk <= 0) + *a->a_runp = 0; + else if (nblk >= (MAXBSIZE >> node->udfmp->bshift)) + *a->a_runp = (MAXBSIZE >> node->udfmp->bshift) - 1; + else + *a->a_runp = nblk; + } + + if (a->a_runb) { + *a->a_runb = 0; + } return (0); }