diff options
author | kan <kan@FreeBSD.org> | 2003-03-11 22:15:10 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2003-03-11 22:15:10 +0000 |
commit | 378cd3b05d24e35b8f882e3eff724bb1ad5459f7 (patch) | |
tree | efabc12de7b77fafe029a678e61151926f8cec1c /sys/fs/nwfs | |
parent | b2bb08b487890b3c3ed6adca7372f3d742354a76 (diff) | |
download | FreeBSD-src-378cd3b05d24e35b8f882e3eff724bb1ad5459f7.zip FreeBSD-src-378cd3b05d24e35b8f882e3eff724bb1ad5459f7.tar.gz |
Rename vfs_stdsync function to vfs_stdnosync which matches more
closely what function is really doing. Update all existing consumers
to use the new name.
Introduce a new vfs_stdsync function, which iterates over mount
point's vnodes and call FSYNC on each one of them in turn.
Make nwfs and smbfs use this new function instead of rolling their
own identical sync implementations.
Reviewed by: jeff
Diffstat (limited to 'sys/fs/nwfs')
-rw-r--r-- | sys/fs/nwfs/nwfs_vfsops.c | 53 |
1 files changed, 1 insertions, 52 deletions
diff --git a/sys/fs/nwfs/nwfs_vfsops.c b/sys/fs/nwfs/nwfs_vfsops.c index f097b3e..868bcec 100644 --- a/sys/fs/nwfs/nwfs_vfsops.c +++ b/sys/fs/nwfs/nwfs_vfsops.c @@ -76,7 +76,6 @@ static int nwfs_quotactl(struct mount *, int, uid_t, caddr_t, struct thread *); static int nwfs_root(struct mount *, struct vnode **); static int nwfs_start(struct mount *, int, struct thread *); static int nwfs_statfs(struct mount *, struct statfs *, struct thread *); -static int nwfs_sync(struct mount *, int, struct ucred *, struct thread *); static int nwfs_unmount(struct mount *, int, struct thread *); static int nwfs_init(struct vfsconf *vfsp); static int nwfs_uninit(struct vfsconf *vfsp); @@ -88,7 +87,7 @@ static struct vfsops nwfs_vfsops = { nwfs_root, nwfs_quotactl, nwfs_statfs, - nwfs_sync, + vfs_stdsync, vfs_stdvget, vfs_stdfhtovp, /* shouldn't happen */ vfs_stdcheckexp, @@ -460,53 +459,3 @@ nwfs_statfs(mp, sbp, td) strncpy(sbp->f_fstypename, mp->mnt_vfc->vfc_name, MFSNAMELEN); return 0; } - -/* - * Flush out the buffer cache - */ -/* ARGSUSED */ -static int -nwfs_sync(mp, waitfor, cred, td) - struct mount *mp; - int waitfor; - struct ucred *cred; - struct thread *td; -{ - struct vnode *vp, *nvp; - int error, allerror = 0; - /* - * Force stale buffer cache information to be flushed. - */ - mtx_lock(&mntvnode_mtx); -loop: - for (vp = TAILQ_FIRST(&mp->mnt_nvnodelist); - vp != NULL; - vp = nvp) { - /* - * If the vnode that we are about to sync is no longer - * associated with this mount point, start over. - */ - if (vp->v_mount != mp) - goto loop; - nvp = TAILQ_NEXT(vp, v_nmntvnodes); - mtx_unlock(&mntvnode_mtx); - VI_LOCK(vp); - if (VOP_ISLOCKED(vp, NULL) || TAILQ_EMPTY(&vp->v_dirtyblkhd) || - waitfor == MNT_LAZY) { - VI_UNLOCK(vp); - mtx_lock(&mntvnode_mtx); - continue; - } - if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td)) { - mtx_lock(&mntvnode_mtx); - goto loop; - } - error = VOP_FSYNC(vp, cred, waitfor, td); - if (error) - allerror = error; - vput(vp); - mtx_lock(&mntvnode_mtx); - } - mtx_unlock(&mntvnode_mtx); - return (allerror); -} |