From 057e33d02ca1d636be1b99e212ebb7911cf4fc62 Mon Sep 17 00:00:00 2001 From: dillon Date: Sun, 2 Apr 2000 00:55:28 +0000 Subject: Change the write-behind code to take more care when starting async I/O's. The sequential read heuristic has been extended to cover writes as well. We continue to call cluster_write() normally, thus blocks in the file will still be reallocated for large (but still random) I/O's, but I/O will only be initiated for truely sequential writes. This solves a number of annoying situations, especially with DBM (hash method) writes, and also has the side effect of fixing a number of (stupid) benchmarks. Reviewed-by: mckusick --- sys/gnu/ext2fs/ext2_readwrite.c | 4 +++- sys/gnu/fs/ext2fs/ext2_readwrite.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'sys/gnu') diff --git a/sys/gnu/ext2fs/ext2_readwrite.c b/sys/gnu/ext2fs/ext2_readwrite.c index d49466d..f054a6e 100644 --- a/sys/gnu/ext2fs/ext2_readwrite.c +++ b/sys/gnu/ext2fs/ext2_readwrite.c @@ -175,9 +175,11 @@ WRITE(ap) struct proc *p; daddr_t lbn; off_t osize; + int seqcount; int blkoffset, error, flags, ioflag, resid, size, xfersize; ioflag = ap->a_ioflag; + seqcount = ap->a_ioflag >> 16; uio = ap->a_uio; vp = ap->a_vp; ip = VTOI(vp); @@ -265,7 +267,7 @@ WRITE(ap) } else if (xfersize + blkoffset == fs->s_frag_size) { if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0) { bp->b_flags |= B_CLUSTEROK; - cluster_write(bp, ip->i_size); + cluster_write(bp, ip->i_size, seqcount); } else { bawrite(bp); } diff --git a/sys/gnu/fs/ext2fs/ext2_readwrite.c b/sys/gnu/fs/ext2fs/ext2_readwrite.c index d49466d..f054a6e 100644 --- a/sys/gnu/fs/ext2fs/ext2_readwrite.c +++ b/sys/gnu/fs/ext2fs/ext2_readwrite.c @@ -175,9 +175,11 @@ WRITE(ap) struct proc *p; daddr_t lbn; off_t osize; + int seqcount; int blkoffset, error, flags, ioflag, resid, size, xfersize; ioflag = ap->a_ioflag; + seqcount = ap->a_ioflag >> 16; uio = ap->a_uio; vp = ap->a_vp; ip = VTOI(vp); @@ -265,7 +267,7 @@ WRITE(ap) } else if (xfersize + blkoffset == fs->s_frag_size) { if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0) { bp->b_flags |= B_CLUSTEROK; - cluster_write(bp, ip->i_size); + cluster_write(bp, ip->i_size, seqcount); } else { bawrite(bp); } -- cgit v1.1