]> git.baikalelectronics.ru Git - kernel.git/commitdiff
md/raid5: avoid reading parity blocks for full-stripe write to degraded array
authorNeilBrown <neilb@suse.de>
Fri, 8 May 2015 08:19:33 +0000 (18:19 +1000)
committerNeilBrown <neilb@suse.de>
Fri, 8 May 2015 08:47:17 +0000 (18:47 +1000)
When performing a reconstruct write, we need to read all blocks
that are not being over-written .. except the parity (P and Q) blocks.

The code currently reads these (as they are not being over-written!)
unnecessarily.

Signed-off-by: NeilBrown <neilb@suse.de>
Fixes: 5404a365aabd ("md/raid5: need_this_block: tidy/fix last condition.")
drivers/md/raid5.c

index 415cac6d89bd71905fedb615c13329effac92690..85dc0e67fb883d24183a1f5c18793288235409ec 100644 (file)
@@ -3282,7 +3282,9 @@ static int need_this_block(struct stripe_head *sh, struct stripe_head_state *s,
                /* reconstruct-write isn't being forced */
                return 0;
        for (i = 0; i < s->failed; i++) {
-               if (!test_bit(R5_UPTODATE, &fdev[i]->flags) &&
+               if (s->failed_num[i] != sh->pd_idx &&
+                   s->failed_num[i] != sh->qd_idx &&
+                   !test_bit(R5_UPTODATE, &fdev[i]->flags) &&
                    !test_bit(R5_OVERWRITE, &fdev[i]->flags))
                        return 1;
        }