diff options
author | phk <phk@FreeBSD.org> | 2004-10-24 20:03:41 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-10-24 20:03:41 +0000 |
commit | 1b25a5988640ac862e8e964c30aaccfd83e128cf (patch) | |
tree | 220ef3feb4e3c7063a6550b7466cbd964e346c84 /sys/nfsclient | |
parent | 27296db6a7b0487c98e7e27a7765cf3d19bdf963 (diff) | |
download | FreeBSD-src-1b25a5988640ac862e8e964c30aaccfd83e128cf.zip FreeBSD-src-1b25a5988640ac862e8e964c30aaccfd83e128cf.tar.gz |
Move the buffer method vector (buf->b_op) to the bufobj.
Extend it with a strategy method.
Add bufstrategy() which do the usual VOP_SPECSTRATEGY/VOP_STRATEGY
song and dance.
Rename ibwrite to bufwrite().
Move the two NFS buf_ops to more sensible places, add bufstrategy
to them.
Add inlines for bwrite() and bstrategy() which calls through
buf->b_bufobj->b_ops->b_{write,strategy}().
Replace almost all VOP_STRATEGY()/VOP_SPECSTRATEGY() calls with bstrategy().
Diffstat (limited to 'sys/nfsclient')
-rw-r--r-- | sys/nfsclient/nfs_bio.c | 37 | ||||
-rw-r--r-- | sys/nfsclient/nfs_node.c | 4 | ||||
-rw-r--r-- | sys/nfsclient/nfs_vnops.c | 19 | ||||
-rw-r--r-- | sys/nfsclient/nfsnode.h | 2 |
4 files changed, 26 insertions, 36 deletions
diff --git a/sys/nfsclient/nfs_bio.c b/sys/nfsclient/nfs_bio.c index 7148834..8428f98 100644 --- a/sys/nfsclient/nfs_bio.c +++ b/sys/nfsclient/nfs_bio.c @@ -64,35 +64,6 @@ __FBSDID("$FreeBSD$"); #include <nfs4client/nfs4.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 -nfs4_bwrite(struct buf *bp) -{ - - return (nfs4_writebp(bp, 1, curthread)); -} - -static int -nfs_bwrite(struct buf *bp) -{ - - return (nfs_writebp(bp, 1, curthread)); -} - -struct buf_ops buf_ops_nfs4 = { - "buf_ops_nfs4", - nfs4_bwrite -}; - -struct buf_ops buf_ops_nfs = { - "buf_ops_nfs", - nfs_bwrite -}; - static struct buf *nfs_getcacheblk(struct vnode *vp, daddr_t bn, int size, struct thread *td); @@ -866,10 +837,6 @@ again: allocbuf(bp, bcount); bp->b_flags |= save; bp->b_magic = B_MAGIC_NFS; - if ((nmp->nm_flag & NFSMNT_NFSV4) != 0) - bp->b_op = &buf_ops_nfs4; - else - bp->b_op = &buf_ops_nfs; } } else { /* @@ -1403,7 +1370,7 @@ nfs_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td) off = ((u_quad_t)bp->b_blkno) * DEV_BSIZE + bp->b_dirtyoff; retv = (nmp->nm_rpcops->nr_commit)( - bp->b_vp, off, bp->b_dirtyend-bp->b_dirtyoff, + vp, off, bp->b_dirtyend-bp->b_dirtyoff, bp->b_wcred, td); if (retv == 0) { bp->b_dirtyoff = bp->b_dirtyend = 0; @@ -1413,7 +1380,7 @@ nfs_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td) return (0); } if (retv == NFSERR_STALEWRITEVERF) { - nfs_clearcommit(bp->b_vp->v_mount); + nfs_clearcommit(vp->v_mount); } } diff --git a/sys/nfsclient/nfs_node.c b/sys/nfsclient/nfs_node.c index e6b2d94..cc4a68c 100644 --- a/sys/nfsclient/nfs_node.c +++ b/sys/nfsclient/nfs_node.c @@ -247,6 +247,10 @@ loop: return (error); } vp = nvp; + if (nmp->nm_flag & NFSMNT_NFSV4) + vp->v_bufobj.bo_ops = &buf_ops_nfs4; + else + vp->v_bufobj.bo_ops = &buf_ops_nfs; bzero((caddr_t)np, sizeof *np); vp->v_data = np; np->n_vnode = vp; diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index d664573..755fed3 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -2930,7 +2930,7 @@ nfs_writebp(struct buf *bp, int force __unused, struct thread *td) BUF_KERNPROC(bp); bp->b_iooffset = dbtob(bp->b_blkno); - VOP_STRATEGY(bp->b_vp, bp); + bstrategy(bp); if( (oldflags & B_ASYNC) == 0) { int rtval = bufwait(bp); @@ -3053,3 +3053,20 @@ nfsfifo_close(struct vop_close_args *ap) return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_close), 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(struct buf *bp) +{ + + return (nfs_writebp(bp, 1, curthread)); +} + +struct buf_ops buf_ops_nfs = { + .bop_name = "buf_ops_nfs", + .bop_write = nfs_bwrite, + .bop_strategy = bufstrategy, +}; diff --git a/sys/nfsclient/nfsnode.h b/sys/nfsclient/nfsnode.h index 3cac9b3..5d770fa 100644 --- a/sys/nfsclient/nfsnode.h +++ b/sys/nfsclient/nfsnode.h @@ -193,11 +193,13 @@ nfs_rsunlock(struct nfsnode *np, struct thread *td) extern vop_t **fifo_nfsnodeop_p; extern vop_t **nfs_vnodeop_p; +extern struct buf_ops buf_ops_nfs; #if 0 extern vop_t **fifo_nfs4nodeop_p; #endif extern vop_t **nfs4_vnodeop_p; +extern struct buf_ops buf_ops_nfs4; /* * Prototypes for NFS vnode operations |