md/raid5: Refactor raid5_get_active_stripe()
authorLogan Gunthorpe <logang@deltatee.com>
Wed, 27 Jul 2022 21:05:56 +0000 (15:05 -0600)
committerSong Liu <song@kernel.org>
Thu, 28 Jul 2022 05:50:46 +0000 (22:50 -0700)
commitd0a27dfc7f293c581cfc260e6e1745eb3d009e5d
tree77ee563fa9680ebdb8bce33334626895ca4e3aa5
parentc9ca8dcc66a99d1123f0fdc2dc161436b93d194b
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>
drivers/md/raid5.c