• Logan Gunthorpe's avatar
    md/raid5: Refactor raid5_get_active_stripe() · 5165ed40
    Logan Gunthorpe authored
    Refactor the raid5_get_active_stripe() to read more linearly in
    the order it's typically executed.
    
    The init_stripe() call is called if a free stripe is found and the
    function is exited early which removes a lot of if (sh) checks and
    unindents the following code.
    
    Remove the while loop in favour of the 'goto retry' pattern, which
    reduces indentation further. And use a 'goto wait_for_stripe' instead
    of an additional indent seeing it is the unusual path and this makes
    the code easier to read.
    
    No functional changes intended. Will make subsequent changes
    in patches easier to understand.
    Signed-off-by: default avatarLogan Gunthorpe <logang@deltatee.com>
    Signed-off-by: default avatarSong Liu <song@kernel.org>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    5165ed40
raid5.c 254 KB