• N
    md/raid10: simplify handle_read_error() · 545250f2
    NeilBrown 提交于
    handle_read_error() duplicates a lot of the work that raid10_read_request()
    does, so it makes sense to just use that function.
    
    handle_read_error() relies on the same r10bio being re-used so that,
    in the case of a read-only array, setting IO_BLOCKED in r1bio->devs[].bio
    ensures read_balance() won't re-use that device.
    So when called from raid10_make_request() we clear that array, but not
    when called from handle_read_error().
    
    Two parts of handle_read_error() that need to be preserved are the warning
    message it prints, so they are conditionally added to
    raid10_read_request().  If the failing rdev can be found, messages
    are printed.  Otherwise they aren't.
    
    Not that as rdev_dec_pending() has already been called on the failing
    rdev, we need to use rcu_read_lock() to get a new reference from
    the conf.  We only use this to get the name of the failing block device.
    
    With this change, we no longer need inc_pending().
    Signed-off-by: NNeilBrown <neilb@suse.com>
    Signed-off-by: NShaohua Li <shli@fb.com>
    545250f2
raid10.c 130.4 KB