]> 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)
commit3f5093765980a49c4d2d41f153b9147470030ede
tree196364faeaaa36f25159d7be76e055daf4ce4550
parent5f9d88bbae22ad0024fc4134910303ef847fcf6d
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