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/geom/journal/g_journal.c | |
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/geom/journal/g_journal.c')
-rw-r--r-- | sys/geom/journal/g_journal.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/sys/geom/journal/g_journal.c b/sys/geom/journal/g_journal.c index 706d6d4..a31f590 100644 --- a/sys/geom/journal/g_journal.c +++ b/sys/geom/journal/g_journal.c @@ -2870,7 +2870,7 @@ g_journal_do_switch(struct g_class *classp) struct mount *mp; struct bintime bt; char *mountpoint; - int error, vfslocked; + int error, save, vfslocked; DROP_GIANT(); g_topology_lock(); @@ -2932,10 +2932,7 @@ g_journal_do_switch(struct g_class *classp) goto next; } - MNT_ILOCK(mp); - mp->mnt_noasync++; - mp->mnt_kern_flag &= ~MNTK_ASYNC; - MNT_IUNLOCK(mp); + save = curthread_pflags_set(TDP_SYNCIO); GJ_TIMER_START(1, &bt); vfs_msync(mp, MNT_NOWAIT); @@ -2950,11 +2947,7 @@ g_journal_do_switch(struct g_class *classp) mountpoint, error); } - MNT_ILOCK(mp); - mp->mnt_noasync--; - if ((mp->mnt_flag & MNT_ASYNC) != 0 && mp->mnt_noasync == 0) - mp->mnt_kern_flag |= MNTK_ASYNC; - MNT_IUNLOCK(mp); + curthread_pflags_restore(save); vn_finished_write(mp); |