@@ -286,10 +286,14 @@ static inline struct llog_ctxt *llog_ctxt_get(struct llog_ctxt *ctxt)
static inline void llog_ctxt_put(struct llog_ctxt *ctxt)
{
+ int refcount;
+
if (!ctxt)
return;
- LASSERT(refcount_read(&ctxt->loc_refcount) > 0);
- LASSERT(refcount_read(&ctxt->loc_refcount) < LI_POISON);
+
+ refcount = refcount_read(&ctxt->loc_refcount);
+ LASSERT(refcount > 0 && refcount < LI_POISON);
+
CDEBUG(D_INFO, "PUTting ctxt %p : new refcount %d\n", ctxt,
refcount_read(&ctxt->loc_refcount) - 1);
__llog_ctxt_put(NULL, ctxt);
@@ -1220,8 +1220,11 @@ void ldlm_resource_putref(struct ldlm_resource *res)
{
struct ldlm_namespace *ns = ldlm_res_to_ns(res);
struct cfs_hash_bd bd;
+ int refcount;
+
+ refcount = atomic_read(&res->lr_refcount);
+ LASSERT(refcount > 0 && refcount < LI_POISON);
- LASSERT_ATOMIC_GT_LT(&res->lr_refcount, 0, LI_POISON);
CDEBUG(D_INFO, "putref res: %p count: %d\n",
res, atomic_read(&res->lr_refcount) - 1);
@@ -112,17 +112,9 @@ int libcfs_debug_mark_buffer(const char *text);
#define LASSERT_ATOMIC_EQ(a, v) \
LASSERTF(atomic_read(a) == v, "value: %d\n", atomic_read((a)))
-/** assert value of @a is great than @v1 and little than @v2 */
-#define LASSERT_ATOMIC_GT_LT(a, v1, v2) \
-do { \
- int __v = atomic_read(a); \
- LASSERTF(__v > v1 && __v < v2, "value: %d\n", __v); \
-} while (0)
-
#else /* !LASSERT_ATOMIC_ENABLED */
#define LASSERT_ATOMIC_EQ(a, v) do {} while (0)
-#define LASSERT_ATOMIC_GT_LT(a, v1, v2) do {} while (0)
#endif /* LASSERT_ATOMIC_ENABLED */