summaryrefslogtreecommitdiffstats
path: root/sys/cddl
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2016-05-18 13:21:29 +0000
committeravg <avg@FreeBSD.org>2016-05-18 13:21:29 +0000
commit109635ff68701e47d9a8772e34e6df7bc554a4e8 (patch)
tree1ca94ea163a0a8d140d6a6bbccfacd509fe2ba50 /sys/cddl
parentf7a973e64a1e453e98fadab5ccca905d3ed533fb (diff)
downloadFreeBSD-src-109635ff68701e47d9a8772e34e6df7bc554a4e8.zip
FreeBSD-src-109635ff68701e47d9a8772e34e6df7bc554a4e8.tar.gz
add vop_print methods to vnode operatios of various zfsctl node types
This should help with diagnostics of zfsctl problems. MFC after: 2 weeks
Diffstat (limited to 'sys/cddl')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
index b0706ba..2052c76 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
@@ -294,6 +294,22 @@ zfsctl_root(znode_t *zp)
return (zp->z_zfsvfs->z_ctldir);
}
+static int
+zfsctl_common_print(ap)
+ struct vop_print_args /* {
+ struct vnode *a_vp;
+ } */ *ap;
+{
+ vnode_t *vp = ap->a_vp;
+ gfs_file_t *fp = vp->v_data;
+
+ printf(" parent = %p\n", fp->gfs_parent);
+ printf(" type = %d\n", fp->gfs_type);
+ printf(" index = %d\n", fp->gfs_index);
+ printf(" ino = %ju\n", (uintmax_t)fp->gfs_ino);
+ return (0);
+}
+
/*
* Common open routine. Disallow any write access.
*/
@@ -584,6 +600,17 @@ relookup:
return (err);
}
+static int
+zfsctl_root_print(ap)
+ struct vop_print_args /* {
+ struct vnode *a_vp;
+ } */ *ap;
+{
+ printf(" .zfs node\n");
+ zfsctl_common_print(ap);
+ return (0);
+}
+
#ifdef illumos
static int
zfsctl_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr,
@@ -634,6 +661,7 @@ static struct vop_vector zfsctl_ops_root = {
.vop_pathconf = zfsctl_pathconf,
#endif
.vop_fid = zfsctl_common_fid,
+ .vop_print = zfsctl_root_print,
};
/*
@@ -1376,6 +1404,32 @@ zfsctl_snapdir_reclaim(ap)
return (0);
}
+static int
+zfsctl_shares_print(ap)
+ struct vop_print_args /* {
+ struct vnode *a_vp;
+ } */ *ap;
+{
+ printf(" .zfs/shares node\n");
+ zfsctl_common_print(ap);
+ return (0);
+}
+
+static int
+zfsctl_snapdir_print(ap)
+ struct vop_print_args /* {
+ struct vnode *a_vp;
+ } */ *ap;
+{
+ vnode_t *vp = ap->a_vp;
+ zfsctl_snapdir_t *sdp = vp->v_data;
+
+ printf(" .zfs/snapshot node\n");
+ printf(" number of children = %lu\n", avl_numnodes(&sdp->sd_snaps));
+ zfsctl_common_print(ap);
+ return (0);
+}
+
#ifdef illumos
static const fs_operation_def_t zfsctl_tops_snapdir[] = {
{ VOPNAME_OPEN, { .vop_open = zfsctl_common_open } },
@@ -1421,6 +1475,7 @@ static struct vop_vector zfsctl_ops_snapdir = {
.vop_inactive = VOP_NULL,
.vop_reclaim = zfsctl_snapdir_reclaim,
.vop_fid = zfsctl_common_fid,
+ .vop_print = zfsctl_snapdir_print,
};
static struct vop_vector zfsctl_ops_shares = {
@@ -1435,6 +1490,7 @@ static struct vop_vector zfsctl_ops_shares = {
.vop_inactive = VOP_NULL,
.vop_reclaim = gfs_vop_reclaim,
.vop_fid = zfsctl_shares_fid,
+ .vop_print = zfsctl_shares_print,
};
#endif /* illumos */
@@ -1571,6 +1627,21 @@ zfsctl_snapshot_vptocnp(struct vop_vptocnp_args *ap)
return (error);
}
+static int
+zfsctl_snaphot_print(ap)
+ struct vop_print_args /* {
+ struct vnode *a_vp;
+ } */ *ap;
+{
+ vnode_t *vp = ap->a_vp;
+ zfsctl_node_t *zcp = vp->v_data;
+
+ printf(" .zfs/snapshot/<snap> node\n");
+ printf(" id = %ju\n", (uintmax_t)zcp->zc_id);
+ zfsctl_common_print(ap);
+ return (0);
+}
+
/*
* These VP's should never see the light of day. They should always
* be covered.
@@ -1580,6 +1651,7 @@ static struct vop_vector zfsctl_ops_snapshot = {
.vop_inactive = zfsctl_snapshot_inactive,
.vop_reclaim = zfsctl_snapshot_reclaim,
.vop_vptocnp = zfsctl_snapshot_vptocnp,
+ .vop_print = zfsctl_snaphot_print,
};
int
OpenPOWER on IntegriCloud