From 382743ada397c8d75b4fa23c31d787f37d1e4016 Mon Sep 17 00:00:00 2001 From: kleink Date: Fri, 5 Jun 1998 19:53:00 +0000 Subject: [PATCH] Convert fsync vnode operator implementations and usage from the old `waitfor' argument and MNT_WAIT/MNT_NOWAIT to `flags' and FSYNC_WAIT. --- sys/kern/vfs_subr.c | 4 ++-- sys/kern/vfs_syscalls.c | 4 ++-- sys/miscfs/specfs/spec_vnops.c | 6 +++--- sys/miscfs/union/union_vnops.c | 4 ++-- sys/msdosfs/msdosfs_vfsops.c | 8 +++++--- sys/nfs/nfs_nqlease.c | 4 ++-- sys/nfs/nfs_serv.c | 4 ++-- sys/nfs/nfs_vfsops.c | 5 +++-- sys/nfs/nfs_vnops.c | 9 +++++---- sys/ufs/ext2fs/ext2fs_vfsops.c | 8 +++++--- sys/ufs/ffs/ffs_vfsops.c | 8 +++++--- sys/ufs/lfs/lfs_vnops.c | 4 ++-- 12 files changed, 38 insertions(+), 30 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 8ba8544f49a6..86f84dd0412b 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_subr.c,v 1.87 1998/05/18 14:59:49 pk Exp $ */ +/* $NetBSD: vfs_subr.c,v 1.88 1998/06/05 20:02:18 kleink Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -545,7 +545,7 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo) int s, error; if (flags & V_SAVE) { - if ((error = VOP_FSYNC(vp, cred, MNT_WAIT, p)) != 0) + if ((error = VOP_FSYNC(vp, cred, FSYNC_WAIT, p)) != 0) return (error); if (vp->v_dirtyblkhd.lh_first != NULL) panic("vinvalbuf: dirty bufs"); diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 66a8aebd95b6..ff3a7486b5c1 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls.c,v 1.115 1998/03/27 13:02:21 kleink Exp $ */ +/* $NetBSD: vfs_syscalls.c,v 1.116 1998/06/05 20:04:15 kleink Exp $ */ /* * Copyright (c) 1989, 1993 @@ -2009,7 +2009,7 @@ sys_fsync(p, v, retval) return (error); vp = (struct vnode *)fp->f_data; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - error = VOP_FSYNC(vp, fp->f_cred, MNT_WAIT, p); + error = VOP_FSYNC(vp, fp->f_cred, FSYNC_WAIT, p); VOP_UNLOCK(vp, 0); return (error); } diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c index 04356b616b4f..395cac4fa8e6 100644 --- a/sys/miscfs/specfs/spec_vnops.c +++ b/sys/miscfs/specfs/spec_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: spec_vnops.c,v 1.39 1998/03/01 02:21:34 fvdl Exp $ */ +/* $NetBSD: spec_vnops.c,v 1.40 1998/06/05 19:53:00 kleink Exp $ */ /* * Copyright (c) 1989, 1993 @@ -465,13 +465,13 @@ spec_fsync(v) struct vop_fsync_args /* { struct vnode *a_vp; struct ucred *a_cred; - int a_waitfor; + int a_flags; struct proc *a_p; } */ *ap = v; register struct vnode *vp = ap->a_vp; if (vp->v_type == VBLK) - vflushbuf(vp, ap->a_waitfor == MNT_WAIT); + vflushbuf(vp, (ap->a_flags & FSYNC_WAIT) != 0); return (0); } diff --git a/sys/miscfs/union/union_vnops.c b/sys/miscfs/union/union_vnops.c index d85379d10a45..ad9fea978ae1 100644 --- a/sys/miscfs/union/union_vnops.c +++ b/sys/miscfs/union/union_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: union_vnops.c,v 1.41 1998/04/11 08:51:12 veego Exp $ */ +/* $NetBSD: union_vnops.c,v 1.42 1998/06/05 19:53:00 kleink Exp $ */ /* * Copyright (c) 1992, 1993, 1994, 1995 Jan-Simon Pendry. @@ -1040,7 +1040,7 @@ union_fsync(v) vn_lock(targetvp, LK_EXCLUSIVE | LK_RETRY); else FIXUP(VTOUNION(ap->a_vp)); - error = VOP_FSYNC(targetvp, ap->a_cred, ap->a_waitfor, p); + error = VOP_FSYNC(targetvp, ap->a_cred, ap->a_flags, p); if (dolock) VOP_UNLOCK(targetvp, 0); } diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c index 9cae37a9441b..2e1a8d5b982c 100644 --- a/sys/msdosfs/msdosfs_vfsops.c +++ b/sys/msdosfs/msdosfs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_vfsops.c,v 1.53 1998/03/01 02:25:11 fvdl Exp $ */ +/* $NetBSD: msdosfs_vfsops.c,v 1.54 1998/06/05 19:53:00 kleink Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -888,7 +888,8 @@ loop: goto loop; continue; } - if ((error = VOP_FSYNC(vp, cred, waitfor, p)) != 0) + if ((error = VOP_FSYNC(vp, cred, + waitfor == MNT_WAIT ? FSYNC_WAIT : 0, p)) != 0) allerror = error; vput(vp); simple_lock(&mntvnode_slock); @@ -897,7 +898,8 @@ loop: /* * Force stale file system control information to be flushed. */ - if ((error = VOP_FSYNC(pmp->pm_devvp, cred, waitfor, p)) != 0) + if ((error = VOP_FSYNC(pmp->pm_devvp, cred, + waitfor == MNT_WAIT ? FSYNC_WAIT : 0, p)) != 0) allerror = error; #ifdef QUOTA #endif diff --git a/sys/nfs/nfs_nqlease.c b/sys/nfs/nfs_nqlease.c index d7a2ef8beeb6..c5c4a1e50420 100644 --- a/sys/nfs/nfs_nqlease.c +++ b/sys/nfs/nfs_nqlease.c @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_nqlease.c,v 1.24 1998/03/01 02:24:27 fvdl Exp $ */ +/* $NetBSD: nfs_nqlease.c,v 1.25 1998/06/05 19:53:01 kleink Exp $ */ /* * Copyright (c) 1992, 1993 @@ -1075,7 +1075,7 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p) (void) nqnfs_vacated(vp, cred); } else if (vp->v_type == VREG) { (void) VOP_FSYNC(vp, cred, - MNT_WAIT, p); + FSYNC_WAIT, p); np->n_flag &= ~NMODIFIED; } } diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c index 9a198ed9650f..7254435f0a53 100644 --- a/sys/nfs/nfs_serv.c +++ b/sys/nfs/nfs_serv.c @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_serv.c,v 1.42 1998/03/01 02:24:28 fvdl Exp $ */ +/* $NetBSD: nfs_serv.c,v 1.43 1998/06/05 19:53:01 kleink Exp $ */ /* * Copyright (c) 1989, 1993 @@ -3079,7 +3079,7 @@ nfsrv_commit(nfsd, slp, procp, mrq) return (0); } for_ret = VOP_GETATTR(vp, &bfor, cred, procp); - error = VOP_FSYNC(vp, cred, MNT_WAIT, procp); + error = VOP_FSYNC(vp, cred, FSYNC_WAIT, procp); aft_ret = VOP_GETATTR(vp, &aft, cred, procp); vput(vp); nfsm_reply(NFSX_V3WCCDATA + NFSX_V3WRITEVERF); diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index 02340827e91c..07e18dd5f08c 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_vfsops.c,v 1.72 1998/03/24 13:49:21 fvdl Exp $ */ +/* $NetBSD: nfs_vfsops.c,v 1.73 1998/06/05 19:53:01 kleink Exp $ */ /* * Copyright (c) 1989, 1993, 1995 @@ -911,7 +911,8 @@ loop: continue; if (vget(vp, LK_EXCLUSIVE)) goto loop; - error = VOP_FSYNC(vp, cred, waitfor, p); + error = VOP_FSYNC(vp, cred, + waitfor == MNT_WAIT ? FSYNC_WAIT : 0, p); if (error) allerror = error; vput(vp); diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 20cc39376499..a09706357683 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_vnops.c,v 1.91 1998/05/08 18:26:55 kleink Exp $ */ +/* $NetBSD: nfs_vnops.c,v 1.92 1998/06/05 19:53:02 kleink Exp $ */ /* * Copyright (c) 1989, 1993 @@ -1722,7 +1722,7 @@ nfs_link(v) * doesn't get "out of sync" with the server. * XXX There should be a better way! */ - VOP_FSYNC(vp, cnp->cn_cred, MNT_WAIT, cnp->cn_proc); + VOP_FSYNC(vp, cnp->cn_cred, FSYNC_WAIT, cnp->cn_proc); v3 = NFS_ISV3(vp); nfsstats.rpccnt[NFSPROC_LINK]++; @@ -2760,11 +2760,12 @@ nfs_fsync(v) struct vnodeop_desc *a_desc; struct vnode * a_vp; struct ucred * a_cred; - int a_waitfor; + int a_flags; struct proc * a_p; } */ *ap = v; - return (nfs_flush(ap->a_vp, ap->a_cred, ap->a_waitfor, ap->a_p, 1)); + return (nfs_flush(ap->a_vp, ap->a_cred, + (ap->a_flags & FSYNC_WAIT) != 0 ? MNT_WAIT : 0, ap->a_p, 1)); } /* diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c index 959c83de0fdd..eb50a48064d9 100644 --- a/sys/ufs/ext2fs/ext2fs_vfsops.c +++ b/sys/ufs/ext2fs/ext2fs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_vfsops.c,v 1.11 1998/03/18 15:57:26 bouyer Exp $ */ +/* $NetBSD: ext2fs_vfsops.c,v 1.12 1998/06/05 19:53:02 kleink Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. @@ -814,7 +814,8 @@ loop: if (error == ENOENT) goto loop; } - if ((error = VOP_FSYNC(vp, cred, waitfor, p)) != 0) + if ((error = VOP_FSYNC(vp, cred, + waitfor == MNT_WAIT ? FSYNC_WAIT : 0, p)) != 0) allerror = error; VOP_UNLOCK(vp, 0); vrele(vp); @@ -824,7 +825,8 @@ loop: /* * Force stale file system control information to be flushed. */ - if ((error = VOP_FSYNC(ump->um_devvp, cred, waitfor, p)) != 0) + if ((error = VOP_FSYNC(ump->um_devvp, cred, + waitfor == MNT_WAIT ? FSYNC_WAIT : 0, p)) != 0) allerror = error; /* * Write back modified superblock. diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 66d915409244..0b95fcbcb17e 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_vfsops.c,v 1.34 1998/03/18 15:57:28 bouyer Exp $ */ +/* $NetBSD: ffs_vfsops.c,v 1.35 1998/06/05 19:53:02 kleink Exp $ */ /* * Copyright (c) 1989, 1991, 1993, 1994 @@ -802,7 +802,8 @@ loop: goto loop; continue; } - if ((error = VOP_FSYNC(vp, cred, waitfor, p)) != 0) + if ((error = VOP_FSYNC(vp, cred, + waitfor == MNT_WAIT ? FSYNC_WAIT : 0, p)) != 0) allerror = error; vput(vp); simple_lock(&mntvnode_slock); @@ -811,7 +812,8 @@ loop: /* * Force stale file system control information to be flushed. */ - if ((error = VOP_FSYNC(ump->um_devvp, cred, waitfor, p)) != 0) + if ((error = VOP_FSYNC(ump->um_devvp, cred, + waitfor == MNT_WAIT ? FSYNC_WAIT : 0, p)) != 0) allerror = error; #ifdef QUOTA qsync(mp); diff --git a/sys/ufs/lfs/lfs_vnops.c b/sys/ufs/lfs/lfs_vnops.c index 462e4d20cccf..1afd94f4a3ac 100644 --- a/sys/ufs/lfs/lfs_vnops.c +++ b/sys/ufs/lfs/lfs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_vnops.c,v 1.15 1998/03/01 02:23:25 fvdl Exp $ */ +/* $NetBSD: lfs_vnops.c,v 1.16 1998/06/05 19:53:02 kleink Exp $ */ /* * Copyright (c) 1986, 1989, 1991, 1993, 1995 @@ -241,7 +241,7 @@ lfs_fsync(v) TIMEVAL_TO_TIMESPEC(&time, &ts); return (VOP_UPDATE(ap->a_vp, &ts, &ts, - ap->a_waitfor == MNT_WAIT ? LFS_SYNC : 0)); + (ap->a_flags & FSYNC_WAIT) != 0 ? LFS_SYNC : 0)); /* XXX */ } /*