summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-01-04 22:10:36 +0000
committerphk <phk@FreeBSD.org>2003-01-04 22:10:36 +0000
commit131885aa2f8d42ce9c721f66cd0c84ec7789ffc0 (patch)
treec7a5f4c248cdb6b6c66f82139acb14ed7ec6d6d0 /sys/kern
parenta307536f906cea2e4ba4d10d51b320520f1a30c1 (diff)
downloadFreeBSD-src-131885aa2f8d42ce9c721f66cd0c84ec7789ffc0.zip
FreeBSD-src-131885aa2f8d42ce9c721f66cd0c84ec7789ffc0.tar.gz
Temporarily introduce a new VOP_SPECSTRATEGY operation while I try
to sort out disk-io from file-io in the vm/buffer/filesystem space. The intent is to sort VOP_STRATEGY calls into those which operate on "real" vnodes and those which operate on VCHR vnodes. For the latter kind, the call will be changed to VOP_SPECSTRATEGY, possibly conditionally for those places where dual-use happens. Add a default VOP_SPECSTRATEGY method which will call the normal VOP_STRATEGY. First time it is called it will print debugging information. This will only happen if a normal vnode is passed to VOP_SPECSTRATEGY by mistake. Add a real VOP_SPECSTRATEGY in specfs, which does what VOP_STRATEGY does on a VCHR vnode today. Add a new VOP_STRATEGY method in specfs to catch instances where the conversion to VOP_SPECSTRATEGY has not yet happened. Handle the request just like we always did, but first time called print debugging information. Apart up to two instances of console messages per boot, this amounts to a glorified no-op commit. If you get any of the messages on your console I would very much like a copy of them mailed to phk@freebsd.org
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_bio.c15
-rw-r--r--sys/kern/vfs_default.c25
-rw-r--r--sys/kern/vnode_if.src9
3 files changed, 46 insertions, 3 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 65fcb33..784a5c0 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -701,7 +701,10 @@ breadn(struct vnode * vp, daddr_t blkno, int size,
if (bp->b_rcred == NOCRED && cred != NOCRED)
bp->b_rcred = crhold(cred);
vfs_busy_pages(bp, 0);
- VOP_STRATEGY(vp, bp);
+ if (vp->v_type == VCHR)
+ VOP_SPECSTRATEGY(vp, bp);
+ else
+ VOP_STRATEGY(vp, bp);
++readwait;
}
@@ -721,7 +724,10 @@ breadn(struct vnode * vp, daddr_t blkno, int size,
rabp->b_rcred = crhold(cred);
vfs_busy_pages(rabp, 0);
BUF_KERNPROC(rabp);
- VOP_STRATEGY(vp, rabp);
+ if (vp->v_type == VCHR)
+ VOP_SPECSTRATEGY(vp, bp);
+ else
+ VOP_STRATEGY(vp, bp);
} else {
brelse(rabp);
}
@@ -855,7 +861,10 @@ bwrite(struct buf * bp)
splx(s);
if (oldflags & B_ASYNC)
BUF_KERNPROC(bp);
- VOP_STRATEGY(bp->b_vp, bp);
+ if (bp->b_vp->v_type == VCHR)
+ VOP_SPECSTRATEGY(bp->b_vp, bp);
+ else
+ VOP_STRATEGY(bp->b_vp, bp);
if ((oldflags & B_ASYNC) == 0) {
int rtval = bufwait(bp);
diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c
index 85b8af9..f629b19 100644
--- a/sys/kern/vfs_default.c
+++ b/sys/kern/vfs_default.c
@@ -66,6 +66,7 @@
static int vop_nolookup(struct vop_lookup_args *);
static int vop_nostrategy(struct vop_strategy_args *);
+static int vop_nospecstrategy(struct vop_specstrategy_args *);
/*
* This vnode table stores what we want to do if the filesystem doesn't
@@ -98,6 +99,7 @@ static struct vnodeopv_entry_desc default_vnodeop_entries[] = {
{ &vop_putpages_desc, (vop_t *) vop_stdputpages },
{ &vop_readlink_desc, (vop_t *) vop_einval },
{ &vop_revoke_desc, (vop_t *) vop_revoke },
+ { &vop_specstrategy_desc, (vop_t *) vop_nospecstrategy },
{ &vop_strategy_desc, (vop_t *) vop_nostrategy },
{ &vop_unlock_desc, (vop_t *) vop_stdunlock },
{ NULL, NULL }
@@ -221,6 +223,29 @@ vop_nostrategy (struct vop_strategy_args *ap)
}
/*
+ * vop_nospecstrategy:
+ *
+ * This shouldn't happen. VOP_SPECSTRATEGY should always have a VCHR
+ * argument vnode, and thos have a method for specstrategy over in
+ * specfs, so we only ever get here if somebody botched it.
+ * Pass the call to VOP_STRATEGY() and get on with life.
+ * The first time we print some info useful for debugging.
+ */
+
+static int
+vop_nospecstrategy (struct vop_specstrategy_args *ap)
+{
+ static int once;
+
+ if (!once) {
+ vprint("\nVOP_SPECSTRATEGY on non-VCHR\n", ap->a_vp);
+ backtrace();
+ once++;
+ }
+ return VOP_STRATEGY(ap->a_vp, ap->a_bp);
+}
+
+/*
* vop_stdpathconf:
*
* Standard implementation of POSIX pathconf, to get information about limits
diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src
index 4fce819..f62d0ac 100644
--- a/sys/kern/vnode_if.src
+++ b/sys/kern/vnode_if.src
@@ -400,6 +400,15 @@ vop_strategy {
};
#
+# specstrategy vp L L L
+#! specstrategy pre vop_strategy_pre
+#
+vop_specstrategy {
+ IN struct vnode *vp;
+ IN struct buf *bp;
+};
+
+#
#% getwritemount vp = = =
#
vop_getwritemount {
OpenPOWER on IntegriCloud