From 9440653d07a9ab9b15dea77ce2cf508cfb0adf5e Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Wed, 6 Dec 2000 20:55:09 +0000 Subject: [PATCH] Add necessary bwillwrite() in writev() entry point. Deal with excessive dirty buffers when msync() syncs non-contiguous dirty buffers by checking for the case in UFS *before* checking for clusterability. --- sys/kern/sys_generic.c | 1 + sys/ufs/ufs/ufs_readwrite.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 8452cc0f3a2f..bce9231da92a 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -496,6 +496,7 @@ writev(p, uap) } #endif cnt = auio.uio_resid; + bwillwrite(); if ((error = fo_write(fp, &auio, fp->f_cred, 0, p))) { if (auio.uio_resid != cnt && (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) diff --git a/sys/ufs/ufs/ufs_readwrite.c b/sys/ufs/ufs/ufs_readwrite.c index 785219c8aded..4830120c6213 100644 --- a/sys/ufs/ufs/ufs_readwrite.c +++ b/sys/ufs/ufs/ufs_readwrite.c @@ -495,6 +495,9 @@ WRITE(ap) if (ioflag & IO_SYNC) { (void)bwrite(bp); + } else if (vm_page_count_severe() || buf_dirty_count_severe()) { + bp->b_flags |= B_CLUSTEROK; + bawrite(bp); } else if (xfersize + blkoffset == fs->fs_bsize) { if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0) { bp->b_flags |= B_CLUSTEROK; @@ -502,9 +505,6 @@ WRITE(ap) } else { bawrite(bp); } - } else if (vm_page_count_severe() || buf_dirty_count_severe()) { - bp->b_flags |= B_CLUSTEROK; - bawrite(bp); } else { bp->b_flags |= B_CLUSTEROK; bdwrite(bp);