Page MenuHomeFreeBSD

D62336.1796341913.diff
No OneTemporary

Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None

D62336.1796341913.diff

diff --git a/sys/fs/nfs/nfsport.h b/sys/fs/nfs/nfsport.h
--- a/sys/fs/nfs/nfsport.h
+++ b/sys/fs/nfs/nfsport.h
@@ -1173,12 +1173,10 @@
((v) == NULL || (vn_irflag_read(v) & VIRF_NAMEDATTR) == 0)
#endif
-/*
- * Name used by getnewvnode() to describe filesystem, "nfs".
- * For performance reasons it is useful to have the same string
- * used in both places that call getnewvnode().
- */
+/* extern definitions used for new vnodes. */
extern const char nfs_vnode_tag[];
+extern struct vop_vector newnfs_vnodeops;
+extern struct buf_ops buf_ops_nfs;
/*
* Check for the errors that indicate a DS should be disabled.
diff --git a/sys/fs/nfsclient/nfs_clnode.c b/sys/fs/nfsclient/nfs_clnode.c
--- a/sys/fs/nfsclient/nfs_clnode.c
+++ b/sys/fs/nfsclient/nfs_clnode.c
@@ -59,7 +59,6 @@
#include <nfs/nfs_lock.h>
-extern struct vop_vector newnfs_vnodeops;
MALLOC_DECLARE(M_NEWNFSREQ);
uma_zone_t newnfsnode_zone;
@@ -130,6 +129,7 @@
return (error);
}
vp = nvp;
+ vp->v_bufobj.bo_ops = &buf_ops_nfs;
KASSERT(vp->v_bufobj.bo_bsize != 0, ("ncl_nget: bo_bsize == 0"));
vp->v_data = np;
np->n_vnode = vp;
diff --git a/sys/fs/nfsclient/nfs_clport.c b/sys/fs/nfsclient/nfs_clport.c
--- a/sys/fs/nfsclient/nfs_clport.c
+++ b/sys/fs/nfsclient/nfs_clport.c
@@ -67,7 +67,6 @@
#endif /* !KDTRACE_HOOKS */
extern u_int32_t newnfs_true, newnfs_false, newnfs_xdrneg1;
-extern struct vop_vector newnfs_vnodeops;
extern struct vop_vector newnfs_fifoops;
extern uma_zone_t newnfsnode_zone;
extern uma_zone_t ncl_pbuf_zone;
@@ -226,6 +225,7 @@
return (error);
}
vp = nvp;
+ vp->v_bufobj.bo_ops = &buf_ops_nfs;
KASSERT(vp->v_bufobj.bo_bsize != 0, ("nfscl_nget: bo_bsize == 0"));
vp->v_data = np;
np->n_vnode = vp;
diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c
--- a/sys/fs/nfsclient/nfs_clvnops.c
+++ b/sys/fs/nfsclient/nfs_clvnops.c
@@ -134,7 +134,7 @@
static vop_rmdir_t nfs_rmdir;
static vop_symlink_t nfs_symlink;
static vop_readdir_t nfs_readdir;
-static vop_strategy_t nfs_strategy;
+static int nfs_strategy(struct vnode *, struct buf *);
static int nfs_lookitup(struct vnode *, char *, int,
struct ucred *, struct thread *, struct nfsnode **);
static int nfs_sillyrename(struct vnode *, struct vnode *,
@@ -189,7 +189,6 @@
.vop_rename = nfs_rename,
.vop_rmdir = nfs_rmdir,
.vop_setattr = nfs_setattr,
- .vop_strategy = nfs_strategy,
.vop_symlink = nfs_symlink,
.vop_write = ncl_write,
.vop_getacl = nfs_getacl,
@@ -3029,14 +3028,10 @@
* request.
*/
static int
-nfs_strategy(struct vop_strategy_args *ap)
+nfs_strategy(struct vnode *vp, struct buf *bp)
{
- struct buf *bp;
- struct vnode *vp;
struct ucred *cr;
- bp = ap->a_bp;
- vp = ap->a_vp;
KASSERT(bp->b_vp == vp, ("missing b_getvp"));
KASSERT(!(bp->b_flags & B_DONE),
("nfs_strategy: buffer %p unexpectedly marked B_DONE", bp));
@@ -4857,3 +4852,25 @@
}
return (error);
}
+
+static void
+nfscl_bufstrategy(struct bufobj *bo, struct buf *bp)
+{
+ int i __unused;
+ struct vnode *vp;
+
+ vp = bp->b_vp;
+ KASSERT(vp == bo->bo_private, ("Inconsistent vnode nfscl_bufstrategy"));
+ KASSERT(!VN_ISDEV(vp),
+ ("Wrong vnode in nfscl_bufstrategy(bp=%p, vp=%p)", bp, vp));
+ i = nfs_strategy(vp, bp);
+ KASSERT(i == 0, ("nfs_strategy failed bp=%p vp=%p", bp, bp->b_vp));
+}
+
+struct buf_ops buf_ops_nfs = {
+ .bop_name = "buf_ops_nfs",
+ .bop_write = bufwrite,
+ .bop_strategy = nfscl_bufstrategy,
+ .bop_sync = bufsync,
+ .bop_bdflush = bufbdflush,
+};

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 3, 11:51 PM (23 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42196459
Default Alt Text
D62336.1796341913.diff (3 KB)

Event Timeline