aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2009-02-26 12:33:22 +0000
committerAndriy Gapon <avg@FreeBSD.org>2009-02-26 12:33:22 +0000
commitfb2a76ccf838d7b4bbd5dcc78f8b08ae7b183a65 (patch)
treeab22d8f0845f494883a096dd970e8e2d608eaac4
parent82467096ff20890954a0010fa3928309c20df312 (diff)
downloadsrc-fb2a76ccf838d7b4bbd5dcc78f8b08ae7b183a65.tar.gz
src-fb2a76ccf838d7b4bbd5dcc78f8b08ae7b183a65.zip
udf: add read-ahead support modeled after cd9660
Reviewed by: scottl Approved by: jhb (mentor)
Notes
Notes: svn path=/head/; revision=189070
-rw-r--r--sys/fs/udf/udf_vfsops.c5
-rw-r--r--sys/fs/udf/udf_vnops.c21
2 files changed, 23 insertions, 3 deletions
diff --git a/sys/fs/udf/udf_vfsops.c b/sys/fs/udf/udf_vfsops.c
index d73191845b71..b1a55d88ca4e 100644
--- a/sys/fs/udf/udf_vfsops.c
+++ b/sys/fs/udf/udf_vfsops.c
@@ -334,6 +334,11 @@ udf_mountfs(struct vnode *devvp, struct mount *mp)
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);
diff --git a/sys/fs/udf/udf_vnops.c b/sys/fs/udf/udf_vnops.c
index d8da97e8afa6..4d5b3a35c393 100644
--- a/sys/fs/udf/udf_vnops.c
+++ b/sys/fs/udf/udf_vnops.c
@@ -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);
}