summaryrefslogtreecommitdiffstats
path: root/sys/nfs
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/nfs
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/nfs')
-rw-r--r--sys/nfs/nfs_bio.c19
-rw-r--r--sys/nfs/nfs_vnops.c23
2 files changed, 23 insertions, 19 deletions
diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c
index 0c30ca3..442af96 100644
--- a/sys/nfs/nfs_bio.c
+++ b/sys/nfs/nfs_bio.c
@@ -63,6 +63,23 @@
#include <nfs/nqnfs.h>
#include <nfs/nfsnode.h>
+/*
+ * Just call nfs_writebp() with the force argument set to 1.
+ *
+ * NOTE: B_DONE may or may not be set in a_bp on call.
+ */
+static int
+nfs_bwrite(struct buf *bp)
+{
+ return (nfs_writebp(bp, 1, curproc));
+}
+
+struct buf_ops buf_ops_nfs = {
+ "buf_ops_nfs",
+ nfs_bwrite
+};
+
+
static struct buf *nfs_getcacheblk __P((struct vnode *vp, daddr_t bn, int size,
struct proc *p));
@@ -890,6 +907,8 @@ again:
bcount += n;
allocbuf(bp, bcount);
bp->b_flags |= save;
+ bp->b_magic = B_MAGIC_NFS;
+ bp->b_op = &buf_ops_nfs;
}
} else {
/*
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c
index d889cf4..2a5564e 100644
--- a/sys/nfs/nfs_vnops.c
+++ b/sys/nfs/nfs_vnops.c
@@ -129,7 +129,6 @@ static int nfsspec_access __P((struct vop_access_args *));
static int nfs_readlink __P((struct vop_readlink_args *));
static int nfs_print __P((struct vop_print_args *));
static int nfs_advlock __P((struct vop_advlock_args *));
-static int nfs_bwrite __P((struct vop_bwrite_args *));
/*
* Global vfs data structures for nfs
*/
@@ -139,7 +138,6 @@ static struct vnodeopv_entry_desc nfsv2_vnodeop_entries[] = {
{ &vop_access_desc, (vop_t *) nfs_access },
{ &vop_advlock_desc, (vop_t *) nfs_advlock },
{ &vop_bmap_desc, (vop_t *) nfs_bmap },
- { &vop_bwrite_desc, (vop_t *) nfs_bwrite },
{ &vop_close_desc, (vop_t *) nfs_close },
{ &vop_create_desc, (vop_t *) nfs_create },
{ &vop_fsync_desc, (vop_t *) nfs_fsync },
@@ -3090,23 +3088,10 @@ nfs_print(ap)
}
/*
- * Just call nfs_writebp() with the force argument set to 1.
- *
- * NOTE: B_DONE may or may not be set in a_bp on call.
- */
-static int
-nfs_bwrite(ap)
- struct vop_bwrite_args /* {
- struct vnode *a_bp;
- } */ *ap;
-{
- return (nfs_writebp(ap->a_bp, 1, curproc));
-}
-
-/*
- * This is a clone of vn_bwrite(), except that B_WRITEINPROG isn't set unless
- * the force flag is one and it also handles the B_NEEDCOMMIT flag. We set
- * B_CACHE if this is a VMIO buffer.
+ * This is the "real" nfs::bwrite(struct buf*).
+ * B_WRITEINPROG isn't set unless the force flag is one and it
+ * handles the B_NEEDCOMMIT flag.
+ * We set B_CACHE if this is a VMIO buffer.
*/
int
nfs_writebp(bp, force, procp)
OpenPOWER on IntegriCloud