Commit dab7711f authored by Johannes Weiner's avatar Johannes Weiner Committed by Andrew Morton

mm: zswap: clean up zswap_entry_put()

Remove stale comment and unnecessary local variable.

Link: https://lkml.kernel.org/r/20240130014208.565554-6-hannes@cmpxchg.orgSigned-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
Acked-by: default avatarYosry Ahmed <yosryahmed@google.com>
Reviewed-by: default avatarNhat Pham <nphamcs@gmail.com>
Reviewed-by: default avatarChengming Zhou <zhouchengming@bytedance.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent e477559c
...@@ -545,15 +545,11 @@ static void zswap_entry_get(struct zswap_entry *entry) ...@@ -545,15 +545,11 @@ static void zswap_entry_get(struct zswap_entry *entry)
entry->refcount++; entry->refcount++;
} }
/* caller must hold the tree lock /* caller must hold the tree lock */
* remove from the tree and free it, if nobody reference the entry
*/
static void zswap_entry_put(struct zswap_entry *entry) static void zswap_entry_put(struct zswap_entry *entry)
{ {
int refcount = --entry->refcount; WARN_ON_ONCE(!entry->refcount);
if (--entry->refcount == 0) {
WARN_ON_ONCE(refcount < 0);
if (refcount == 0) {
WARN_ON_ONCE(!RB_EMPTY_NODE(&entry->rbnode)); WARN_ON_ONCE(!RB_EMPTY_NODE(&entry->rbnode));
zswap_entry_free(entry); zswap_entry_free(entry);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment