Re: [PATCH] btrfs: Fix -Wunused-but-set-variable warnings

From: Joe Perches
Date: Fri May 31 2019 - 16:09:29 EST


On Fri, 2019-05-31 at 22:53 +0300, Andrey Abramov wrote:
> Fix -Wunused-but-set-variable warnings in raid56.c and sysfs.c files

trivia:

> diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
> index f3d0576dd327..4ab29eacfdf3 100644
> --- a/fs/btrfs/raid56.c
> +++ b/fs/btrfs/raid56.c
> @@ -1182,22 +1182,17 @@ static noinline void finish_rmw(struct btrfs_raid_bio *rbio)
> int nr_data = rbio->nr_data;
> int stripe;
> int pagenr;
> - int p_stripe = -1;
> - int q_stripe = -1;
> + int is_q_stripe = 0;

These uses seem boolean, so perhaps just use bool?

> + if (rbio->real_stripes - rbio->nr_data == 2)
> + is_q_stripe = 1;
[]
> @@ -1241,7 +1236,7 @@ static noinline void finish_rmw(struct btrfs_raid_bio *rbio)
[]
> + if (is_q_stripe) {
> @@ -2340,8 +2335,7 @@ static noinline void finish_parity_scrub(struct btrfs_raid_bio *rbio,
[]
> + int is_q_stripe = 0;
> @@ -2351,14 +2345,10 @@ static noinline void finish_parity_scrub(struct btrfs_raid_bio *rbio,
> + if (rbio->real_stripes - rbio->nr_data == 2)
> + is_q_stripe = 1;
[]
> @@ -2380,7 +2370,7 @@ static noinline void finish_parity_scrub(struct btrfs_raid_bio *rbio,
[]
> + if (is_q_stripe) {