summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2001-04-17 08:56:39 +0000
committerphk <phk@FreeBSD.org>2001-04-17 08:56:39 +0000
commit378e561228360a3c0ad7f34be404abec95457c90 (patch)
treec2dc888d5361454aab94e341449bda307b726c8b /sys/kern
parent922e3083ccc90b69264f72c32d897dfa6c0c2495 (diff)
downloadFreeBSD-src-378e561228360a3c0ad7f34be404abec95457c90.zip
FreeBSD-src-378e561228360a3c0ad7f34be404abec95457c90.tar.gz
This patch removes the VOP_BWRITE() vector.
VOP_BWRITE() was a hack which made it possible for NFS client side to use struct buf with non-bio backing. This patch takes a more general approach and adds a bp->b_op vector where more methods can be added. The success of this patch depends on bp->b_op being initialized all relevant places for some value of "relevant" which is not easy to determine. For now the buffers have grown a b_magic element which will make such issues a tiny bit easier to debug.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_bio.c9
-rw-r--r--sys/kern/vfs_cluster.c2
-rw-r--r--sys/kern/vfs_default.c8
-rw-r--r--sys/kern/vfs_export.c2
-rw-r--r--sys/kern/vfs_subr.c2
-rw-r--r--sys/kern/vnode_if.src8
6 files changed, 12 insertions, 19 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 4705903..87a17a8 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -58,6 +58,11 @@ static MALLOC_DEFINE(M_BIOBUF, "BIO buffer", "BIO buffer");
struct bio_ops bioops; /* I/O operation notification */
+struct buf_ops buf_ops_bio = {
+ "buf_ops_bio",
+ bwrite
+};
+
struct buf *buf; /* buffer header pool */
struct swqueue bswlist;
struct mtx buftimelock; /* Interlock on setting prio and timo */
@@ -1685,6 +1690,8 @@ restart:
bp->b_bcount = 0;
bp->b_npages = 0;
bp->b_dirtyoff = bp->b_dirtyend = 0;
+ bp->b_magic = B_MAGIC_BIO;
+ bp->b_op = &buf_ops_bio;
LIST_INIT(&bp->b_dep);
@@ -2088,7 +2095,7 @@ vfs_setdirty(struct buf *bp)
* case it is returned with B_INVAL clear and B_CACHE set based on the
* backing VM.
*
- * getblk() also forces a VOP_BWRITE() for any B_DELWRI buffer whos
+ * getblk() also forces a BUF_WRITE() for any B_DELWRI buffer whos
* B_CACHE bit is clear.
*
* What this means, basically, is that the caller should use B_CACHE to
diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c
index de6b67e..8a6e045 100644
--- a/sys/kern/vfs_cluster.c
+++ b/sys/kern/vfs_cluster.c
@@ -755,6 +755,8 @@ cluster_wbuild(vp, size, start_lbn, len)
*/
TAILQ_INIT(&bp->b_cluster.cluster_head);
bp->b_bcount = 0;
+ bp->b_magic = tbp->b_magic;
+ bp->b_op = tbp->b_op;
bp->b_bufsize = 0;
bp->b_npages = 0;
if (tbp->b_wcred != NOCRED) {
diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c
index d0ed3bb..cdbf668 100644
--- a/sys/kern/vfs_default.c
+++ b/sys/kern/vfs_default.c
@@ -80,7 +80,6 @@ vop_t **default_vnodeop_p;
static struct vnodeopv_entry_desc default_vnodeop_entries[] = {
{ &vop_default_desc, (vop_t *) vop_eopnotsupp },
{ &vop_advlock_desc, (vop_t *) vop_einval },
- { &vop_bwrite_desc, (vop_t *) vop_stdbwrite },
{ &vop_close_desc, (vop_t *) vop_null },
{ &vop_createvobject_desc, (vop_t *) vop_stdcreatevobject },
{ &vop_destroyvobject_desc, (vop_t *) vop_stddestroyvobject },
@@ -333,13 +332,6 @@ vop_stdpoll(ap)
return (vn_pollrecord(ap->a_vp, ap->a_p, ap->a_events));
}
-int
-vop_stdbwrite(ap)
- struct vop_bwrite_args *ap;
-{
- return (bwrite(ap->a_bp));
-}
-
/*
* Stubs to use when there is no locking to be done on the underlying object.
* A minimal shared lock is necessary to ensure that the underlying object
diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c
index f10edb2..29dec8a 100644
--- a/sys/kern/vfs_export.c
+++ b/sys/kern/vfs_export.c
@@ -748,7 +748,7 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo)
* believe there is a slight chance that a delayed
* write will occur while sleeping just above, so
* check for it. Note that vfs_bio_awrite expects
- * buffers to reside on a queue, while VOP_BWRITE and
+ * buffers to reside on a queue, while BUF_WRITE and
* brelse do not.
*/
if (((bp->b_flags & (B_DELWRI | B_INVAL)) == B_DELWRI) &&
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index f10edb2..29dec8a 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -748,7 +748,7 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo)
* believe there is a slight chance that a delayed
* write will occur while sleeping just above, so
* check for it. Note that vfs_bio_awrite expects
- * buffers to reside on a queue, while VOP_BWRITE and
+ * buffers to reside on a queue, while BUF_WRITE and
* brelse do not.
*/
if (((bp->b_flags & (B_DELWRI | B_INVAL)) == B_DELWRI) &&
diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src
index dd22b80..2fb59d3 100644
--- a/sys/kern/vnode_if.src
+++ b/sys/kern/vnode_if.src
@@ -484,14 +484,6 @@ vop_freeblks {
};
#
-#% bwrite vp L L L
-#
-vop_bwrite {
- IN struct vnode *vp;
- IN struct buf *bp;
-};
-
-#
#% getacl vp L L L
#
vop_getacl {
OpenPOWER on IntegriCloud