Skip to contentSkip to conversation

md/raid5: remove unused working_disks variable

PATCH Superseded Tom Rix 2 participants 2 messages Mar 26, 2023 – Mar 27, 2023 MD RAID

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 md/raid5: remove unused working_disks variable

clang with W=1 reports
drivers/md/raid5.c:7719:6: error: variable 'working_disks'
set but not used [-Werror,-Wunused-but-set-variable]

        int working_disks = 0;
            ^

This variable is not used so remove it.

---
 drivers/md/raid5.c | 2 --
 1 file changed, 2 deletions(-)
drivers/md/raid5.c +0 -2
index 7b820b81d8c2..2b1e78c46817 100644
@@ -7716,7 +7716,6 @@ static void raid5_set_io_opt(struct r5conf *conf)
 static int raid5_run(struct mddev *mddev)
 {
 	struct r5conf *conf;
-	int working_disks = 0;
 	int dirty_parity_disks = 0;
 	struct md_rdev *rdev;
 	struct md_rdev *journal_dev = NULL;
@@ -7913,7 +7912,6 @@ static int raid5_run(struct mddev *mddev)
 			goto abort;
 		}
 		if (test_bit(In_sync, &rdev->flags)) {
-			working_disks++;
 			continue;
 		}
 		/* This disc is not fully in-sync.  However if it
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 6 lines · Tom Rix

clang with W=1 reports
drivers/md/raid5.c:7719:6: error: variable 'working_disks'
set but not used [-Werror,-Wunused-but-set-variable]

         int working_disks = 0;
             ^

This variable is not used so remove it.

Other than some nits below, this patch looks good to me, feel free to add:

Please also mention that commit 908f4fbd2657 ("md/raid5: be more thorough in calculating 'degraded' value.") remove the last reference.

Quoted 19 lines
---
  drivers/md/raid5.c | 2 --
  1 file changed, 2 deletions(-)
drivers/md/raid5.c +0 -1
index 7b820b81d8c2..2b1e78c46817 100644
@@ -7716,7 +7716,6 @@ static void raid5_set_io_opt(struct r5conf *conf)
  static int raid5_run(struct mddev *mddev)
  {
  	struct r5conf *conf;
-	int working_disks = 0;
  	int dirty_parity_disks = 0;
  	struct md_rdev *rdev;
  	struct md_rdev *journal_dev = NULL;

drivers/md/raid5.c static int raid5_run(struct mddev *mddev) · line 7916

Quoted 4 lines
drivers/md/raid5.c +0 -1
@@ -7913,7 +7912,6 @@ static int raid5_run(struct mddev *mddev)
  			goto abort;
  		}
  		if (test_bit(In_sync, &rdev->flags)) {
-			working_disks++;

Please remove the braces as well,

Thanks,
Kuai

Quoted 4 lines
drivers/md/raid5.c +0 -0
  			continue;
  		}
  		/* This disc is not fully in-sync.  However if it