Re: [PATCH V2 3/6] multipathd: Occasionally allow waiters to interrupt checking paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

Martin


--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux