Date: Thu, 3 Jan 2013 19:02:52 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r245001 - in head/sys: kern sys Message-ID: <201301031902.r03J2qfP065805@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Thu Jan 3 19:02:52 2013 New Revision: 245001 URL: http://svnweb.freebsd.org/changeset/base/245001 Log: Remove the deprecated MNT_VNODE_FOREACH interface. Use the MNT_VNODE_FOREACH_ALL instead. Modified: head/sys/kern/vfs_mount.c head/sys/sys/mount.h Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Thu Jan 3 19:01:56 2013 (r245000) +++ head/sys/kern/vfs_mount.c Thu Jan 3 19:02:52 2013 (r245001) @@ -1705,103 +1705,6 @@ vfs_copyopt(opts, name, dest, len) return (ENOENT); } -/* - * These are helper functions for filesystems to traverse all - * their vnodes. See MNT_VNODE_FOREACH() in sys/mount.h. - * - * This interface has been deprecated in favor of MNT_VNODE_FOREACH_ALL. - */ - -MALLOC_DECLARE(M_VNODE_MARKER); - -struct vnode * -__mnt_vnode_next(struct vnode **mvp, struct mount *mp) -{ - struct vnode *vp; - - mtx_assert(MNT_MTX(mp), MA_OWNED); - - KASSERT((*mvp)->v_mount == mp, ("marker vnode mount list mismatch")); - if (should_yield()) { - MNT_IUNLOCK(mp); - kern_yield(PRI_USER); - MNT_ILOCK(mp); - } - vp = TAILQ_NEXT(*mvp, v_nmntvnodes); - while (vp != NULL && vp->v_type == VMARKER) - vp = TAILQ_NEXT(vp, v_nmntvnodes); - - /* Check if we are done */ - if (vp == NULL) { - __mnt_vnode_markerfree(mvp, mp); - return (NULL); - } - TAILQ_REMOVE(&mp->mnt_nvnodelist, *mvp, v_nmntvnodes); - TAILQ_INSERT_AFTER(&mp->mnt_nvnodelist, vp, *mvp, v_nmntvnodes); - return (vp); -} - -struct vnode * -__mnt_vnode_first(struct vnode **mvp, struct mount *mp) -{ - struct vnode *vp; - - mtx_assert(MNT_MTX(mp), MA_OWNED); - - vp = TAILQ_FIRST(&mp->mnt_nvnodelist); - while (vp != NULL && vp->v_type == VMARKER) - vp = TAILQ_NEXT(vp, v_nmntvnodes); - - /* Check if we are done */ - if (vp == NULL) { - *mvp = NULL; - return (NULL); - } - MNT_REF(mp); - MNT_IUNLOCK(mp); - *mvp = (struct vnode *) malloc(sizeof(struct vnode), - M_VNODE_MARKER, - M_WAITOK | M_ZERO); - MNT_ILOCK(mp); - (*mvp)->v_type = VMARKER; - - vp = TAILQ_FIRST(&mp->mnt_nvnodelist); - while (vp != NULL && vp->v_type == VMARKER) - vp = TAILQ_NEXT(vp, v_nmntvnodes); - - /* Check if we are done */ - if (vp == NULL) { - MNT_IUNLOCK(mp); - free(*mvp, M_VNODE_MARKER); - MNT_ILOCK(mp); - *mvp = NULL; - MNT_REL(mp); - return (NULL); - } - (*mvp)->v_mount = mp; - TAILQ_INSERT_AFTER(&mp->mnt_nvnodelist, vp, *mvp, v_nmntvnodes); - return (vp); -} - - -void -__mnt_vnode_markerfree(struct vnode **mvp, struct mount *mp) -{ - - if (*mvp == NULL) - return; - - mtx_assert(MNT_MTX(mp), MA_OWNED); - - KASSERT((*mvp)->v_mount == mp, ("marker vnode mount list mismatch")); - TAILQ_REMOVE(&mp->mnt_nvnodelist, *mvp, v_nmntvnodes); - MNT_IUNLOCK(mp); - free(*mvp, M_VNODE_MARKER); - MNT_ILOCK(mp); - *mvp = NULL; - MNT_REL(mp); -} - int __vfs_statfs(struct mount *mp, struct statfs *sbp) { Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Thu Jan 3 19:01:56 2013 (r245000) +++ head/sys/sys/mount.h Thu Jan 3 19:02:52 2013 (r245001) @@ -225,29 +225,6 @@ void __mnt_vnode_markerfree_act #define MNT_VNODE_FOREACH_ACTIVE_ABORT(mp, mvp) \ __mnt_vnode_markerfree_active(&(mvp), (mp)) -/* - * Definitions for MNT_VNODE_FOREACH. - * - * This interface has been deprecated in favor of MNT_VNODE_FOREACH_ALL. - */ -struct vnode *__mnt_vnode_next(struct vnode **mvp, struct mount *mp); -struct vnode *__mnt_vnode_first(struct vnode **mvp, struct mount *mp); -void __mnt_vnode_markerfree(struct vnode **mvp, struct mount *mp); - -#define MNT_VNODE_FOREACH(vp, mp, mvp) \ - for (vp = __mnt_vnode_first(&(mvp), (mp)); \ - (vp) != NULL; vp = __mnt_vnode_next(&(mvp), (mp))) - -#define MNT_VNODE_FOREACH_ABORT_ILOCKED(mp, mvp) \ - __mnt_vnode_markerfree(&(mvp), (mp)) - -#define MNT_VNODE_FOREACH_ABORT(mp, mvp) \ - do { \ - MNT_ILOCK(mp); \ - MNT_VNODE_FOREACH_ABORT_ILOCKED(mp, mvp); \ - MNT_IUNLOCK(mp); \ - } while (0) - #define MNT_ILOCK(mp) mtx_lock(&(mp)->mnt_mtx) #define MNT_ITRYLOCK(mp) mtx_trylock(&(mp)->mnt_mtx) #define MNT_IUNLOCK(mp) mtx_unlock(&(mp)->mnt_mtx)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301031902.r03J2qfP065805>