Date: Sun, 5 Jul 2015 22:37:34 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285182 - in head/sys: fs/nullfs fs/tmpfs fs/unionfs kern sys ufs/ffs Message-ID: <201507052237.t65MbY0o006768@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Sun Jul 5 22:37:33 2015 New Revision: 285182 URL: https://svnweb.freebsd.org/changeset/base/285182 Log: Check suspendability on the mountpoint returned by VOP_GETWRITEMOUNT. This obviates the need for a MNTK_SUSPENDABLE flag, since passthrough filesystems like nullfs and unionfs no longer need to inherit this information from their lower layer(s). This change also restores the pre-r273336 behaviour of using the presence of a susp_clean VFS method to request suspension support. Reviewed by: kib, mjg Differential Revision: https://reviews.freebsd.org/D2937 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 Sun Jul 5 22:34:42 2015 (r285181) +++ head/sys/fs/nullfs/null_vfsops.c Sun Jul 5 22:37:33 2015 (r285182) @@ -199,7 +199,7 @@ nullfs_mount(struct mount *mp) } mp->mnt_kern_flag |= MNTK_LOOKUP_EXCL_DOTDOT; mp->mnt_kern_flag |= lowerrootvp->v_mount->mnt_kern_flag & - (MNTK_SUSPENDABLE | MNTK_USES_BCACHE); + MNTK_USES_BCACHE; 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 Sun Jul 5 22:34:42 2015 (r285181) +++ head/sys/fs/tmpfs/tmpfs_vfsops.c Sun Jul 5 22:37:33 2015 (r285182) @@ -75,6 +75,7 @@ static int tmpfs_root(struct mount *, in static int tmpfs_fhtovp(struct mount *, struct fid *, int, struct vnode **); static int tmpfs_statfs(struct mount *, struct statfs *); +static void tmpfs_susp_clean(struct mount *); static const char *tmpfs_opts[] = { "from", "size", "maxfilesize", "inodes", "uid", "gid", "mode", "export", @@ -256,7 +257,7 @@ tmpfs_mount(struct mount *mp) MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; - mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_SUSPENDABLE; + mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED; MNT_IUNLOCK(mp); mp->mnt_data = tmp; @@ -463,6 +464,14 @@ tmpfs_sync(struct mount *mp, int waitfor } /* + * The presence of a susp_clean method tells the VFS to track writes. + */ +static void +tmpfs_susp_clean(struct mount *mp __unused) +{ +} + +/* * tmpfs vfs operations. */ @@ -473,5 +482,6 @@ 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 Sun Jul 5 22:34:42 2015 (r285181) +++ head/sys/fs/unionfs/union_vfsops.c Sun Jul 5 22:37:33 2015 (r285182) @@ -294,9 +294,6 @@ 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; - - if ((ump->um_uppervp->v_mount->mnt_kern_flag & MNTK_SUSPENDABLE) != 0) - mp->mnt_kern_flag |= MNTK_SUSPENDABLE; MNT_IUNLOCK(mp); /* Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Sun Jul 5 22:34:42 2015 (r285181) +++ head/sys/kern/vfs_vnops.c Sun Jul 5 22:37:33 2015 (r285182) @@ -1589,22 +1589,10 @@ vn_closefile(fp, td) } static bool -vn_suspendable_mp(struct mount *mp) +vn_suspendable(struct mount *mp) { - return ((mp->mnt_kern_flag & MNTK_SUSPENDABLE) != 0); -} - -static bool -vn_suspendable(struct vnode *vp, struct mount **mpp) -{ - - if (vp != NULL) - *mpp = vp->v_mount; - if (*mpp == NULL) - return (false); - - return (vn_suspendable_mp(*mpp)); + return (mp->mnt_op->vfs_susp_clean != NULL); } /* @@ -1657,11 +1645,6 @@ vn_start_write(struct vnode *vp, struct KASSERT((flags & V_MNTREF) == 0 || (*mpp != NULL && vp == NULL), ("V_MNTREF requires mp")); - if (!vn_suspendable(vp, mpp)) { - if ((flags & V_MNTREF) != 0) - vfs_rel(*mpp); - return (0); - } error = 0; /* @@ -1679,6 +1662,12 @@ vn_start_write(struct vnode *vp, struct if ((mp = *mpp) == NULL) return (0); + if (!vn_suspendable(mp)) { + if (vp != NULL || (flags & V_MNTREF) != 0) + vfs_rel(mp); + return (0); + } + /* * VOP_GETWRITEMOUNT() returns with the mp refcount held through * a vfs_ref(). @@ -1708,11 +1697,6 @@ vn_start_secondary_write(struct vnode *v KASSERT((flags & V_MNTREF) == 0 || (*mpp != NULL && vp == NULL), ("V_MNTREF requires mp")); - if (!vn_suspendable(vp, mpp)) { - if ((flags & V_MNTREF) != 0) - vfs_rel(*mpp); - return (0); - } retry: if (vp != NULL) { @@ -1730,6 +1714,12 @@ vn_start_secondary_write(struct vnode *v if ((mp = *mpp) == NULL) return (0); + if (!vn_suspendable(mp)) { + if (vp != NULL || (flags & V_MNTREF) != 0) + vfs_rel(mp); + return (0); + } + /* * VOP_GETWRITEMOUNT() returns with the mp refcount held through * a vfs_ref(). @@ -1772,7 +1762,7 @@ void vn_finished_write(mp) struct mount *mp; { - if (mp == NULL || !vn_suspendable_mp(mp)) + if (mp == NULL || !vn_suspendable(mp)) return; MNT_ILOCK(mp); MNT_REL(mp); @@ -1795,7 +1785,7 @@ void vn_finished_secondary_write(mp) struct mount *mp; { - if (mp == NULL || !vn_suspendable_mp(mp)) + if (mp == NULL || !vn_suspendable(mp)) return; MNT_ILOCK(mp); MNT_REL(mp); @@ -1818,7 +1808,7 @@ vfs_write_suspend(struct mount *mp, int { int error; - MPASS(vn_suspendable_mp(mp)); + MPASS(vn_suspendable(mp)); MNT_ILOCK(mp); if (mp->mnt_susp_owner == curthread) { @@ -1861,7 +1851,7 @@ void vfs_write_resume(struct mount *mp, int flags) { - MPASS(vn_suspendable_mp(mp)); + MPASS(vn_suspendable(mp)); MNT_ILOCK(mp); if ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0) { @@ -1896,7 +1886,7 @@ vfs_write_suspend_umnt(struct mount *mp) { int error; - MPASS(vn_suspendable_mp(mp)); + MPASS(vn_suspendable(mp)); KASSERT((curthread->td_pflags & TDP_IGNSUSP) == 0, ("vfs_write_suspend_umnt: recursed")); Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Sun Jul 5 22:34:42 2015 (r285181) +++ head/sys/sys/mount.h Sun Jul 5 22:37:33 2015 (r285182) @@ -362,7 +362,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_SUSPENDABLE 0x20000000 /* writes can be suspended */ +#define MNTK_UNUSED1 0x20000000 #define MNTK_LOOKUP_SHARED 0x40000000 /* FS supports shared lock lookups */ #define MNTK_NOKNOTE 0x80000000 /* Don't send KNOTEs from VOP hooks */ Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Sun Jul 5 22:34:42 2015 (r285181) +++ head/sys/ufs/ffs/ffs_vfsops.c Sun Jul 5 22:37:33 2015 (r285182) @@ -1055,8 +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_SUSPENDABLE | - MNTK_USES_BCACHE; + MNTK_NO_IOPF | MNTK_UNMAPPED_BUFS | MNTK_USES_BCACHE; MNT_IUNLOCK(mp); #ifdef UFS_EXTATTR #ifdef UFS_EXTATTR_AUTOSTART
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507052237.t65MbY0o006768>