* [PATCH] btrfs: remove redundant stop_loop variable in scrub_stripe()
@ 2024-09-26 7:50 Riyan Dhiman
2024-09-26 9:50 ` Filipe Manana
2024-10-01 15:42 ` David Sterba
0 siblings, 2 replies; 3+ messages in thread
From: Riyan Dhiman @ 2024-09-26 7:50 UTC (permalink / raw)
To: clm, josef, dsterba; +Cc: linux-btrfs, linux-kernel, Riyan Dhiman
The variable stop_loop was originally introduced in commit
625f1c8dc66d7 (Btrfs: improve the loop of scrub_stripe). It was initialized
to 0 in commit 3b080b2564287 (Btrfs: scrub raid56 stripes in the right way).
However, in a later commit 18d30ab961497 (btrfs: scrub: use scrub_simple_mirror()
to handle RAID56 data stripe scrub), the code that modified stop_loop was removed,
making the variable redundant.
Currently, stop_loop is only initialized with 0 and is never used or modified
within the scrub_stripe() function. As a result, this patch removes the
stop_loop variable to clean up the code and eliminate unnecessary redundancy.
This change has no impact on functionality, as stop_loop was never utilized
in any meaningful way in the final version of the code.
Signed-off-by: Riyan Dhiman <riyandhiman14@gmail.com>
---
Compile tested only
fs/btrfs/scrub.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 3a3427428074..43431065d981 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -2256,7 +2256,6 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
/* Offset inside the chunk */
u64 offset;
u64 stripe_logical;
- int stop_loop = 0;
/* Extent_path should be released by now. */
ASSERT(sctx->extent_path.nodes[0] == NULL);
@@ -2370,14 +2369,8 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
logical += increment;
physical += BTRFS_STRIPE_LEN;
spin_lock(&sctx->stat_lock);
- if (stop_loop)
- sctx->stat.last_physical =
- map->stripes[stripe_index].physical + dev_stripe_len;
- else
- sctx->stat.last_physical = physical;
+ sctx->stat.last_physical = physical;
spin_unlock(&sctx->stat_lock);
- if (stop_loop)
- break;
}
out:
ret2 = flush_scrub_stripes(sctx);
--
2.46.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: remove redundant stop_loop variable in scrub_stripe()
2024-09-26 7:50 [PATCH] btrfs: remove redundant stop_loop variable in scrub_stripe() Riyan Dhiman
@ 2024-09-26 9:50 ` Filipe Manana
2024-10-01 15:42 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: Filipe Manana @ 2024-09-26 9:50 UTC (permalink / raw)
To: Riyan Dhiman; +Cc: clm, josef, dsterba, linux-btrfs, linux-kernel
On Thu, Sep 26, 2024 at 8:51 AM Riyan Dhiman <riyandhiman14@gmail.com> wrote:
>
> The variable stop_loop was originally introduced in commit
> 625f1c8dc66d7 (Btrfs: improve the loop of scrub_stripe). It was initialized
> to 0 in commit 3b080b2564287 (Btrfs: scrub raid56 stripes in the right way).
> However, in a later commit 18d30ab961497 (btrfs: scrub: use scrub_simple_mirror()
> to handle RAID56 data stripe scrub), the code that modified stop_loop was removed,
> making the variable redundant.
>
> Currently, stop_loop is only initialized with 0 and is never used or modified
> within the scrub_stripe() function. As a result, this patch removes the
> stop_loop variable to clean up the code and eliminate unnecessary redundancy.
>
> This change has no impact on functionality, as stop_loop was never utilized
> in any meaningful way in the final version of the code.
>
> Signed-off-by: Riyan Dhiman <riyandhiman14@gmail.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Looks good, thanks.
> ---
> Compile tested only
>
> fs/btrfs/scrub.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index 3a3427428074..43431065d981 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -2256,7 +2256,6 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
> /* Offset inside the chunk */
> u64 offset;
> u64 stripe_logical;
> - int stop_loop = 0;
>
> /* Extent_path should be released by now. */
> ASSERT(sctx->extent_path.nodes[0] == NULL);
> @@ -2370,14 +2369,8 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
> logical += increment;
> physical += BTRFS_STRIPE_LEN;
> spin_lock(&sctx->stat_lock);
> - if (stop_loop)
> - sctx->stat.last_physical =
> - map->stripes[stripe_index].physical + dev_stripe_len;
> - else
> - sctx->stat.last_physical = physical;
> + sctx->stat.last_physical = physical;
> spin_unlock(&sctx->stat_lock);
> - if (stop_loop)
> - break;
> }
> out:
> ret2 = flush_scrub_stripes(sctx);
> --
> 2.46.1
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: remove redundant stop_loop variable in scrub_stripe()
2024-09-26 7:50 [PATCH] btrfs: remove redundant stop_loop variable in scrub_stripe() Riyan Dhiman
2024-09-26 9:50 ` Filipe Manana
@ 2024-10-01 15:42 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2024-10-01 15:42 UTC (permalink / raw)
To: Riyan Dhiman; +Cc: clm, josef, dsterba, linux-btrfs, linux-kernel
On Thu, Sep 26, 2024 at 01:20:34PM +0530, Riyan Dhiman wrote:
> The variable stop_loop was originally introduced in commit
> 625f1c8dc66d7 (Btrfs: improve the loop of scrub_stripe). It was initialized
> to 0 in commit 3b080b2564287 (Btrfs: scrub raid56 stripes in the right way).
> However, in a later commit 18d30ab961497 (btrfs: scrub: use scrub_simple_mirror()
> to handle RAID56 data stripe scrub), the code that modified stop_loop was removed,
> making the variable redundant.
>
> Currently, stop_loop is only initialized with 0 and is never used or modified
> within the scrub_stripe() function. As a result, this patch removes the
> stop_loop variable to clean up the code and eliminate unnecessary redundancy.
>
> This change has no impact on functionality, as stop_loop was never utilized
> in any meaningful way in the final version of the code.
>
> Signed-off-by: Riyan Dhiman <riyandhiman14@gmail.com>
Added to for-next, thanks. Adding the references when the code was added
or last used is great, I slightly updated the references as it's common
to use the same formatting like the Fixes: tag which puts the subject to
("...").
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-01 15:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-26 7:50 [PATCH] btrfs: remove redundant stop_loop variable in scrub_stripe() Riyan Dhiman
2024-09-26 9:50 ` Filipe Manana
2024-10-01 15:42 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox