Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Mar 2009 14:09:20 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r190050 - in stable/7/sys: . fs/udf
Message-ID:  <200903191409.n2JE9KuW064064@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903191409.n2JE9KuW064064>