[lustre-devel] [PATCH 22/27] lnet: libcfs: Remove reference to LASSERT_ATOMIC_GT_LT
James Simmons <[email protected]> Fri, 21 Mar 2025 09:07:05 -0400
| Newsgroups | org.lustre.lists.lustre-devel |
|---|---|
| Message-ID | <[email protected]> |
From: Arshad Hussain <[email protected]> This patch removes all reference to LASSERT_ATOMIC_GT_LT macro. WC-bug-id: https://jira.whamcloud.com/browse/LU-16796 Lustre-commit: 5cc0c6b2630e955ee ("LU-16796 libcfs: Remove reference to LASSERT_ATOMIC_GT_LT") Signed-off-by: Arshad Hussain <[email protected]> Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51157 Reviewed-by: Neil Brown <[email protected]> Reviewed-by: James Simmons <[email protected]> Reviewed-by: Oleg Drokin <[email protected]> Signed-off-by: James Simmons <[email protected]> --- fs/lustre/include/lustre_log.h | 8 ++++++-- fs/lustre/ldlm/ldlm_resource.c | 5 ++++- include/linux/libcfs/libcfs_private.h | 8 -------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/fs/lustre/include/lustre_log.h b/fs/lustre/include/lustre_log.h index 1586595399cf..60d451ca1710 100644 --- a/fs/lustre/include/lustre_log.h +++ b/fs/lustre/include/lustre_log.h @@ -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); diff --git a/fs/lustre/ldlm/ldlm_resource.c b/fs/lustre/ldlm/ldlm_resource.c index 7da47976e994..db0f7f169701 100644 --- a/fs/lustre/ldlm/ldlm_resource.c +++ b/fs/lustre/ldlm/ldlm_resource.c @@ -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); diff --git a/include/linux/libcfs/libcfs_private.h b/include/linux/libcfs/libcfs_private.h index d46c66e8534b..0a377f09d6dd 100644 --- a/include/linux/libcfs/libcfs_private.h +++ b/include/linux/libcfs/libcfs_private.h @@ -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 */ -- 2.39.3 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org