summaryrefslogtreecommitdiff
path: root/sys/isofs
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2002-05-23 14:35:21 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2002-05-23 14:35:21 +0000
commit10d580d290f740e316d8284210b9e98cbbdfa61b (patch)
tree1cca7c0d5a87b04e588e75bf83b596a07718102e /sys/isofs
parent4e173dea0b98025ed47ee97aeb77dcce0510f219 (diff)
Since the days of architectures where page size is smaller than
9660 block size are long gone and we can't use cluster_read on modern machines, improve the dumb read-ahead. Doesn't change much on macppc and sparc64, but gives a nice speed boost on i386 (noone knows why). espie can watch his DVDs again. espie@ ok (noone else complained)
Diffstat (limited to 'sys/isofs')
-rw-r--r--sys/isofs/cd9660/cd9660_vnops.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c
index 86e5c2d0483..317b47885e8 100644
--- a/sys/isofs/cd9660/cd9660_vnops.c
+++ b/sys/isofs/cd9660/cd9660_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd9660_vnops.c,v 1.21 2002/03/14 01:27:03 millert Exp $ */
+/* $OpenBSD: cd9660_vnops.c,v 1.22 2002/05/23 14:35:20 art Exp $ */
/* $NetBSD: cd9660_vnops.c,v 1.42 1997/10/16 23:56:57 christos Exp $ */
/*-
@@ -320,7 +320,7 @@ cd9660_read(v)
struct buf *bp;
daddr_t lbn, rablock;
off_t diff;
- int rasize, error = 0;
+ int error = 0;
long size, n, on;
if (uio->uio_resid == 0)
@@ -330,6 +330,8 @@ cd9660_read(v)
ip->i_flag |= IN_ACCESS;
imp = ip->i_mnt;
do {
+ struct cluster_info *ci = &ip->i_ci;
+
lbn = lblkno(imp, uio->uio_offset);
on = blkoff(imp, uio->uio_offset);
n = min((u_int)(imp->logical_block_size - on),
@@ -348,15 +350,24 @@ cd9660_read(v)
else
error = bread(vp, lbn, size, NOCRED, &bp);
} else {
- if (ip->i_ci.ci_lastr + 1 == lbn &&
- lblktosize(imp, rablock) < ip->i_size) {
- rasize = blksize(imp, ip, rablock);
- error = breadn(vp, lbn, size, &rablock,
- &rasize, 1, NOCRED, &bp);
+#define MAX_RA 32
+ if (ci->ci_lastr + 1 == lbn) {
+ daddr_t rablks[MAX_RA];
+ int rasizes[MAX_RA];
+ int i;
+
+ for (i = 0; i < MAX_RA &&
+ lblktosize(imp, (rablock + i)) < ip->i_size;
+ i++) {
+ rablks[i] = rablock + i;
+ rasizes[i] = blksize(imp, ip, rablock + i);
+ }
+ error = breadn(vp, lbn, size, rablks,
+ rasizes, i, NOCRED, &bp);
} else
error = bread(vp, lbn, size, NOCRED, &bp);
}
- ip->i_ci.ci_lastr = lbn;
+ ci->ci_lastr = lbn;
n = min(n, size - bp->b_resid);
if (error) {
brelse(bp);