Module Name: src Committed By: hannken Date: Tue Mar 18 10:21:48 UTC 2014
Modified Files: src/distrib/sets/lists/comp: mi src/share/man/man9: Makefile vfssubr.9 src/sys/kern: vfs_mount.c src/sys/sys: param.h vnode.h src/sys/ufs/lfs: lfs_segment.c Log Message: Operations vmark(), vunmark() and vismarker() have been replaced by vfs_vnode_iterator_*(), remove them. Document vfs_vnode_iterator_*(). Make VI_MARKER private to vfs_vnode.c, vfs_mount.c and unfortunately to ufs/lfs/lfs_segment.c. Welcome to 6.99.37 To generate a diff of this commit: cvs rdiff -u -r1.1881 -r1.1882 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.374 -r1.375 src/share/man/man9/Makefile cvs rdiff -u -r1.22 -r1.23 src/share/man/man9/vfssubr.9 cvs rdiff -u -r1.27 -r1.28 src/sys/kern/vfs_mount.c cvs rdiff -u -r1.445 -r1.446 src/sys/sys/param.h cvs rdiff -u -r1.244 -r1.245 src/sys/sys/vnode.h cvs rdiff -u -r1.234 -r1.235 src/sys/ufs/lfs/lfs_segment.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.1881 src/distrib/sets/lists/comp/mi:1.1882 --- src/distrib/sets/lists/comp/mi:1.1881 Fri Mar 14 01:05:57 2014 +++ src/distrib/sets/lists/comp/mi Tue Mar 18 10:21:47 2014 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1881 2014/03/14 01:05:57 pooka Exp $ +# $NetBSD: mi,v 1.1882 2014/03/18 10:21:47 hannken Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -11002,6 +11002,9 @@ ./usr/share/man/cat9/vfs_sysctl.0 comp-obsolete obsolete ./usr/share/man/cat9/vfs_unbusy.0 comp-sys-catman .cat ./usr/share/man/cat9/vfs_unmountall.0 comp-sys-catman .cat +./usr/share/man/cat9/vfs_vnode_iterator_destroy.0 comp-sys-catman .cat +./usr/share/man/cat9/vfs_vnode_iterator_init.0 comp-sys-catman .cat +./usr/share/man/cat9/vfs_vnode_iterator_next.0 comp-sys-catman .cat ./usr/share/man/cat9/vfs_write_resume.0 comp-obsolete obsolete ./usr/share/man/cat9/vfs_write_suspend.0 comp-obsolete obsolete ./usr/share/man/cat9/vfsops.0 comp-sys-catman .cat @@ -17650,6 +17653,9 @@ ./usr/share/man/html9/vfs_suspend.html comp-sys-htmlman html ./usr/share/man/html9/vfs_unbusy.html comp-sys-htmlman html ./usr/share/man/html9/vfs_unmountall.html comp-sys-htmlman html +./usr/share/man/html9/vfs_vnode_iterator_destroy.html comp-sys-htmlman html +./usr/share/man/html9/vfs_vnode_iterator_init.html comp-sys-htmlman html +./usr/share/man/html9/vfs_vnode_iterator_next.html comp-sys-htmlman html ./usr/share/man/html9/vfsops.html comp-sys-htmlman html ./usr/share/man/html9/vfssubr.html comp-sys-htmlman html ./usr/share/man/html9/vget.html comp-sys-htmlman html @@ -24539,6 +24545,9 @@ ./usr/share/man/man9/vfs_sysctl.9 comp-obsolete obsolete ./usr/share/man/man9/vfs_unbusy.9 comp-sys-man .man ./usr/share/man/man9/vfs_unmountall.9 comp-sys-man .man +./usr/share/man/man9/vfs_vnode_iterator_destroy.9 comp-sys-man .man +./usr/share/man/man9/vfs_vnode_iterator_init.9 comp-sys-man .man +./usr/share/man/man9/vfs_vnode_iterator_next.9 comp-sys-man .man ./usr/share/man/man9/vfs_write_resume.9 comp-obsolete obsolete ./usr/share/man/man9/vfs_write_suspend.9 comp-obsolete obsolete ./usr/share/man/man9/vfsops.9 comp-sys-man .man Index: src/share/man/man9/Makefile diff -u src/share/man/man9/Makefile:1.374 src/share/man/man9/Makefile:1.375 --- src/share/man/man9/Makefile:1.374 Thu Sep 19 17:29:06 2013 +++ src/share/man/man9/Makefile Tue Mar 18 10:21:47 2014 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.374 2013/09/19 17:29:06 rmind Exp $ +# $NetBSD: Makefile,v 1.375 2014/03/18 10:21:47 hannken Exp $ # Makefile for section 9 (kernel function and variable) manual pages. @@ -876,7 +876,10 @@ MLINKS+=vfssubr.9 vfs_getnewfsid.9 \ vfssubr.9 vfs_reinit.9 \ vfssubr.9 vfs_getopsbyname.9 \ vfssubr.9 vfs_resume.9 \ - vfssubr.9 vfs_suspend.9 + vfssubr.9 vfs_suspend.9 \ + vfssubr.9 vfs_vnode_iterator_init.9 \ + vfssubr.9 vfs_vnode_iterator_destroy.9 \ + vfssubr.9 vfs_vnode_iterator_next.9 MLINKS+=vmem.9 vmem_alloc.9 \ vmem.9 vmem_create.9 \ vmem.9 vmem_destroy.9 \ Index: src/share/man/man9/vfssubr.9 diff -u src/share/man/man9/vfssubr.9:1.22 src/share/man/man9/vfssubr.9:1.23 --- src/share/man/man9/vfssubr.9:1.22 Sat Feb 22 11:08:05 2014 +++ src/share/man/man9/vfssubr.9 Tue Mar 18 10:21:47 2014 @@ -1,4 +1,4 @@ -.\" $NetBSD: vfssubr.9,v 1.22 2014/02/22 11:08:05 wiz Exp $ +.\" $NetBSD: vfssubr.9,v 1.23 2014/03/18 10:21:47 hannken Exp $ .\" .\" Copyright (c) 2003, 2005, 2006 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd February 22, 2014 +.Dd March 18, 2014 .Dt VFSSUBR 9 .Os .Sh NAME @@ -51,7 +51,10 @@ .Nm vfs_reinit , .Nm vfs_getopsbyname , .Nm vfs_suspend , -.Nm vfs_resume +.Nm vfs_resume , +.Nm vfs_vnode_iterator_init , +.Nm vfs_vnode_iterator_destroy , +.Nm vfs_vnode_iterator_next .Nd high-level interface to kernel file system interface .Sh SYNOPSIS .In sys/param.h @@ -96,6 +99,12 @@ .Fn vfs_suspend "struct mount *mp" "int nowait" .Ft void .Fn vfs_resume "struct mount *mp" +.Ft void +.Fn vfs_vnode_iterator_init "struct mount *mp" " struct vnode_iterator **vip" +.Ft void +.Fn vfs_vnode_iterator_destroy "struct vnode_iterator *vi" +.Ft bool +.Fn vfs_vnode_iterator_next "struct vnode_iterator *vi" " struct vnode **vpp" .Sh DESCRIPTION The high-level functions described in this page are the interface to the kernel file system interface (VFS). @@ -226,9 +235,32 @@ If the operation is successful, zero is appropriate error code is returned. .It Fn vfs_resume "mp" Request a mounted file system to resume operations. +.It Fn vfs_vnode_iterator_init "mp" "vip" +Allocate and initialize an iterator +.Fa vip +over all vnodes attached to mount point +.Fa mp . +.It Fn vfs_vnode_iterator_destroy "vi" +Free all resources associated with an iterator +.Fa vi . +.It Fn vfs_vnode_iterator_next "vi" "vpp" +Return the next vnode from iterator +.Fa vi . +If the operation is successful the vnode has a reference added to it +and it is returned in +.Fa *vpp +and the function returns +.Dv true . +If the iterator is exhausted, +.Fa *vpp +is +.Dv NULL +and the function returns +.Dv false . .El .Sh CODE REFERENCES The vfs interface functions are implemented within the files +.Pa sys/kern/vfs_mount.c , .Pa sys/kern/vfs_subr.c and .Pa sys/kern/vfs_init.c . Index: src/sys/kern/vfs_mount.c diff -u src/sys/kern/vfs_mount.c:1.27 src/sys/kern/vfs_mount.c:1.28 --- src/sys/kern/vfs_mount.c:1.27 Wed Mar 5 09:37:29 2014 +++ src/sys/kern/vfs_mount.c Tue Mar 18 10:21:47 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_mount.c,v 1.27 2014/03/05 09:37:29 hannken Exp $ */ +/* $NetBSD: vfs_mount.c,v 1.28 2014/03/18 10:21:47 hannken Exp $ */ /*- * Copyright (c) 1997-2011 The NetBSD Foundation, Inc. @@ -67,7 +67,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.27 2014/03/05 09:37:29 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.28 2014/03/18 10:21:47 hannken Exp $"); + +#define _VFS_VNODE_PRIVATE #include <sys/param.h> #include <sys/kernel.h> @@ -337,50 +339,12 @@ vfs_unbusy(struct mount *mp, bool keepre } } -/* - * Insert a marker vnode into a mount's vnode list, after the - * specified vnode. mntvnode_lock must be held. - */ -void -vmark(vnode_t *mvp, vnode_t *vp) -{ - struct mount *mp = mvp->v_mount; - - KASSERT(mutex_owned(&mntvnode_lock)); - KASSERT((mvp->v_iflag & VI_MARKER) != 0); - KASSERT(vp->v_mount == mp); - - TAILQ_INSERT_AFTER(&mp->mnt_vnodelist, vp, mvp, v_mntvnodes); -} - -/* - * Remove a marker vnode from a mount's vnode list, and return - * a pointer to the next vnode in the list. mntvnode_lock must - * be held. - */ -vnode_t * -vunmark(vnode_t *mvp) -{ - struct mount *mp = mvp->v_mount; - vnode_t *vp; - - KASSERT(mutex_owned(&mntvnode_lock)); - KASSERT((mvp->v_iflag & VI_MARKER) != 0); - - vp = TAILQ_NEXT(mvp, v_mntvnodes); - TAILQ_REMOVE(&mp->mnt_vnodelist, mvp, v_mntvnodes); - - KASSERT(vp == NULL || vp->v_mount == mp); - - return vp; -} - struct vnode_iterator { struct vnode vi_vnode; }; void -vfs_vnode_iterator_init(struct mount *mp, struct vnode_iterator **vipp) +vfs_vnode_iterator_init(struct mount *mp, struct vnode_iterator **vip) { struct vnode *vp; @@ -391,7 +355,7 @@ vfs_vnode_iterator_init(struct mount *mp vp->v_usecount = 1; mutex_exit(&mntvnode_lock); - *vipp = (struct vnode_iterator *)vp; + *vip = (struct vnode_iterator *)vp; } void Index: src/sys/sys/param.h diff -u src/sys/sys/param.h:1.445 src/sys/sys/param.h:1.446 --- src/sys/sys/param.h:1.445 Thu Mar 6 19:02:58 2014 +++ src/sys/sys/param.h Tue Mar 18 10:21:47 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.445 2014/03/06 19:02:58 skrll Exp $ */ +/* $NetBSD: param.h,v 1.446 2014/03/18 10:21:47 hannken Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -63,7 +63,7 @@ * 2.99.9 (299000900) */ -#define __NetBSD_Version__ 699003600 /* NetBSD 6.99.36 */ +#define __NetBSD_Version__ 699003700 /* NetBSD 6.99.37 */ #define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \ (m) * 1000000) + (p) * 100) <= __NetBSD_Version__) Index: src/sys/sys/vnode.h diff -u src/sys/sys/vnode.h:1.244 src/sys/sys/vnode.h:1.245 --- src/sys/sys/vnode.h:1.244 Wed Mar 5 09:37:29 2014 +++ src/sys/sys/vnode.h Tue Mar 18 10:21:47 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vnode.h,v 1.244 2014/03/05 09:37:29 hannken Exp $ */ +/* $NetBSD: vnode.h,v 1.245 2014/03/18 10:21:47 hannken Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -201,7 +201,9 @@ typedef struct vnode vnode_t; #define VI_WRMAPDIRTY 0x00000800 /* might have dirty pages */ #define VI_XLOCK 0x00001000 /* vnode is locked to change type */ #define VI_ONWORKLST 0x00004000 /* On syncer work-list */ +#ifdef _VFS_VNODE_PRIVATE #define VI_MARKER 0x00008000 /* Dummy marker vnode */ +#endif /* _VFS_VNODE_PRIVATE */ #define VI_LAYER 0x00020000 /* vnode is on a layer filesystem */ #define VI_LOCKSHARE 0x00040000 /* v_interlock is shared */ #define VI_CLEAN 0x00080000 /* has been reclaimed */ @@ -361,13 +363,6 @@ vhold(struct vnode *vp) mutex_exit(vp->v_interlock); } -static __inline bool -vismarker(struct vnode *vp) -{ - - return (vp->v_iflag & VI_MARKER) != 0; -} - #define NULLVP ((struct vnode *)NULL) static __inline void @@ -556,9 +551,6 @@ void vrevoke(struct vnode *); struct vnode * vnalloc(struct mount *); void vnfree(struct vnode *); -void vmark(struct vnode *, struct vnode *); -struct vnode * - vunmark(struct vnode *); void vremfree(struct vnode *); /* see vnsubr(9) */ Index: src/sys/ufs/lfs/lfs_segment.c diff -u src/sys/ufs/lfs/lfs_segment.c:1.234 src/sys/ufs/lfs/lfs_segment.c:1.235 --- src/sys/ufs/lfs/lfs_segment.c:1.234 Mon Mar 17 09:33:20 2014 +++ src/sys/ufs/lfs/lfs_segment.c Tue Mar 18 10:21:47 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_segment.c,v 1.234 2014/03/17 09:33:20 hannken Exp $ */ +/* $NetBSD: lfs_segment.c,v 1.235 2014/03/18 10:21:47 hannken Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. @@ -60,7 +60,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.234 2014/03/17 09:33:20 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.235 2014/03/18 10:21:47 hannken Exp $"); + +#define _VFS_VNODE_PRIVATE /* XXX: check for VI_MARKER, this has to go */ #ifdef DEBUG # define vndebug(vp, str) do { \