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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 01, 2020 at 09:27:05PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
> ---

Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx>

>  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);
> 




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux