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
This commit is contained in:
hannken 2014-03-18 10:21:47 +00:00
parent 231b455025
commit b349ee43ab
7 changed files with 65 additions and 63 deletions

View File

@ -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

View File

@ -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 \

View File

@ -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 returned, otherwise an
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 .

View File

@ -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 keepref, struct mount **nextp)
}
}
/*
* 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, struct vnode_iterator **vipp)
vp->v_usecount = 1;
mutex_exit(&mntvnode_lock);
*vipp = (struct vnode_iterator *)vp;
*vip = (struct vnode_iterator *)vp;
}
void

View File

@ -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__)

View File

@ -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) */

View File

@ -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 { \