From 4dc4e0d2282a9a3bc07e1bf42011f686c9da811b Mon Sep 17 00:00:00 2001 From: John Dyson Date: Sun, 5 Nov 1995 21:01:15 +0000 Subject: [PATCH] Make MNT_ASYNC more effective for UFS. It should not be too much more dangerous than the original MNT_ASYNC. There might be some minor security considerations due to data writes not being posted as promptly as before. Meta-data operations are still not quite as fast as Linux, but streaming I/O is still higher. --- sys/kern/vfs_extattr.c | 5 +++-- sys/kern/vfs_syscalls.c | 5 +++-- sys/ufs/ffs/ffs_inode.c | 6 +++++- sys/ufs/ufs/ufs_readwrite.c | 5 +++-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index 3c8aed07c8db..f779d2bae628 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 - * $Id: vfs_syscalls.c,v 1.35 1995/10/22 09:32:28 davidg Exp $ + * $Id: vfs_syscalls.c,v 1.36 1995/11/04 10:35:26 bde Exp $ */ #include @@ -1764,7 +1764,8 @@ fsync(p, uap, retval) if (vp->v_object) { vm_object_page_clean(vp->v_object, 0, 0 ,0, FALSE); } - error = VOP_FSYNC(vp, fp->f_cred, MNT_WAIT, p); + error = VOP_FSYNC(vp, fp->f_cred, + (vp->v_mount->mnt_flag & MNT_ASYNC) ? MNT_NOWAIT : MNT_WAIT, p); VOP_UNLOCK(vp); return (error); } diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 3c8aed07c8db..f779d2bae628 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 - * $Id: vfs_syscalls.c,v 1.35 1995/10/22 09:32:28 davidg Exp $ + * $Id: vfs_syscalls.c,v 1.36 1995/11/04 10:35:26 bde Exp $ */ #include @@ -1764,7 +1764,8 @@ fsync(p, uap, retval) if (vp->v_object) { vm_object_page_clean(vp->v_object, 0, 0 ,0, FALSE); } - error = VOP_FSYNC(vp, fp->f_cred, MNT_WAIT, p); + error = VOP_FSYNC(vp, fp->f_cred, + (vp->v_mount->mnt_flag & MNT_ASYNC) ? MNT_NOWAIT : MNT_WAIT, p); VOP_UNLOCK(vp); return (error); } diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 1b8d25c461d0..3b5f56f85d61 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_inode.c 8.5 (Berkeley) 12/30/93 - * $Id: ffs_inode.c,v 1.14 1995/08/04 05:49:17 davidg Exp $ + * $Id: ffs_inode.c,v 1.15 1995/08/16 13:16:58 davidg Exp $ */ #include @@ -222,6 +222,8 @@ ffs_truncate(ap) oip->i_size = length; if (aflags & B_SYNC) bwrite(bp); + else if (ovp->v_mount->mnt_flag & MNT_ASYNC) + bdwrite(bp); else bawrite(bp); vnode_pager_setsize(ovp, (u_long)length); @@ -252,6 +254,8 @@ ffs_truncate(ap) allocbuf(bp, size); if (aflags & B_SYNC) bwrite(bp); + else if (ovp->v_mount->mnt_flag & MNT_ASYNC) + bdwrite(bp); else bawrite(bp); } diff --git a/sys/ufs/ufs/ufs_readwrite.c b/sys/ufs/ufs/ufs_readwrite.c index c9b4e820197f..524a36d44920 100644 --- a/sys/ufs/ufs/ufs_readwrite.c +++ b/sys/ufs/ufs/ufs_readwrite.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ufs_readwrite.c 8.7 (Berkeley) 1/21/94 - * $Id: ufs_readwrite.c,v 1.13 1995/09/11 15:56:46 bde Exp $ + * $Id: ufs_readwrite.c,v 1.14 1995/10/23 02:23:18 dyson Exp $ */ #ifdef LFS_READWRITE @@ -280,7 +280,8 @@ WRITE(ap) if (ioflag & IO_SYNC) { (void)bwrite(bp); - } else if (xfersize + blkoffset == fs->fs_bsize) { + } else if (xfersize + blkoffset == fs->fs_bsize && + (vp->v_mount->mnt_flag & MNT_ASYNC) == 0) { if (doclusterwrite) { bp->b_flags |= B_CLUSTEROK; cluster_write(bp, ip->i_size);