summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2023-12-15 21:03:28 +0300
committerDarrick J. Wong <djwong@kernel.org>2023-12-15 21:03:28 +0300
commita20ffa7d9f863056364b11a680145a76ef15acb2 (patch)
tree00ab783203807baf47edfa2f5cfd33cffb6c366d /fs/xfs/scrub
parent26de64629d8b439a03bce243f14a46f7440729f3 (diff)
downloadlinux-a20ffa7d9f863056364b11a680145a76ef15acb2.tar.xz
xfs: add debug knobs to control btree bulk load slack factors
Add some debug knobs so that we can control the leaf and node block slack when rebuilding btrees. For developers, it might be useful to construct btrees of various heights by crafting a filesystem with a certain number of records and then using repair+knobs to rebuild the index with a certain shape. Practically speaking, you'd only ever do that for extreme stress testing of the runtime code or the btree generator. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/scrub')
-rw-r--r--fs/xfs/scrub/newbt.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/xfs/scrub/newbt.c b/fs/xfs/scrub/newbt.c
index 992cf34a13e7..46883606ad88 100644
--- a/fs/xfs/scrub/newbt.c
+++ b/fs/xfs/scrub/newbt.c
@@ -32,6 +32,7 @@
* btree bulk loading code calculates for us. However, there are some
* exceptions to this rule:
*
+ * (0) If someone turned one of the debug knobs.
* (1) If this is a per-AG btree and the AG has less than 10% space free.
* (2) If this is an inode btree and the FS has less than 10% space free.
@@ -47,9 +48,13 @@ xrep_newbt_estimate_slack(
uint64_t free;
uint64_t sz;
- /* Let the btree code compute the default slack values. */
- bload->leaf_slack = -1;
- bload->node_slack = -1;
+ /*
+ * The xfs_globals values are set to -1 (i.e. take the bload defaults)
+ * unless someone has set them otherwise, so we just pull the values
+ * here.
+ */
+ bload->leaf_slack = xfs_globals.bload_leaf_slack;
+ bload->node_slack = xfs_globals.bload_node_slack;
if (sc->ops->type == ST_PERAG) {
free = sc->sa.pag->pagf_freeblks;