Re: [PATCH] fs/fscache: remove spin_lock() from the condition in while()

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

 



Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> wrote:

> The spinlock() within the condition in while() will cause a compile error
> if it is not a function. This is not a problem on mainline but it does not
> look pretty and there is no reason to do it that way.
> That patch writes it a little differently and avoids the double condition.

You've done it less prettily.  I would recommend: put the spin_lock() before
the loop and duplicate it just inside the loop's closing brace.  The optimiser
will merge them.  This means the loop condition is still in the loop
statement.

Also, I would recommend against using "do ... while(1)".  Better to use
"for(;;) ..." or "while(1) ..." so that the fact that it's an "infinite loop"
is up front.

Further, you've got an extra space between "do" and "{".

David

--
Linux-cachefs mailing list
Linux-cachefs@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/linux-cachefs




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]
  Powered by Linux