]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_repair: adjust btree bulkloading slack computations to match online repair
authorDarrick J. Wong <djwong@kernel.org>
Mon, 15 Apr 2024 23:07:45 +0000 (16:07 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 17 Apr 2024 21:06:27 +0000 (14:06 -0700)
Adjust the lowspace threshold in the new btree block slack computation
code to match online repair, which uses a straight 10% instead of magic
shifting to approximate that without division.  Repairs aren't that
frequent in the kernel; and userspace can always do u64 division.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bill O'Donnell <bodonnel@redhat.com>
repair/bulkload.c

index 8dd0a0c3908be522e61a7d479c86205ddb13f331..0117f69416cfb32364654b8b0784486c6c52715d 100644 (file)
@@ -106,9 +106,10 @@ bulkload_claim_block(
  * exceptions to this rule:
  *
  * (1) If someone turned one of the debug knobs.
- * (2) The AG has less than ~9% space free.
+ * (2) The AG has less than ~10% space free.
  *
- * Note that we actually use 3/32 for the comparison to avoid division.
+ * In the latter case, format the new btree blocks almost completely full to
+ * minimize space usage.
  */
 void
 bulkload_estimate_ag_slack(
@@ -124,8 +125,8 @@ bulkload_estimate_ag_slack(
        bload->leaf_slack = bload_leaf_slack;
        bload->node_slack = bload_node_slack;
 
-       /* No further changes if there's more than 3/32ths space left. */
-       if (free >= ((sc->mp->m_sb.sb_agblocks * 3) >> 5))
+       /* No further changes if there's more than 10% space left. */
+       if (free >= sc->mp->m_sb.sb_agblocks / 10)
                return;
 
        /*