diff mbox series

[1/2] xfs_repair: adjust btree bulkloading slack computations to match online repair

Message ID 171029432516.2063452.11265636611489161443.stgit@frogsfrogsfrogs (mailing list archive)
State Superseded
Headers show
Series [1/2] xfs_repair: adjust btree bulkloading slack computations to match online repair | expand

Commit Message

Darrick J. Wong March 13, 2024, 2:10 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

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>
---
 repair/bulkload.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Bill O'Donnell March 13, 2024, 5:48 p.m. UTC | #1
On Tue, Mar 12, 2024 at 07:10:45PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> 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: Bill O'Donnell <bodonnel@redhat.com>

> ---
>  repair/bulkload.c |    9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> 
> diff --git a/repair/bulkload.c b/repair/bulkload.c
> index 8dd0a0c3908b..0117f69416cf 100644
> --- a/repair/bulkload.c
> +++ b/repair/bulkload.c
> @@ -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;
>  
>  	/*
> 
>
Christoph Hellwig March 13, 2024, 10:04 p.m. UTC | #2
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/repair/bulkload.c b/repair/bulkload.c
index 8dd0a0c3908b..0117f69416cf 100644
--- a/repair/bulkload.c
+++ b/repair/bulkload.c
@@ -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;
 
 	/*