Re: [PATCH 1/5] md/raid5: Refactor raid5_get_active_stripe()

From: Logan Gunthorpe
Date: Mon Aug 01 2022 - 07:48:06 EST




On July 29, 2022 7:48:48 PM ADT, Song Liu <song@xxxxxxxxxx> wrote:
>On Thu, Jul 28, 2022 at 7:13 AM Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
>>
>> On Wed, Jul 27, 2022 at 03:05:56PM -0600, Logan Gunthorpe wrote:
>> > 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.
>>
>> I find the new loop even more confusing than the old one. I'd go
>> with something like the version below (on top of the whol md-next tree
>> that pulled this in way too fast..)
>
>This looks good to me. Christoph, would you mind send official patch
>for this?
>
>Thanks,
>Song

I'm on vacation this week, but I'd be happy to send patches addressing Christoph's feedback when I'm back next week.

Thanks,

Logan