diff options
author | kib <kib@FreeBSD.org> | 2012-02-06 11:04:36 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2012-02-06 11:04:36 +0000 |
commit | 52c17430bc70cd8c1e6dc2ff5c7786cc3f4871e4 (patch) | |
tree | fae5558858b305702b78be385893645701a55d02 /sys/fs | |
parent | 8b885b79f5441a9ccaf7101ad3dab74016626fe6 (diff) | |
download | FreeBSD-src-52c17430bc70cd8c1e6dc2ff5c7786cc3f4871e4.zip FreeBSD-src-52c17430bc70cd8c1e6dc2ff5c7786cc3f4871e4.tar.gz |
Current implementations of sync(2) and syncer vnode fsync() VOP uses
mnt_noasync counter to temporary remove MNTK_ASYNC mount option, which
is needed to guarantee a synchronous completion of the initiated i/o
before syscall or VOP return. Global removal of MNTK_ASYNC option is
harmful because not only i/o started from corresponding thread becomes
synchronous, but all i/o is synchronous on the filesystem which is
initiated during sync(2) or syncer activity.
Instead of removing MNTK_ASYNC from mnt_kern_flag, provide a local
thread flag to disable async i/o for current thread only. Use the
opportunity to move DOINGASYNC() macro into sys/vnode.h and
consistently use it through places which tested for MNTK_ASYNC.
Some testing demonstrated 60-70% improvements in run time for the
metadata-intensive operations on async-mounted UFS volumes, but still
with great deviation due to other reasons.
Reviewed by: mckusick
Tested by: scottl
MFC after: 2 weeks
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/ext2fs/inode.h | 3 | ||||
-rw-r--r-- | sys/fs/nfsclient/nfs_clvnops.c | 2 |
2 files changed, 1 insertions, 4 deletions
diff --git a/sys/fs/ext2fs/inode.h b/sys/fs/ext2fs/inode.h index 92a84ac..ae794d7 100644 --- a/sys/fs/ext2fs/inode.h +++ b/sys/fs/ext2fs/inode.h @@ -158,9 +158,6 @@ struct indir { #define VTOI(vp) ((struct inode *)(vp)->v_data) #define ITOV(ip) ((ip)->i_vnode) -/* Check whether the MNTK_ASYNC flag has been set for a mount point */ -#define DOINGASYNC(vp) ((vp)->v_mount->mnt_kern_flag & MNTK_ASYNC) - /* This overlays the fid structure (see mount.h). */ struct ufid { uint16_t ufid_len; /* Length of structure. */ diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 7443fc9..e2e09b9 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -1376,7 +1376,7 @@ ncl_writerpc(struct vnode *vp, struct uio *uiop, struct ucred *cred, if (ret && !error) error = ret; } - if (vp->v_mount->mnt_kern_flag & MNTK_ASYNC) + if (DOINGASYNC(vp)) *iomode = NFSWRITE_FILESYNC; if (error && NFS_ISV4(vp)) error = nfscl_maperr(uiop->uio_td, error, (uid_t)0, (gid_t)0); |