summaryrefslogtreecommitdiffstats
path: root/sys/fs/udf
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2009-02-26 12:33:22 +0000
committeravg <avg@FreeBSD.org>2009-02-26 12:33:22 +0000
commit8e0e1b6f4d09a653160808354820d60750feb3c9 (patch)
treeab22d8f0845f494883a096dd970e8e2d608eaac4 /sys/fs/udf
parente1be6e63ae9fe9745df160dcdddb756e7105a9e3 (diff)
downloadFreeBSD-src-8e0e1b6f4d09a653160808354820d60750feb3c9.zip
FreeBSD-src-8e0e1b6f4d09a653160808354820d60750feb3c9.tar.gz
udf: add read-ahead support modeled after cd9660
Reviewed by: scottl Approved by: jhb (mentor)
Diffstat (limited to 'sys/fs/udf')
-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 d731918..b1a55d8 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 d8da97e..4d5b3a3 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);
}
OpenPOWER on IntegriCloud