Whamcloud - gitweb
LU-16796 libcfs: Remove reference to LASSERT_ATOMIC_GT_LT 57/51157/7
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Mon, 29 May 2023 07:31:26 +0000 (03:31 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 19 Jul 2023 16:44:52 +0000 (16:44 +0000)
This patch removes all reference to LASSERT_ATOMIC_GT_LT macro.

Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: I9acf820b32855e54369c18470fb1b73d7f08c41a
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51157
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/include/libcfs/libcfs_private.h
lustre/include/lustre_log.h
lustre/ldlm/ldlm_resource.c

index c4c90ed..53ff128 100644 (file)
@@ -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 */
 
index 248a32b..95926eb 100644 (file)
@@ -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);
index 6fed024..e41ef8a 100644 (file)
@@ -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);