diff options
author | Kurt Miller <kurt@cvs.openbsd.org> | 2020-01-24 13:01:30 +0000 |
---|---|---|
committer | Kurt Miller <kurt@cvs.openbsd.org> | 2020-01-24 13:01:30 +0000 |
commit | 8e271b8dd5d0a45674d5b8e0d799fce01e2622de (patch) | |
tree | 13f24b0a10b0fa880462441b04c794dedbc16e60 /sys | |
parent | 57c458f7856c59113f81d27690f4f4fd6fa17deb (diff) |
Improve small random read ffs performance:
Only call bread_cluster if either the previously read ffs block is
adjacent to the current block or if the current read request exceeds the
current ffs block. This effectively turns off read-ahead for random reads
that fall within one ffs block.
okay beck@, mpi@, visa@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/ufs/ffs/ffs_vnops.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 58199bf6b36..3c21187cf3c 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vnops.c,v 1.96 2020/01/20 23:21:56 claudio Exp $ */ +/* $OpenBSD: ffs_vnops.c,v 1.97 2020/01/24 13:01:29 kurt Exp $ */ /* $NetBSD: ffs_vnops.c,v 1.7 1996/05/11 18:27:24 mycroft Exp $ */ /* @@ -232,11 +232,15 @@ ffs_read(void *v) if (lblktosize(fs, nextlbn) >= DIP(ip, size)) error = bread(vp, lbn, size, &bp); - else + else if (lbn - 1 == ip->i_ci.ci_lastr || + uio->uio_resid > xfersize) { error = bread_cluster(vp, lbn, size, &bp); + } else + error = bread(vp, lbn, size, &bp); if (error) break; + ip->i_ci.ci_lastr = lbn; /* * We should only get non-zero b_resid when an I/O error |