[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <ce2dbec5-00f8-831b-3138-cc4f3b8fdb51@linuxfoundation.org>
Date: Fri, 2 Oct 2020 16:34:40 -0600
From: Shuah Khan <skhan@...uxfoundation.org>
To: idryomov@...il.com, dongsheng.yang@...ystack.cn, axboe@...nel.dk
Cc: ceph-devel@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Shuah Khan <skhan@...uxfoundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Kees Cook <keescook@...omium.org>
Subject: drivers/block/rbd.c: atomic_inc_return_safe() &
atomic_dec_return_safe()
All,
I came across these atomic_inc_return_safe() & atomic_dec_return_safe()
functions that hold the counters at safe values.
atomic_inc_return_safe()
If the counter is already 0 it will not be incremented.
If the counter is already at its maximum value returns
-EINVAL without updating it.
atomic_dec_return_safe()
Decrement the counter. Return the resulting value, or -EINVAL
These two routines are static and only used in rbd.c.
Can these become part of atomic_t ops?
thanks,
-- Shuah
Powered by blists - more mailing lists