Skip to content

Commit

Permalink
md/raid5: avoid reading parity blocks for full-stripe write to degrad…
Browse files Browse the repository at this point in the history
…ed array

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: ea664c8 ("md/raid5: need_this_block: tidy/fix last condition.")
  • Loading branch information
NeilBrown committed May 8, 2015
1 parent b0c783b commit 10d82c5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 10d82c5

Please sign in to comment.