]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit8a5aec51684aed2478b66da24f8a71e1f022abcc
tree196364faeaaa36f25159d7be76e055daf4ce4550
parente1e124dcfeafad7c92e5d2972e1b8b1136204e66
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