[dm-devel] [PATCH V2 3/6] multipathd: Occasionally allow waiters to interrupt checking paths
Wu Guanghao
wuguanghao3 at huawei.com
Wed Aug 24 02:47:23 UTC 2022
在 2022/8/23 2:11, Martin Wilck 写道:
> On Mon, 2022-08-22 at 12:46 -0500, Benjamin Marzinski wrote:
>> On Mon, Aug 22, 2022 at 04:15:01PM +0000, Martin Wilck wrote:
>>>
>>>> + if (i >= VECTOR_SIZE(vecs-
>>>>> pathvec))
>>>> + i = VECTOR_SIZE(vecs-
>>>>> pathvec) - 1;
>>>
>>> What if VECTOR_SIZE(vecs->pathvec) == 0? Maybe you should catch
>>> that in
>>> the while () condition above?
>>
>> I could for clarity if you want, but the code is correct as is. If
>> VECTOR_SIZE() is 0, then i will start at -1. This will cause the
>> while()
>> loop to immediately exit, since VECTOR_SLOT() checks for i < 0. Right
>> after the while loop, i gets bumped up to start checking at the first
>> device (which of course isn't there). It's the same logic as what
>> happens if the while() loop searches through the entire pathvec, and
>> doesn't find any checked paths. Obviously, the empty vector case
>> does a
>> bit of unnecessary work after finding out that the vector is empty,
>> and
>> I could add something like
>>
>> if (VECTOR_SIZE(vecs->pathvec) == 0) {
>> checker_state = CHECKER_FINISHED;
>> goto unlock;
>> }
>>
>> If you'd prefer.
>
> No, it's fine. I realized that your code was correct after I'd hit
> "Send" :-/
>
> Wu Guanghaho, have you already some results to report?
>
The test environment is not ready, it may take next week to have results.
> Martin
>
>
> .
>
More information about the dm-devel
mailing list