[lustre-devel] [PATCH 31/33] lnet: libcfs: Remove reference to LASSERT_ATOMIC_POS
James Simmons <[email protected]> Sun, 2 Feb 2025 15:46:31 -0500
| Newsgroups | org.lustre.lists.lustre-devel |
|---|---|
| Message-ID | <[email protected]> |
From: Arshad Hussain <[email protected]> This patch removes all reference to LASSERT_ATOMIC_POS macro. Once all the access is removed it would be easier to just toggle atomic_* API calls with recount_* counts. WC-bug-id: https://jira.whamcloud.com/browse/LU-16796 Lustre-commit: 165433bb4ced42560 ("LU-16796 libcfs: Remove reference to LASSERT_ATOMIC_POS") Signed-off-by: Arshad Hussain <[email protected]> Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50881 Reviewed-by: James Simmons <[email protected]> Reviewed-by: Oleg Drokin <[email protected]> Reviewed-by: Andreas Dilger <[email protected]> Reviewed-by: Timothy Day <[email protected]> Reviewed-by: Neil Brown <[email protected]> Signed-off-by: James Simmons <[email protected]> --- fs/lustre/include/obd_class.h | 4 ++-- fs/lustre/ptlrpc/sec.c | 16 ++++++++-------- include/linux/libcfs/libcfs_private.h | 1 - net/lnet/klnds/o2iblnd/o2iblnd.h | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/fs/lustre/include/obd_class.h b/fs/lustre/include/obd_class.h index 06dfcf9bbd9e..f8ae45b6e986 100644 --- a/fs/lustre/include/obd_class.h +++ b/fs/lustre/include/obd_class.h @@ -270,7 +270,7 @@ static inline void class_export_rpc_inc(struct obd_export *exp) static inline void class_export_rpc_dec(struct obd_export *exp) { - LASSERT_ATOMIC_POS(&exp->exp_rpc_count); + LASSERT(atomic_read(&(exp)->exp_rpc_count) > 0); atomic_dec(&(exp)->exp_rpc_count); CDEBUG(D_INFO, "RPC PUTting export %p : new rpc_count %d\n", (exp), atomic_read(&(exp)->exp_rpc_count)); @@ -289,7 +289,7 @@ static inline struct obd_export *class_export_lock_get(struct obd_export *exp, static inline void class_export_lock_put(struct obd_export *exp, struct ldlm_lock *lock) { - LASSERT_ATOMIC_POS(&exp->exp_locks_count); + LASSERT(atomic_read(&(exp)->exp_rpc_count) > 0); atomic_dec(&(exp)->exp_locks_count); __class_export_del_lock_ref(exp, lock); CDEBUG(D_INFO, "lock PUTting export %p : new locks_count %d\n", diff --git a/fs/lustre/ptlrpc/sec.c b/fs/lustre/ptlrpc/sec.c index 7cd09ebe78db..576e6480cda8 100644 --- a/fs/lustre/ptlrpc/sec.c +++ b/fs/lustre/ptlrpc/sec.c @@ -290,7 +290,7 @@ void sptlrpc_cli_ctx_put(struct ptlrpc_cli_ctx *ctx, int sync) struct ptlrpc_sec *sec = ctx->cc_sec; LASSERT(sec); - LASSERT_ATOMIC_POS(&ctx->cc_refcount); + LASSERT(atomic_read(&(ctx)->cc_refcount) > 0); if (!atomic_dec_and_test(&ctx->cc_refcount)) return; @@ -1214,7 +1214,7 @@ static void sec_cop_destroy_sec(struct ptlrpc_sec *sec) static void sptlrpc_sec_kill(struct ptlrpc_sec *sec) { - LASSERT_ATOMIC_POS(&sec->ps_refcount); + LASSERT(atomic_read(&(sec)->ps_refcount) > 0); if (sec->ps_policy->sp_cops->kill_sec) { sec->ps_policy->sp_cops->kill_sec(sec); @@ -1234,7 +1234,7 @@ static struct ptlrpc_sec *sptlrpc_sec_get(struct ptlrpc_sec *sec) void sptlrpc_sec_put(struct ptlrpc_sec *sec) { if (sec) { - LASSERT_ATOMIC_POS(&sec->ps_refcount); + LASSERT(atomic_read(&(sec)->ps_refcount) > 0); if (atomic_dec_and_test(&sec->ps_refcount)) { sptlrpc_gc_del_sec(sec); @@ -1314,7 +1314,7 @@ static void sptlrpc_import_sec_install(struct obd_import *imp, { struct ptlrpc_sec *old_sec; - LASSERT_ATOMIC_POS(&sec->ps_refcount); + LASSERT(atomic_read(&(sec)->ps_refcount) > 0); write_lock(&imp->imp_sec_lock); old_sec = imp->imp_sec; @@ -1507,7 +1507,7 @@ int sptlrpc_cli_alloc_reqbuf(struct ptlrpc_request *req, int msgsize) LASSERT(ctx->cc_sec); LASSERT(ctx->cc_sec->ps_policy); LASSERT(!req->rq_reqmsg); - LASSERT_ATOMIC_POS(&ctx->cc_refcount); + LASSERT(atomic_read(&(ctx)->cc_refcount) > 0); policy = ctx->cc_sec->ps_policy; rc = policy->sp_cops->alloc_reqbuf(ctx->cc_sec, req, msgsize); @@ -1535,7 +1535,7 @@ void sptlrpc_cli_free_reqbuf(struct ptlrpc_request *req) LASSERT(ctx); LASSERT(ctx->cc_sec); LASSERT(ctx->cc_sec->ps_policy); - LASSERT_ATOMIC_POS(&ctx->cc_refcount); + LASSERT(atomic_read(&(ctx)->cc_refcount) > 0); if (!req->rq_reqbuf && !req->rq_clrbuf) return; @@ -1655,7 +1655,7 @@ void sptlrpc_cli_free_repbuf(struct ptlrpc_request *req) LASSERT(ctx); LASSERT(ctx->cc_sec); LASSERT(ctx->cc_sec->ps_policy); - LASSERT_ATOMIC_POS(&ctx->cc_refcount); + LASSERT(atomic_read(&(ctx)->cc_refcount) > 0); if (!req->rq_repbuf) return; @@ -2239,7 +2239,7 @@ void sptlrpc_svc_ctx_decref(struct ptlrpc_request *req) if (!ctx) return; - LASSERT_ATOMIC_POS(&ctx->sc_refcount); + LASSERT(atomic_read(&(ctx)->sc_refcount) > 0); if (atomic_dec_and_test(&ctx->sc_refcount)) { if (ctx->sc_policy->sp_sops->free_ctx) ctx->sc_policy->sp_sops->free_ctx(ctx); diff --git a/include/linux/libcfs/libcfs_private.h b/include/linux/libcfs/libcfs_private.h index 7c0fb5a1c652..cc9115a89f43 100644 --- a/include/linux/libcfs/libcfs_private.h +++ b/include/linux/libcfs/libcfs_private.h @@ -132,7 +132,6 @@ do { \ #endif /* LASSERT_ATOMIC_ENABLED */ #define LASSERT_ATOMIC_ZERO(a) LASSERT_ATOMIC_EQ(a, 0) -#define LASSERT_ATOMIC_POS(a) LASSERT_ATOMIC_GT(a, 0) /* implication */ #define ergo(a, b) (!(a) || (b)) diff --git a/net/lnet/klnds/o2iblnd/o2iblnd.h b/net/lnet/klnds/o2iblnd/o2iblnd.h index 5884cda7a707..4f83bce9e797 100644 --- a/net/lnet/klnds/o2iblnd/o2iblnd.h +++ b/net/lnet/klnds/o2iblnd/o2iblnd.h @@ -614,7 +614,7 @@ static inline void kiblnd_conn_decref(struct kib_conn *conn) CDEBUG(D_NET, "conn[%p] (%d)--\n", conn, atomic_read(&conn->ibc_refcount)); #endif - LASSERT_ATOMIC_POS(&conn->ibc_refcount); + LASSERT(atomic_read(&(conn)->ibc_refcount) > 0); if (atomic_dec_and_test(&conn->ibc_refcount)) { spin_lock_irqsave(&kiblnd_data.kib_connd_lock, flags); list_add_tail(&conn->ibc_list, -- 2.39.3 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org