md/raid56: Don't perform reads to support writes until stripe is ready.
authorNeilBrown <neilb@suse.de>
Wed, 28 May 2014 03:39:22 +0000 (13:39 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 29 May 2014 06:59:46 +0000 (16:59 +1000)
commit67f455486d2ea20b2d94d6adf5b9b783d079e321
tree320f360d77b56f03c754b29fa617d61d25d40ec4
parentbd8839e03b8e70fbbe08bbff70d8cba95273c823
md/raid56: Don't perform reads to support writes until stripe is ready.

If it is found that we need to pre-read some blocks before a write
can succeed, we normally set STRIPE_DELAYED and don't actually perform
the read until STRIPE_PREREAD_ACTIVE subsequently gets set.

However for a degraded RAID6 we currently perform the reads as soon
as we see that a write is pending.  This significantly hurts
throughput.

So:
 - when handle_stripe_dirtying find a block that it wants on a device
   that is failed, set STRIPE_DELAY, instead of doing nothing, and
 - when fetch_block detects that a read might be required to satisfy a
   write, only perform the read if STRIPE_PREREAD_ACTIVE is set,
   and if we would actually need to read something to complete the write.

This also helps RAID5, though less often as RAID5 supports a
read-modify-write cycle.  For RAID5 the read is performed too early
only if the write is not a full 4K aligned write (i.e. no an
R5_OVERWRITE).

Also clean up a couple of horrible bits of formatting.

Reported-by: Patrik HornĂ­k <patrik@dsl.sk>
Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/raid5.c