Thread (36 messages) 36 messages, 6 authors, 2021-12-10

Re: [PATCH] block: switch to atomic_t for request references

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2021-12-07 17:45:50
Also in: lkml

On Tue, Dec 7, 2021 at 9:43 AM Linus Torvalds
[off-list ref] wrote:
In the case of "dec_and_test" the "decrement to zero" case may not be
hugely exceptional, but if you do the same for "increment with
overflow protection" you do end up having the two different "zero vs
too big", so it would actually be more consistent, I think..
Hmm.. Of course, that "increment with overflow protection" might not
actually want two targets in the first place, so maybe this argument
is BS.

Particularly if you can do the "zero or overflow" case with just one
test, maybe you really do want both cases to be one single error case.

And then your "refcount_dec_and_test()" with a return value (for
decrement to zero) and a separate error case (for errors) looks fine.

               Linus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help