aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Yao <[email protected]>2022-09-15 19:22:33 -0400
committerGitHub <[email protected]>2022-09-15 16:22:33 -0700
commitb24d1c77f7fc53d26ee915b5203a139f13fd9791 (patch)
treefdb481ea88a25ba580aac31dd10befe093681b94
parentddb1fd91c0dbf64847235ee65e50e87c43257b05 (diff)
Add zfs_btree_verify_intensity kernel module parameter
I see a few issues in the issue tracker that might be aided by being able to turn this on. We have no module parameter for it, so I would like to add one. Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #13874
-rw-r--r--cmd/zdb/zdb.c2
-rw-r--r--man/man4/zfs.416
-rw-r--r--module/zfs/btree.c8
3 files changed, 24 insertions, 2 deletions
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c
index 0fc4f0d0d..92df3dd16 100644
--- a/cmd/zdb/zdb.c
+++ b/cmd/zdb/zdb.c
@@ -121,7 +121,7 @@ extern int zfs_vdev_async_read_max_active;
extern boolean_t spa_load_verify_dryrun;
extern boolean_t spa_mode_readable_spacemaps;
extern int zfs_reconstruct_indirect_combinations_max;
-extern int zfs_btree_verify_intensity;
+extern uint_t zfs_btree_verify_intensity;
static const char cmdname[] = "zdb";
uint8_t dump_opt[256];
diff --git a/man/man4/zfs.4 b/man/man4/zfs.4
index cecaf7e7f..b2f3e7c61 100644
--- a/man/man4/zfs.4
+++ b/man/man4/zfs.4
@@ -1354,6 +1354,22 @@ _
.TE
.Sy \& * No Requires debug build.
.
+.It Sy zfs_btree_verify_intensity Ns = Ns Sy 0 Pq uint
+Enables btree verification.
+The following settings are culminative:
+.TS
+box;
+lbz r l l .
+ Value Description
+
+ 1 Verify height.
+ 2 Verify pointers from children to parent.
+ 3 Verify element counts.
+ 4 Verify element order. (expensive)
+* 5 Verify unused memory is poisoned. (expensive)
+.TE
+.Sy \& * No Requires debug build.
+.
.It Sy zfs_free_leak_on_eio Ns = Ns Sy 0 Ns | Ns 1 Pq int
If destroy encounters an
.Sy EIO
diff --git a/module/zfs/btree.c b/module/zfs/btree.c
index 60b063ed9..f0a9222a4 100644
--- a/module/zfs/btree.c
+++ b/module/zfs/btree.c
@@ -53,7 +53,7 @@ kmem_cache_t *zfs_btree_leaf_cache;
* (while the asymptotic complexity of the other steps is the same, the
* importance of the constant factors cannot be denied).
*/
-int zfs_btree_verify_intensity = 0;
+uint_t zfs_btree_verify_intensity = 0;
/*
* Convenience functions to silence warnings from memcpy/memmove's
@@ -2171,3 +2171,9 @@ zfs_btree_verify(zfs_btree_t *tree)
return;
zfs_btree_verify_poison(tree);
}
+
+/* BEGIN CSTYLED */
+ZFS_MODULE_PARAM(zfs, zfs_, btree_verify_intensity, UINT, ZMOD_RW,
+ "Enable btree verification. Levels above 4 require ZFS be built "
+ "with debugging");
+/* END CSTYLED */