From owner-svn-src-all@FreeBSD.ORG Thu Mar 19 14:09:21 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 46E04106564A; Thu, 19 Mar 2009 14:09:21 +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 1A5368FC1E; Thu, 19 Mar 2009 14:09:21 +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 n2JE9Lvf064066; Thu, 19 Mar 2009 14:09:21 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2JE9KuW064064; Thu, 19 Mar 2009 14:09:20 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200903191409.n2JE9KuW064064@svn.freebsd.org> From: Andriy Gapon Date: Thu, 19 Mar 2009 14:09:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190050 - in stable/7/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, 19 Mar 2009 14:09:22 -0000 Author: avg Date: Thu Mar 19 14:09:20 2009 New Revision: 190050 URL: http://svn.freebsd.org/changeset/base/190050 Log: MFC 189070: udf: add read-ahead support modeled after cd9660 Approved by: jhb (mentor) Modified: stable/7/sys/ (props changed) stable/7/sys/fs/udf/udf_vfsops.c stable/7/sys/fs/udf/udf_vnops.c Modified: stable/7/sys/fs/udf/udf_vfsops.c ============================================================================== --- stable/7/sys/fs/udf/udf_vfsops.c Thu Mar 19 14:07:27 2009 (r190049) +++ stable/7/sys/fs/udf/udf_vfsops.c Thu Mar 19 14:09:20 2009 (r190050) @@ -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 */ MALLOC(udfmp, struct udf_mnt *, sizeof(struct udf_mnt), M_UDFMOUNT, M_NOWAIT | M_ZERO); Modified: stable/7/sys/fs/udf/udf_vnops.c ============================================================================== --- stable/7/sys/fs/udf/udf_vnops.c Thu Mar 19 14:07:27 2009 (r190049) +++ stable/7/sys/fs/udf/udf_vnops.c Thu Mar 19 14:09:20 2009 (r190050) @@ -1028,6 +1028,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); @@ -1058,9 +1059,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); }