diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2012-02-06 11:04:36 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2012-02-06 11:04:36 +0000 |
commit | c480f781ea11fcb858cac1fd20775e6aed8168fe (patch) | |
tree | fae5558858b305702b78be385893645701a55d02 /sys/geom/journal | |
parent | f1cf0245993bb22611bb131632a10596b635f75f (diff) | |
download | src-c480f781ea11fcb858cac1fd20775e6aed8168fe.tar.gz src-c480f781ea11fcb858cac1fd20775e6aed8168fe.zip |
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
Notes
Notes:
svn path=/head/; revision=231075
Diffstat (limited to 'sys/geom/journal')
-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 706d6d418a9d..a31f5904ce77 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); |