Whamcloud - gitweb
b=24188 rehash patch makes oops in quota_search_lqs
[fs/lustre-release.git] / lustre / include / lustre_quota.h
index 1e12858..a153d6b 100644 (file)
@@ -397,39 +397,25 @@ struct lustre_qunit_size {
 #define LQS_KEY_ID(key)      (key & 0xffffffff)
 #define LQS_KEY_GRP(key)     (key >> 32)
 
 #define LQS_KEY_ID(key)      (key & 0xffffffff)
 #define LQS_KEY_GRP(key)     (key >> 32)
 
-static inline void __lqs_getref(struct lustre_qunit_size *lqs)
+static inline void lqs_getref(struct lustre_qunit_size *lqs)
 {
         int count = cfs_atomic_inc_return(&lqs->lqs_refcount);
 
 {
         int count = cfs_atomic_inc_return(&lqs->lqs_refcount);
 
-        if (count == 2) /* quota_create_lqs */
-                cfs_atomic_inc(&lqs->lqs_ctxt->lqc_lqs);
         CDEBUG(D_INFO, "lqs=%p refcount %d\n", lqs, count);
 }
 
         CDEBUG(D_INFO, "lqs=%p refcount %d\n", lqs, count);
 }
 
-static inline void lqs_getref(struct lustre_qunit_size *lqs)
+static inline void lqs_putref(struct lustre_qunit_size *lqs)
 {
 {
-        __lqs_getref(lqs);
-}
+        int count = cfs_atomic_read(&lqs->lqs_refcount);
 
 
-static inline void __lqs_putref(struct lustre_qunit_size *lqs)
-{
-        LASSERT(cfs_atomic_read(&lqs->lqs_refcount) > 0);
+        LASSERT(count > 0);
+        CDEBUG(D_INFO, "lqs=%p refcount %d\n", lqs, count - 1);
 
 
-        if (cfs_atomic_dec_return(&lqs->lqs_refcount) == 1)
+        if (cfs_atomic_dec_and_test(&lqs->lqs_refcount)) {
                 if (cfs_atomic_dec_and_test(&lqs->lqs_ctxt->lqc_lqs))
                         cfs_waitq_signal(&lqs->lqs_ctxt->lqc_lqs_waitq);
                 if (cfs_atomic_dec_and_test(&lqs->lqs_ctxt->lqc_lqs))
                         cfs_waitq_signal(&lqs->lqs_ctxt->lqc_lqs_waitq);
-        CDEBUG(D_INFO, "lqs=%p refcount %d\n",
-               lqs, cfs_atomic_read(&lqs->lqs_refcount));
-}
-
-static inline void lqs_putref(struct lustre_qunit_size *lqs)
-{
-        __lqs_putref(lqs);
-}
-
-static inline void lqs_initref(struct lustre_qunit_size *lqs)
-{
-        cfs_atomic_set(&lqs->lqs_refcount, 0);
+                OBD_FREE_PTR(lqs);
+        }
 }
 
 #else
 }
 
 #else