Skip to contentSkip to conversation

btrfs: Remove dead code

PATCH In review Muhammad Usama Anjum 2 participants 2 messages Jan 28, 2022 – Feb 1, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: Remove dead code

Local variable stop_loop is assigned only once, to a constant value 0, making it effectively constant through out its scope. This constant variable is guarding deadcode. The two if conditions can never be true. Remove the variable and make the logic simple.

Fixes 585f784357d8 ("btrfs: use scrub_simple_mirror() to handle RAID56 data stripe scrub")
---
 fs/btrfs/scrub.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
fs/btrfs/scrub.c +1 -8
index 4baa8e43d585b..26bbe93c3aa3c 100644
@@ -3533,7 +3533,6 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
 	u64 offset;	/* Offset inside the chunk */
 	u64 stripe_logical;
 	u64 stripe_end;
-	int stop_loop = 0;
 
 	path = btrfs_alloc_path();
 	if (!path)
@@ -3652,14 +3651,8 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
 		logical += increment;
 		physical += map->stripe_len;
 		spin_lock(&sctx->stat_lock);
-		if (stop_loop)
-			sctx->stat.last_physical = map->stripes[stripe_index].physical +
-						   dev_extent_len;
-		else
-			sctx->stat.last_physical = physical;
+		sctx->stat.last_physical = physical;
 		spin_unlock(&sctx->stat_lock);
-		if (stop_loop)
-			break;
 	}
 out:
 	/* push queued extents */
Signature · 1 line
2.30.2
#1 lore raw
Quoted 6 lines · Muhammad Usama Anjum

Local variable stop_loop is assigned only once, to a constant value 0, making it effectively constant through out its scope. This constant variable is guarding deadcode. The two if conditions can never be true. Remove the variable and make the logic simple.

Fixes 585f784357d8 ("btrfs: use scrub_simple_mirror() to handle RAID56 data stripe scrub")

Thanks, this patch is still only in for-next so the change can be folded into it.