Commit 9502a7f6 authored by Alexander Aring's avatar Alexander Aring Committed by David Teigland

dlm: use kref_put_lock in put_rsb

This patch will optimize put_rsb() by using kref_put_lock(). The
function kref_put_lock() will only take the lock if the reference is
going to be zero, if not the lock will never be held.
Signed-off-by: default avatarAlexander Aring <aahringo@redhat.com>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent 0ccc1060
...@@ -350,10 +350,12 @@ static void put_rsb(struct dlm_rsb *r) ...@@ -350,10 +350,12 @@ static void put_rsb(struct dlm_rsb *r)
{ {
struct dlm_ls *ls = r->res_ls; struct dlm_ls *ls = r->res_ls;
uint32_t bucket = r->res_bucket; uint32_t bucket = r->res_bucket;
int rv;
spin_lock(&ls->ls_rsbtbl[bucket].lock); rv = kref_put_lock(&r->res_ref, toss_rsb,
kref_put(&r->res_ref, toss_rsb); &ls->ls_rsbtbl[bucket].lock);
spin_unlock(&ls->ls_rsbtbl[bucket].lock); if (rv)
spin_unlock(&ls->ls_rsbtbl[bucket].lock);
} }
void dlm_put_rsb(struct dlm_rsb *r) void dlm_put_rsb(struct dlm_rsb *r)
......
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