svn commit: r273336 - in head/sys: fs/nullfs fs/tmpfs fs/unionfs kern sys ufs/ffs
Mateusz Guzik
mjg at FreeBSD.org
Mon Oct 20 18:00:53 UTC 2014
Author: mjg
Date: Mon Oct 20 18:00:50 2014
New Revision: 273336
URL: https://svnweb.freebsd.org/changeset/base/273336
Log:
Provide vfs suspension support only for filesystems which need it, take
two.
nullfs and unionfs need to request suspension if underlying filesystem(s)
use it. Utilize mnt_kern_flag for this purpose.
This is a fixup for 273271.
No strong objections from: kib
Pointy hat to: mjg
MFC after: 2 weeks
Modified:
head/sys/fs/nullfs/null_vfsops.c
head/sys/fs/tmpfs/tmpfs_vfsops.c
head/sys/fs/unionfs/union_vfsops.c
head/sys/kern/vfs_vnops.c
head/sys/sys/mount.h
head/sys/ufs/ffs/ffs_vfsops.c
Modified: head/sys/fs/nullfs/null_vfsops.c
==============================================================================
--- head/sys/fs/nullfs/null_vfsops.c Mon Oct 20 17:53:49 2014 (r273335)
+++ head/sys/fs/nullfs/null_vfsops.c Mon Oct 20 18:00:50 2014 (r273336)
@@ -198,6 +198,8 @@ nullfs_mount(struct mount *mp)
MNTK_EXTENDED_SHARED);
}
mp->mnt_kern_flag |= MNTK_LOOKUP_EXCL_DOTDOT;
+ mp->mnt_kern_flag |= lowerrootvp->v_mount->mnt_kern_flag &
+ MNTK_SUSPENDABLE;
MNT_IUNLOCK(mp);
mp->mnt_data = xmp;
vfs_getnewfsid(mp);
Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c
==============================================================================
--- head/sys/fs/tmpfs/tmpfs_vfsops.c Mon Oct 20 17:53:49 2014 (r273335)
+++ head/sys/fs/tmpfs/tmpfs_vfsops.c Mon Oct 20 18:00:50 2014 (r273336)
@@ -255,6 +255,7 @@ tmpfs_mount(struct mount *mp)
MNT_ILOCK(mp);
mp->mnt_flag |= MNT_LOCAL;
+ mp->mnt_kern_flag |= MNTK_SUSPENDABLE;
MNT_IUNLOCK(mp);
mp->mnt_data = tmp;
@@ -427,14 +428,6 @@ tmpfs_sync(struct mount *mp, int waitfor
}
/*
- * A stub created so that vfs does vn_start_write for this filesystem
- */
-static void
-tmpfs_susp_clean(struct mount *mp)
-{
-}
-
-/*
* tmpfs vfs operations.
*/
@@ -445,6 +438,5 @@ struct vfsops tmpfs_vfsops = {
.vfs_statfs = tmpfs_statfs,
.vfs_fhtovp = tmpfs_fhtovp,
.vfs_sync = tmpfs_sync,
- .vfs_susp_clean = tmpfs_susp_clean,
};
VFS_SET(tmpfs_vfsops, tmpfs, VFCF_JAIL);
Modified: head/sys/fs/unionfs/union_vfsops.c
==============================================================================
--- head/sys/fs/unionfs/union_vfsops.c Mon Oct 20 17:53:49 2014 (r273335)
+++ head/sys/fs/unionfs/union_vfsops.c Mon Oct 20 18:00:50 2014 (r273336)
@@ -297,6 +297,13 @@ unionfs_domount(struct mount *mp)
if ((ump->um_lowervp->v_mount->mnt_flag & MNT_LOCAL) &&
(ump->um_uppervp->v_mount->mnt_flag & MNT_LOCAL))
mp->mnt_flag |= MNT_LOCAL;
+
+ /*
+ * Check mnt_kern_flag
+ */
+ if ((ump->um_lowervp->v_mount->mnt_flag & MNTK_SUSPENDABLE) ||
+ (ump->um_uppervp->v_mount->mnt_flag & MNTK_SUSPENDABLE))
+ mp->mnt_kern_flag |= MNTK_SUSPENDABLE;
MNT_IUNLOCK(mp);
/*
Modified: head/sys/kern/vfs_vnops.c
==============================================================================
--- head/sys/kern/vfs_vnops.c Mon Oct 20 17:53:49 2014 (r273335)
+++ head/sys/kern/vfs_vnops.c Mon Oct 20 18:00:50 2014 (r273336)
@@ -1576,7 +1576,7 @@ static bool
vn_suspendable_mp(struct mount *mp)
{
- return (mp->mnt_op->vfs_susp_clean != NULL);
+ return ((mp->mnt_kern_flag & MNTK_SUSPENDABLE) != 0);
}
static bool
Modified: head/sys/sys/mount.h
==============================================================================
--- head/sys/sys/mount.h Mon Oct 20 17:53:49 2014 (r273335)
+++ head/sys/sys/mount.h Mon Oct 20 18:00:50 2014 (r273336)
@@ -361,7 +361,7 @@ void __mnt_vnode_markerfree_act
#define MNTK_SUSPEND 0x08000000 /* request write suspension */
#define MNTK_SUSPEND2 0x04000000 /* block secondary writes */
#define MNTK_SUSPENDED 0x10000000 /* write operations are suspended */
-#define MNTK_UNUSED25 0x20000000 /* --available-- */
+#define MNTK_SUSPENDABLE 0x20000000 /* writes can be suspended */
#define MNTK_LOOKUP_SHARED 0x40000000 /* FS supports shared lock lookups */
#define MNTK_NOKNOTE 0x80000000 /* Don't send KNOTEs from VOP hooks */
@@ -754,10 +754,11 @@ vfs_statfs_t __vfs_statfs;
_rc; })
#define VFS_SUSP_CLEAN(MP) do { \
- MPASS(*(MP)->mnt_op->vfs_susp_clean != NULL); \
- VFS_PROLOGUE(MP); \
- (*(MP)->mnt_op->vfs_susp_clean)(MP); \
- VFS_EPILOGUE(MP); \
+ if (*(MP)->mnt_op->vfs_susp_clean != NULL) { \
+ VFS_PROLOGUE(MP); \
+ (*(MP)->mnt_op->vfs_susp_clean)(MP); \
+ VFS_EPILOGUE(MP); \
+ } \
} while (0)
#define VFS_RECLAIM_LOWERVP(MP, VP) do { \
Modified: head/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vfsops.c Mon Oct 20 17:53:49 2014 (r273335)
+++ head/sys/ufs/ffs/ffs_vfsops.c Mon Oct 20 18:00:50 2014 (r273336)
@@ -1055,7 +1055,7 @@ ffs_mountfs(devvp, mp, td)
*/
MNT_ILOCK(mp);
mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED |
- MNTK_NO_IOPF | MNTK_UNMAPPED_BUFS;
+ MNTK_NO_IOPF | MNTK_UNMAPPED_BUFS | MNTK_SUSPENDABLE;
MNT_IUNLOCK(mp);
#ifdef UFS_EXTATTR
#ifdef UFS_EXTATTR_AUTOSTART
More information about the svn-src-all
mailing list