From 146676af22f226ddd8b5eb09d509e831123cc4ea Mon Sep 17 00:00:00 2001 From: tianzy Date: Thu, 22 Oct 2009 05:39:31 +0000 Subject: [PATCH] Branch HEAD clean the code relative to lqs_refcount b=18782 i=johann i=panda --- lustre/include/lustre_quota.h | 31 +++++++++---------------------- lustre/quota/quota_context.c | 2 +- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/lustre/include/lustre_quota.h b/lustre/include/lustre_quota.h index 3222ca3..5f92a78 100644 --- a/lustre/include/lustre_quota.h +++ b/lustre/include/lustre_quota.h @@ -381,33 +381,20 @@ static inline void lqs_getref(struct lustre_qunit_size *lqs) __lqs_getref(lqs); } -static inline void __lqs_putref(struct lustre_qunit_size *lqs, int del) +static inline void __lqs_putref(struct lustre_qunit_size *lqs) { - int count = atomic_read(&lqs->lqs_refcount); - - LASSERT(count > 0); - if (count == 1) { - CDEBUG(D_QUOTA, "lqs=%p refcount to be 0\n", lqs); - if (del) { - /* killing last ref, let's let hash table kill it */ - lustre_hash_del(lqs->lqs_ctxt->lqc_lqs_hash, - &lqs->lqs_key, &lqs->lqs_hash); - OBD_FREE_PTR(lqs); - } else { - atomic_dec(&lqs->lqs_refcount); - } - } else { - count = atomic_dec_return(&lqs->lqs_refcount); - if (count == 1) - if (atomic_dec_and_test(&lqs->lqs_ctxt->lqc_lqs)) - cfs_waitq_signal(&lqs->lqs_ctxt->lqc_lqs_waitq); - CDEBUG(D_QUOTA, "lqs=%p refcount %d\n", lqs, count); - } + LASSERT(atomic_read(&lqs->lqs_refcount) > 0); + + if (atomic_dec_return(&lqs->lqs_refcount) == 1) + if (atomic_dec_and_test(&lqs->lqs_ctxt->lqc_lqs)) + cfs_waitq_signal(&lqs->lqs_ctxt->lqc_lqs_waitq); + CDEBUG(D_QUOTA, "lqs=%p refcount %d\n", + lqs, atomic_read(&lqs->lqs_refcount)); } static inline void lqs_putref(struct lustre_qunit_size *lqs) { - __lqs_putref(lqs, 1); + __lqs_putref(lqs); } static inline void lqs_initref(struct lustre_qunit_size *lqs) diff --git a/lustre/quota/quota_context.c b/lustre/quota/quota_context.c index e65bfaf..9dd70e8 100644 --- a/lustre/quota/quota_context.c +++ b/lustre/quota/quota_context.c @@ -1594,7 +1594,7 @@ lqs_put(struct hlist_node *hnode) hlist_entry(hnode, struct lustre_qunit_size, lqs_hash); ENTRY; - __lqs_putref(q, 0); + __lqs_putref(q); RETURN(q); } -- 1.8.3.1