From 38ddb5725bd450537fe84c21d7ab4c03b6114b1e Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Fri, 9 Mar 2012 00:12:05 +0000 Subject: [PATCH] Decomission mnt_noasync. Introduce MNTK_NOASYNC mnt_kern_flag which allows a filesystem to request VFS to not allow MNTK_ASYNC. MFC after: 1 week --- sys/kern/vfs_mount.c | 9 ++++++--- sys/kern/vfs_subr.c | 2 +- sys/sys/mount.h | 2 +- sys/ufs/ffs/ffs_softdep.c | 3 +-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index ddc17cc326ea..93387cad51a8 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -851,7 +851,8 @@ vfs_domount_first( mp->mnt_optnew = NULL; MNT_ILOCK(mp); - if ((mp->mnt_flag & MNT_ASYNC) != 0 && mp->mnt_noasync == 0) + if ((mp->mnt_flag & MNT_ASYNC) != 0 && + (mp->mnt_kern_flag & MNTK_NOASYNC) == 0) mp->mnt_kern_flag |= MNTK_ASYNC; else mp->mnt_kern_flag &= ~MNTK_ASYNC; @@ -991,7 +992,8 @@ vfs_domount_update( */ mp->mnt_flag = (mp->mnt_flag & MNT_QUOTA) | (flag & ~MNT_QUOTA); } - if ((mp->mnt_flag & MNT_ASYNC) != 0 && mp->mnt_noasync == 0) + if ((mp->mnt_flag & MNT_ASYNC) != 0 && + (mp->mnt_kern_flag & MNTK_NOASYNC) == 0) mp->mnt_kern_flag |= MNTK_ASYNC; else mp->mnt_kern_flag &= ~MNTK_ASYNC; @@ -1351,7 +1353,8 @@ dounmount(mp, flags, td) } mp->mnt_kern_flag &= ~(MNTK_UNMOUNT | MNTK_UNMOUNTF); mp->mnt_flag |= async_flag; - if ((mp->mnt_flag & MNT_ASYNC) != 0 && mp->mnt_noasync == 0) + if ((mp->mnt_flag & MNT_ASYNC) != 0 && + (mp->mnt_kern_flag & MNTK_NOASYNC) == 0) mp->mnt_kern_flag |= MNTK_ASYNC; if (mp->mnt_kern_flag & MNTK_MWAIT) { mp->mnt_kern_flag &= ~MNTK_MWAIT; diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 8d3c6aa0674c..753875f301cc 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -2942,6 +2942,7 @@ DB_SHOW_COMMAND(mount, db_show_mount) MNT_KERN_FLAG(MNTK_REFEXPIRE); MNT_KERN_FLAG(MNTK_EXTENDED_SHARED); MNT_KERN_FLAG(MNTK_SHARED_WRITES); + MNT_KERN_FLAG(MNTK_NOASYNC); MNT_KERN_FLAG(MNTK_UNMOUNT); MNT_KERN_FLAG(MNTK_MWAIT); MNT_KERN_FLAG(MNTK_SUSPEND); @@ -2994,7 +2995,6 @@ DB_SHOW_COMMAND(mount, db_show_mount) db_printf(" mnt_gen = %d\n", mp->mnt_gen); db_printf(" mnt_nvnodelistsize = %d\n", mp->mnt_nvnodelistsize); db_printf(" mnt_writeopcount = %d\n", mp->mnt_writeopcount); - db_printf(" mnt_noasync = %u\n", mp->mnt_noasync); db_printf(" mnt_maxsymlinklen = %d\n", mp->mnt_maxsymlinklen); db_printf(" mnt_iosize_max = %d\n", mp->mnt_iosize_max); db_printf(" mnt_hashseed = %u\n", mp->mnt_hashseed); diff --git a/sys/sys/mount.h b/sys/sys/mount.h index f68a046ba8a2..2b6041e94aaf 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -167,7 +167,6 @@ struct mount { int mnt_writeopcount; /* (i) write syscalls pending */ int mnt_kern_flag; /* (i) kernel only flags */ uint64_t mnt_flag; /* (i) flags shared with user */ - u_int mnt_noasync; /* (i) # noasync overrides */ struct vfsoptlist *mnt_opt; /* current mount options */ struct vfsoptlist *mnt_optnew; /* new options passed to fs */ int mnt_maxsymlinklen; /* max size of short symlink */ @@ -325,6 +324,7 @@ void __mnt_vnode_markerfree(struct vnode **mvp, struct mount *mp); #define MNTK_REFEXPIRE 0x00000020 /* refcount expiring is happening */ #define MNTK_EXTENDED_SHARED 0x00000040 /* Allow shared locking for more ops */ #define MNTK_SHARED_WRITES 0x00000080 /* Allow shared locking for writes */ +#define MNTK_NOASYNC 0x00800000 /* disable async */ #define MNTK_UNMOUNT 0x01000000 /* unmount in progress */ #define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */ #define MNTK_SUSPEND 0x08000000 /* request write suspension */ diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index debb8389e80a..67ef6f4b53a1 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -2368,8 +2368,7 @@ softdep_mount(devvp, mp, fs, cred) mp->mnt_flag = (mp->mnt_flag & ~MNT_ASYNC) | MNT_SOFTDEP; if ((mp->mnt_kern_flag & MNTK_SOFTDEP) == 0) { mp->mnt_kern_flag = (mp->mnt_kern_flag & ~MNTK_ASYNC) | - MNTK_SOFTDEP; - mp->mnt_noasync++; + MNTK_SOFTDEP | MNTK_NOASYNC; } MNT_IUNLOCK(mp); ump = VFSTOUFS(mp);