From: Arshad Hussain Date: Mon, 29 May 2023 07:31:26 +0000 (-0400) Subject: LU-16796 libcfs: Remove reference to LASSERT_ATOMIC_GT_LT X-Git-Tag: 2.15.57~37 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=5cc0c6b2630e955ee8a2e5c00f9837729f69c8f8;p=fs%2Flustre-release.git LU-16796 libcfs: Remove reference to LASSERT_ATOMIC_GT_LT This patch removes all reference to LASSERT_ATOMIC_GT_LT macro. Signed-off-by: Arshad Hussain Change-Id: I9acf820b32855e54369c18470fb1b73d7f08c41a Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51157 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Neil Brown Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/libcfs/include/libcfs/libcfs_private.h b/libcfs/include/libcfs/libcfs_private.h index c4c90ed..53ff128 100644 --- a/libcfs/include/libcfs/libcfs_private.h +++ b/libcfs/include/libcfs/libcfs_private.h @@ -254,17 +254,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 */ diff --git a/lustre/include/lustre_log.h b/lustre/include/lustre_log.h index 248a32b..95926eb 100644 --- a/lustre/include/lustre_log.h +++ b/lustre/include/lustre_log.h @@ -398,9 +398,14 @@ static inline struct llog_ctxt *llog_ctxt_get(struct llog_ctxt *ctxt) static inline void llog_ctxt_put(struct llog_ctxt *ctxt) { - if (ctxt == NULL) + int refcount; + + if (!ctxt) return; - LASSERT_ATOMIC_GT_LT(&ctxt->loc_refcount, 0, LI_POISON); + + refcount = atomic_read(&ctxt->loc_refcount); + LASSERT(refcount > 0 && refcount < LI_POISON); + CDEBUG(D_INFO, "PUTting ctxt %p : new refcount %d\n", ctxt, atomic_read(&ctxt->loc_refcount) - 1); __llog_ctxt_put(NULL, ctxt); diff --git a/lustre/ldlm/ldlm_resource.c b/lustre/ldlm/ldlm_resource.c index 6fed024e..e41ef8a 100644 --- a/lustre/ldlm/ldlm_resource.c +++ b/lustre/ldlm/ldlm_resource.c @@ -1604,9 +1604,12 @@ static void __ldlm_resource_putref_final(struct cfs_hash_bd *bd, int ldlm_resource_putref(struct ldlm_resource *res) { struct ldlm_namespace *ns = ldlm_res_to_ns(res); - struct cfs_hash_bd bd; + 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);