• NeilBrown's avatar
    md/raid5: avoid reading from known bad blocks. · 31c176ec
    NeilBrown authored
    There are two times that we might read in raid5:
    1/ when a read request fits within a chunk on a single
       working device.
       In this case, if there is any bad block in the range of
       the read, we simply fail the cache-bypass read and
       perform the read though the stripe cache.
    
    2/ when reading into the stripe cache.  In this case we
       mark as failed any device which has a bad block in that
       strip (1 page wide).
       Note that we will both avoid reading and avoid writing.
       This is correct (as we will never read from the block, there
       is no point writing), but not optimal (as writing could 'fix'
       the error) - that will be addressed later.
    
    If we have not seen any write errors on the device yet, we treat a bad
    block like a recent read error.  This will encourage an attempt to fix
    the read error which will either generate a write error, or will
    ensure good data is stored there.  We don't yet forget the bad block
    in that case.  That comes later.
    
    Now that we honour bad blocks when reading we can allow devices with
    bad blocks into the array.
    Signed-off-by: default avatarNeilBrown <neilb@suse.de>
    31c176ec
raid5.c 156 KB