lustre-devel-lustre.org archive mirror
 help / color / mirror / Atom feed
From: James Simmons <jsimmons@infradead.org>
To: Andreas Dilger <adilger@whamcloud.com>,
	Oleg Drokin <green@whamcloud.com>, NeilBrown <neilb@suse.de>
Cc: Arshad Hussain <arshad.hussain@aeoncomputing.com>,
	Lustre Development List <lustre-devel@lists.lustre.org>
Subject: [lustre-devel] [PATCH 31/33] lnet: libcfs: Remove reference to LASSERT_ATOMIC_POS
Date: Sun,  2 Feb 2025 15:46:31 -0500	[thread overview]
Message-ID: <20250202204633.1148872-32-jsimmons@infradead.org> (raw)
In-Reply-To: <20250202204633.1148872-1-jsimmons@infradead.org>

From: Arshad Hussain <arshad.hussain@aeoncomputing.com>

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 <arshad.hussain@aeoncomputing.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50881
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 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
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

  parent reply	other threads:[~2025-02-02 20:59 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 01/33] lnet: set msg field for lnet message header James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 02/33] Revert "lustre: llite: Check vmpage in releasepage" James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 03/33] lustre: llite: EIO is possible on a race with page reclaim James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 04/33] lustre: llite: add __GFP_NORETRY for read-ahead page James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 05/33] lustre: obd: change lmd flags to bitmap James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 06/33] lustre: uapi: cleanup FSFILT defines James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 07/33] lustre: obd: Reserve metadata overstriping flags James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 08/33] lnet: selftest: manage the workqueue state properly James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 09/33] lustre: remove cl_{offset, index, page_size} helpers James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 10/33] lustre: csdc: reserve layout bits for compress component James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 11/33] lustre: obd: replace simple_strtoul() James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 12/33] lnet: Use dynamic allocation for LND tunables James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 13/33] lustre: cksum: fix generating T10PI guard tags for partial brw page James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 14/33] lustre: llite: remove OBD_ -> CFS_ macros James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 15/33] lustre: obd: " James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 16/33] lnet: improve numeric NID to CPT hashing James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 17/33] lnet: libcfs: Remove unsed LASSERT_ATOMIC_* macros James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 18/33] lustre: misc: replace obsolete ioctl numbers James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 19/33] lustre: lmv: treat unknown hash type as sane type James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 20/33] lustre: llite: Fix return for non-queued aio James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 21/33] lnet: collect data about routes by using Netlink James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 22/33] lustre: ptlrpc: switch sptlrpc_rule_set_choose to large nid James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 23/33] lnet: use list_first_entry() where appropriate James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 24/33] lustre: statahead: using try lock for batched RPCs James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 25/33] lnet: libcfs: use round_up directly James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 26/33] lustre: mdc: md_open_data should keep ref on close_req James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 27/33] lustre: llite: update comment of ll_swap_layouts_close James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 28/33] lustre: ldlm: replace OBD_ -> CFS_ macros James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 29/33] lustre: mdc: remove " James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 30/33] lnet: libcfs: move cfs_expr_list_print to nidstrings.c James Simmons
2025-02-02 20:46 ` James Simmons [this message]
2025-02-02 20:46 ` [lustre-devel] [PATCH 32/33] lnet: ksocklnd: ksocklnd_ni_get_eth_intf_speed() must use only rtnl lock James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 33/33] lustre: ldlm: convert ldlm extent locks to linux extent-tree James Simmons

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250202204633.1148872-32-jsimmons@infradead.org \
    --to=jsimmons@infradead.org \
    --cc=adilger@whamcloud.com \
    --cc=arshad.hussain@aeoncomputing.com \
    --cc=green@whamcloud.com \
    --cc=lustre-devel@lists.lustre.org \
    --cc=neilb@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).