• NeilBrown's avatar
    md/raid56: Don't perform reads to support writes until stripe is ready. · 67f45548
    NeilBrown authored
    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: default avatarPatrik Horník <patrik@dsl.sk>
    Signed-off-by: default avatarNeilBrown <neilb@suse.de>
    67f45548
raid5.c 197 KB