Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Change VOP_BWRITE() to take a vnode as its first argument li...
details: https://anonhg.NetBSD.org/src/rev/c9688af71ec2
branches: trunk
changeset: 767205:c9688af71ec2
user: hannken <hannken%NetBSD.org@localhost>
date: Mon Jul 11 08:27:37 2011 +0000
description:
Change VOP_BWRITE() to take a vnode as its first argument like all other
VOPs do. Layered file systems no longer have to modify bp->b_vp and run
into trouble when an async VOP_BWRITE() uses the wrong vnode.
- change all occurences of VOP_BWRITE(bp) to VOP_BWRITE(bp->b_vp, bp).
- remove layer_bwrite().
- welcome to 5.99.55
Adresses PR kern/38762 panic: vwakeup: neg numoutput
No objections from tech-kern@.
diffstat:
share/man/man9/vnodeops.9 | 11 +++++++----
sys/kern/vfs_bio.c | 7 ++++---
sys/kern/vfs_subr.c | 6 +++---
sys/kern/vnode_if.c | 23 +++++++++++------------
sys/miscfs/genfs/layer_extern.h | 3 +--
sys/miscfs/genfs/layer_vnops.c | 27 ++-------------------------
sys/miscfs/nullfs/null_vnops.c | 5 ++---
sys/miscfs/overlay/overlay_vnops.c | 7 +++----
sys/miscfs/umapfs/umap_vnops.c | 5 ++---
sys/rump/include/rump/rumpvnode_if.h | 16 ++++++----------
sys/rump/librump/rumpvfs/rumpvnode_if.c | 17 +++++++----------
sys/sys/param.h | 4 ++--
sys/sys/vnode_if.h | 17 +++++++----------
sys/ufs/ext2fs/ext2fs_lookup.c | 12 ++++++------
sys/ufs/lfs/lfs.h | 4 ++--
sys/ufs/lfs/lfs_balloc.c | 10 +++++-----
sys/ufs/lfs/lfs_bio.c | 5 +++--
sys/ufs/lfs/lfs_inode.c | 10 +++++-----
sys/ufs/lfs/lfs_segment.c | 6 +++---
sys/ufs/lfs/lfs_vfsops.c | 14 +++++++-------
sys/ufs/lfs/lfs_vnops.c | 6 +++---
sys/ufs/ufs/ufs_lookup.c | 12 ++++++------
sys/ufs/ufs/ufs_readwrite.c | 6 +++---
sys/ufs/ufs/ufs_vnops.c | 6 +++---
24 files changed, 103 insertions(+), 136 deletions(-)
diffs (truncated from 909 to 300 lines):
diff -r 3f2b412577e9 -r c9688af71ec2 share/man/man9/vnodeops.9
--- a/share/man/man9/vnodeops.9 Mon Jul 11 08:25:09 2011 +0000
+++ b/share/man/man9/vnodeops.9 Mon Jul 11 08:27:37 2011 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: vnodeops.9,v 1.81 2011/06/14 00:22:45 rmind Exp $
+.\" $NetBSD: vnodeops.9,v 1.82 2011/07/11 08:27:37 hannken Exp $
.\"
.\" Copyright (c) 2001, 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 June 14, 2011
+.Dd July 11, 2011
.Dt VNODEOPS 9
.Os
.Sh NAME
@@ -192,7 +192,7 @@
.Ft int
.Fn VOP_STRATEGY "struct vnode *vp" "struct buf *bp"
.Ft int
-.Fn VOP_BWRITE "struct buf *bp"
+.Fn VOP_BWRITE "struct vnode *vp" "struct buf *bp"
.Ft int
.Fn VOP_GETEXTATTR "struct vnode *vp" "int attrnamespace" "const char *name" \
"struct uio *uio" "size_t *size" "kauth_cred_t cred"
@@ -1305,9 +1305,12 @@
.Em bp-\*[Gt]b_flags .
If the operation is successful zero is returned, otherwise an
appropriate error code is returned.
-.It Fn VOP_BWRITE "bp"
+.It Fn VOP_BWRITE "vp" "bp"
Write a file system buffer.
The argument
+.Fa vp
+is the vnode to write to.
+The argument
.Fa bp
specifies the buffer to be written.
If the operation is successful zero is returned, otherwise an
diff -r 3f2b412577e9 -r c9688af71ec2 sys/kern/vfs_bio.c
--- a/sys/kern/vfs_bio.c Mon Jul 11 08:25:09 2011 +0000
+++ b/sys/kern/vfs_bio.c Mon Jul 11 08:27:37 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_bio.c,v 1.230 2011/06/12 03:35:56 rmind Exp $ */
+/* $NetBSD: vfs_bio.c,v 1.231 2011/07/11 08:27:37 hannken Exp $ */
/*-
* Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.230 2011/06/12 03:35:56 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.231 2011/07/11 08:27:37 hannken Exp $");
#include "opt_bufcache.h"
@@ -951,9 +951,10 @@
{
KASSERT(ISSET(bp->b_cflags, BC_BUSY));
+ KASSERT(bp->b_vp != NULL);
SET(bp->b_flags, B_ASYNC);
- VOP_BWRITE(bp);
+ VOP_BWRITE(bp->b_vp, bp);
}
/*
diff -r 3f2b412577e9 -r c9688af71ec2 sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c Mon Jul 11 08:25:09 2011 +0000
+++ b/sys/kern/vfs_subr.c Mon Jul 11 08:27:37 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_subr.c,v 1.423 2011/06/12 03:35:56 rmind Exp $ */
+/* $NetBSD: vfs_subr.c,v 1.424 2011/07/11 08:27:37 hannken Exp $ */
/*-
* Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.423 2011/06/12 03:35:56 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.424 2011/07/11 08:27:37 hannken Exp $");
#include "opt_ddb.h"
#include "opt_compat_netbsd.h"
@@ -197,7 +197,7 @@
#endif
bp->b_cflags |= BC_BUSY | BC_VFLUSH;
mutex_exit(&bufcache_lock);
- VOP_BWRITE(bp);
+ VOP_BWRITE(bp->b_vp, bp);
mutex_enter(&bufcache_lock);
goto restart;
}
diff -r 3f2b412577e9 -r c9688af71ec2 sys/kern/vnode_if.c
--- a/sys/kern/vnode_if.c Mon Jul 11 08:25:09 2011 +0000
+++ b/sys/kern/vnode_if.c Mon Jul 11 08:27:37 2011 +0000
@@ -1,13 +1,13 @@
-/* $NetBSD: vnode_if.c,v 1.87 2011/07/04 08:07:31 manu Exp $ */
+/* $NetBSD: vnode_if.c,v 1.88 2011/07/11 08:27:38 hannken Exp $ */
/*
* Warning: DO NOT EDIT! This file is automatically generated!
* (Modifications made here may easily be lost!)
*
* Created from the file:
- * NetBSD: vnode_if.src,v 1.60 2011/01/02 06:58:45 dholland Exp
+ * NetBSD: vnode_if.src,v 1.62 2011/07/11 08:23:00 hannken Exp
* by the script:
- * NetBSD: vnode_if.sh,v 1.56 2010/04/14 13:58:51 pooka Exp
+ * NetBSD: vnode_if.sh,v 1.58 2011/07/11 08:23:00 hannken Exp
*/
/*
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.87 2011/07/04 08:07:31 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.88 2011/07/11 08:27:38 hannken Exp $");
#include <sys/param.h>
#include <sys/mount.h>
@@ -59,9 +59,8 @@
};
-/* Special cases: */
-
const int vop_bwrite_vp_offsets[] = {
+ VOPARG_OFFSETOF(struct vop_bwrite_args,a_vp),
VDESC_NO_OFFSET
};
const struct vnodeop_desc vop_bwrite_desc = {
@@ -74,22 +73,22 @@
VDESC_NO_OFFSET,
};
int
-VOP_BWRITE(struct buf *bp)
+VOP_BWRITE(struct vnode *vp,
+ struct buf *bp)
{
int error;
bool mpsafe;
struct vop_bwrite_args a;
a.a_desc = VDESC(vop_bwrite);
+ a.a_vp = vp;
a.a_bp = bp;
- mpsafe = (bp->b_vp->v_vflag & VV_MPSAFE);
+ mpsafe = (vp->v_vflag & VV_MPSAFE);
if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
- error = (VCALL(bp->b_vp, VOFFSET(vop_bwrite), &a));
+ error = (VCALL(vp, VOFFSET(vop_bwrite), &a));
if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
return error;
}
-/* End of special cases */
-
const int vop_lookup_vp_offsets[] = {
VOPARG_OFFSETOF(struct vop_lookup_args,a_dvp),
VDESC_NO_OFFSET
@@ -1641,8 +1640,8 @@
const struct vnodeop_desc * const vfs_op_descs[] = {
&vop_default_desc, /* MUST BE FIRST */
- &vop_bwrite_desc, /* XXX: SPECIAL CASE */
+ &vop_bwrite_desc,
&vop_lookup_desc,
&vop_create_desc,
&vop_mknod_desc,
diff -r 3f2b412577e9 -r c9688af71ec2 sys/miscfs/genfs/layer_extern.h
--- a/sys/miscfs/genfs/layer_extern.h Mon Jul 11 08:25:09 2011 +0000
+++ b/sys/miscfs/genfs/layer_extern.h Mon Jul 11 08:27:37 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: layer_extern.h,v 1.28 2011/03/06 17:08:36 bouyer Exp $ */
+/* $NetBSD: layer_extern.h,v 1.29 2011/07/11 08:27:38 hannken Exp $ */
/*
* Copyright (c) 1999 National Aeronautics & Space Administration
@@ -104,7 +104,6 @@
int layer_inactive(void *);
int layer_reclaim(void *);
int layer_print(void *);
-int layer_bwrite(void *);
int layer_bmap(void *);
int layer_fsync(void *);
int layer_lookup(void *);
diff -r 3f2b412577e9 -r c9688af71ec2 sys/miscfs/genfs/layer_vnops.c
--- a/sys/miscfs/genfs/layer_vnops.c Mon Jul 11 08:25:09 2011 +0000
+++ b/sys/miscfs/genfs/layer_vnops.c Mon Jul 11 08:27:37 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: layer_vnops.c,v 1.48 2011/06/12 03:35:58 rmind Exp $ */
+/* $NetBSD: layer_vnops.c,v 1.49 2011/07/11 08:27:38 hannken Exp $ */
/*
* Copyright (c) 1999 National Aeronautics & Space Administration
@@ -170,7 +170,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.48 2011/06/12 03:35:58 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.49 2011/07/11 08:27:38 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -733,29 +733,6 @@
return 0;
}
-/*
- * XXX - vop_bwrite must be hand coded because it has no
- * vnode in its arguments.
- * This goes away with a merged VM/buffer cache.
- */
-int
-layer_bwrite(void *v)
-{
- struct vop_bwrite_args /* {
- struct buf *a_bp;
- } */ *ap = v;
- struct buf *bp = ap->a_bp;
- struct vnode *savedvp;
- int error;
-
- savedvp = bp->b_vp;
- bp->b_vp = LAYERVPTOLOWERVP(bp->b_vp);
- error = VOP_BWRITE(bp);
- bp->b_vp = savedvp;
-
- return error;
-}
-
int
layer_getpages(void *v)
{
diff -r 3f2b412577e9 -r c9688af71ec2 sys/miscfs/nullfs/null_vnops.c
--- a/sys/miscfs/nullfs/null_vnops.c Mon Jul 11 08:25:09 2011 +0000
+++ b/sys/miscfs/nullfs/null_vnops.c Mon Jul 11 08:27:37 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: null_vnops.c,v 1.37 2011/01/10 11:11:03 hannken Exp $ */
+/* $NetBSD: null_vnops.c,v 1.38 2011/07/11 08:27:38 hannken Exp $ */
/*
* Copyright (c) 1999 National Aeronautics & Space Administration
@@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: null_vnops.c,v 1.37 2011/01/10 11:11:03 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: null_vnops.c,v 1.38 2011/07/11 08:27:38 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -114,7 +114,6 @@
{ &vop_open_desc, layer_open }, /* mount option handling */
- { &vop_bwrite_desc, layer_bwrite },
{ &vop_bmap_desc, layer_bmap },
{ &vop_getpages_desc, layer_getpages },
{ &vop_putpages_desc, layer_putpages },
diff -r 3f2b412577e9 -r c9688af71ec2 sys/miscfs/overlay/overlay_vnops.c
--- a/sys/miscfs/overlay/overlay_vnops.c Mon Jul 11 08:25:09 2011 +0000
+++ b/sys/miscfs/overlay/overlay_vnops.c Mon Jul 11 08:27:37 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: overlay_vnops.c,v 1.18 2011/01/10 11:11:03 hannken Exp $ */
+/* $NetBSD: overlay_vnops.c,v 1.19 2011/07/11 08:27:39 hannken Exp $ */
/*
* Copyright (c) 1999, 2000 National Aeronautics & Space Administration
@@ -67,7 +67,7 @@
*
* Ancestors:
* @(#)lofs_vnops.c 1.2 (Berkeley) 6/18/92
- * $Id: overlay_vnops.c,v 1.18 2011/01/10 11:11:03 hannken Exp $
+ * $Id: overlay_vnops.c,v 1.19 2011/07/11 08:27:39 hannken Exp $
* ...and...
* @(#)null_vnodeops.c 1.20 92/07/07 UCLA Ficus project
*/
@@ -126,7 +126,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: overlay_vnops.c,v 1.18 2011/01/10 11:11:03 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: overlay_vnops.c,v 1.19 2011/07/11 08:27:39 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -163,7 +163,6 @@
{ &vop_open_desc, layer_open }, /* mount option handling */
- { &vop_bwrite_desc, layer_bwrite },
{ &vop_bmap_desc, layer_bmap },
Home |
Main Index |
Thread Index |
Old Index