md/raid5: Refactor raid5_get_active_stripe()
authorLogan Gunthorpe <logang@deltatee.com>
Wed, 27 Jul 2022 21:05:56 +0000 (15:05 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 3 Aug 2022 03:08:53 +0000 (21:08 -0600)
commit5165ed40a1f0a3bf03526aad96df736556fbe64f
tree196364faeaaa36f25159d7be76e055daf4ce4550
parentc55ddd9082f757050183bd0e215aab3af3fc225f
md/raid5: Refactor raid5_get_active_stripe()

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: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/raid5.c