diff mbox series

[02/12] xfs_repair: rename the agfl index loop variable in build_agf_agfl

Message ID 159107202579.315004.8068578556584944834.stgit@magnolia (mailing list archive)
State Accepted
Headers show
Series xfs_repair: use btree bulk loading | expand

Commit Message

Darrick J. Wong June 2, 2020, 4:27 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

The variable 'i' is used to index the AGFL block list, so change the
name to make it clearer what this is to be used for.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 repair/phase5.c |   28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

Comments

Brian Foster June 17, 2020, 12:09 p.m. UTC | #1
On Mon, Jun 01, 2020 at 09:27:05PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> The variable 'i' is used to index the AGFL block list, so change the
> name to make it clearer what this is to be used for.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  repair/phase5.c |   28 +++++++++++++++-------------
>  1 file changed, 15 insertions(+), 13 deletions(-)
> 
> 
> diff --git a/repair/phase5.c b/repair/phase5.c
> index c9b278bd..169a2d89 100644
> --- a/repair/phase5.c
> +++ b/repair/phase5.c
> @@ -2055,7 +2055,7 @@ build_agf_agfl(
>  {
>  	struct extent_tree_node	*ext_ptr;
>  	struct xfs_buf		*agf_buf, *agfl_buf;
> -	int			i;
> +	unsigned int		agfl_idx;
>  	struct xfs_agfl		*agfl;
>  	struct xfs_agf		*agf;
>  	xfs_fsblock_t		fsb;
> @@ -2153,8 +2153,8 @@ build_agf_agfl(
>  		agfl->agfl_magicnum = cpu_to_be32(XFS_AGFL_MAGIC);
>  		agfl->agfl_seqno = cpu_to_be32(agno);
>  		platform_uuid_copy(&agfl->agfl_uuid, &mp->m_sb.sb_meta_uuid);
> -		for (i = 0; i < libxfs_agfl_size(mp); i++)
> -			freelist[i] = cpu_to_be32(NULLAGBLOCK);
> +		for (agfl_idx = 0; agfl_idx < libxfs_agfl_size(mp); agfl_idx++)
> +			freelist[agfl_idx] = cpu_to_be32(NULLAGBLOCK);
>  	}
>  
>  	/*
> @@ -2165,19 +2165,21 @@ build_agf_agfl(
>  		/*
>  		 * yes, now grab as many blocks as we can
>  		 */
> -		i = 0;
> -		while (bno_bt->num_free_blocks > 0 && i < libxfs_agfl_size(mp))
> +		agfl_idx = 0;
> +		while (bno_bt->num_free_blocks > 0 &&
> +		       agfl_idx < libxfs_agfl_size(mp))
>  		{
> -			freelist[i] = cpu_to_be32(
> +			freelist[agfl_idx] = cpu_to_be32(
>  					get_next_blockaddr(agno, 0, bno_bt));
> -			i++;
> +			agfl_idx++;
>  		}
>  
> -		while (bcnt_bt->num_free_blocks > 0 && i < libxfs_agfl_size(mp))
> +		while (bcnt_bt->num_free_blocks > 0 &&
> +		       agfl_idx < libxfs_agfl_size(mp))
>  		{
> -			freelist[i] = cpu_to_be32(
> +			freelist[agfl_idx] = cpu_to_be32(
>  					get_next_blockaddr(agno, 0, bcnt_bt));
> -			i++;
> +			agfl_idx++;
>  		}
>  		/*
>  		 * now throw the rest of the blocks away and complain
> @@ -2200,9 +2202,9 @@ _("Insufficient memory saving lost blocks.\n"));
>  		}
>  
>  		agf->agf_flfirst = 0;
> -		agf->agf_fllast = cpu_to_be32(i - 1);
> -		agf->agf_flcount = cpu_to_be32(i);
> -		rmap_store_agflcount(mp, agno, i);
> +		agf->agf_fllast = cpu_to_be32(agfl_idx - 1);
> +		agf->agf_flcount = cpu_to_be32(agfl_idx);
> +		rmap_store_agflcount(mp, agno, agfl_idx);
>  
>  #ifdef XR_BLD_FREE_TRACE
>  		fprintf(stderr, "writing agfl for ag %u\n", agno);
>
diff mbox series

Patch

diff --git a/repair/phase5.c b/repair/phase5.c
index c9b278bd..169a2d89 100644
--- a/repair/phase5.c
+++ b/repair/phase5.c
@@ -2055,7 +2055,7 @@  build_agf_agfl(
 {
 	struct extent_tree_node	*ext_ptr;
 	struct xfs_buf		*agf_buf, *agfl_buf;
-	int			i;
+	unsigned int		agfl_idx;
 	struct xfs_agfl		*agfl;
 	struct xfs_agf		*agf;
 	xfs_fsblock_t		fsb;
@@ -2153,8 +2153,8 @@  build_agf_agfl(
 		agfl->agfl_magicnum = cpu_to_be32(XFS_AGFL_MAGIC);
 		agfl->agfl_seqno = cpu_to_be32(agno);
 		platform_uuid_copy(&agfl->agfl_uuid, &mp->m_sb.sb_meta_uuid);
-		for (i = 0; i < libxfs_agfl_size(mp); i++)
-			freelist[i] = cpu_to_be32(NULLAGBLOCK);
+		for (agfl_idx = 0; agfl_idx < libxfs_agfl_size(mp); agfl_idx++)
+			freelist[agfl_idx] = cpu_to_be32(NULLAGBLOCK);
 	}
 
 	/*
@@ -2165,19 +2165,21 @@  build_agf_agfl(
 		/*
 		 * yes, now grab as many blocks as we can
 		 */
-		i = 0;
-		while (bno_bt->num_free_blocks > 0 && i < libxfs_agfl_size(mp))
+		agfl_idx = 0;
+		while (bno_bt->num_free_blocks > 0 &&
+		       agfl_idx < libxfs_agfl_size(mp))
 		{
-			freelist[i] = cpu_to_be32(
+			freelist[agfl_idx] = cpu_to_be32(
 					get_next_blockaddr(agno, 0, bno_bt));
-			i++;
+			agfl_idx++;
 		}
 
-		while (bcnt_bt->num_free_blocks > 0 && i < libxfs_agfl_size(mp))
+		while (bcnt_bt->num_free_blocks > 0 &&
+		       agfl_idx < libxfs_agfl_size(mp))
 		{
-			freelist[i] = cpu_to_be32(
+			freelist[agfl_idx] = cpu_to_be32(
 					get_next_blockaddr(agno, 0, bcnt_bt));
-			i++;
+			agfl_idx++;
 		}
 		/*
 		 * now throw the rest of the blocks away and complain
@@ -2200,9 +2202,9 @@  _("Insufficient memory saving lost blocks.\n"));
 		}
 
 		agf->agf_flfirst = 0;
-		agf->agf_fllast = cpu_to_be32(i - 1);
-		agf->agf_flcount = cpu_to_be32(i);
-		rmap_store_agflcount(mp, agno, i);
+		agf->agf_fllast = cpu_to_be32(agfl_idx - 1);
+		agf->agf_flcount = cpu_to_be32(agfl_idx);
+		rmap_store_agflcount(mp, agno, agfl_idx);
 
 #ifdef XR_BLD_FREE_TRACE
 		fprintf(stderr, "writing agfl for ag %u\n", agno);