mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
locking/atomic, kref: Add kref_read()
Since we need to change the implementation, stop exposing internals. Provide kref_read() to read the current reference count; typically used for debug messages. Kills two anti-patterns: atomic_read(&kref->refcount) kref->refcount.counter Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
1e24edca05
commit
2c935bc572
56 changed files with 121 additions and 117 deletions
|
@ -198,7 +198,7 @@ static inline struct cache_head *cache_get(struct cache_head *h)
|
|||
|
||||
static inline void cache_put(struct cache_head *h, struct cache_detail *cd)
|
||||
{
|
||||
if (atomic_read(&h->ref.refcount) <= 2 &&
|
||||
if (kref_read(&h->ref) <= 2 &&
|
||||
h->expiry_time < cd->nextcheck)
|
||||
cd->nextcheck = h->expiry_time;
|
||||
kref_put(&h->ref, cd->cache_put);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue