[lustre-devel] [PATCH 23/33] lnet: use list_first_entry() where appropriate.

James Simmons <[email protected]> Sun, 2 Feb 2025 15:46:23 -0500
Newsgroups org.lustre.lists.lustre-devel
Message-ID <[email protected]>
From: Mr NeilBrown <[email protected]>

Lustre already uses list_first_entry() in many places, but
it is not consistent.  Let's make it consistent.
The patch was generated with

sed -i 's/list_entry(([^,]*)->next,/list_first_entry(1,/'
        `git grep -l 'list_entry(.*->next' lustre/ lnet/ libcfs/ `

followed by some manual cleanup of indents.

WC-bug-id: https://jira.whamcloud.com/browse/LU-6142
Lustre-commit: 01e054b34cb894bd4 ("LU-6142 all: use list_first_entry() where appropriate.")
Signed-off-by: Mr NeilBrown <[email protected]>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50826
Reviewed-by: Arshad Hussain <[email protected]>
Reviewed-by: James Simmons <[email protected]>
Reviewed-by: Andreas Dilger <[email protected]>
Reviewed-by: Oleg Drokin <[email protected]>
Signed-off-by: James Simmons <[email protected]>
---
 net/lnet/lnet/lib-move.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/lnet/lnet/lib-move.c b/net/lnet/lnet/lib-move.c
index 9d50260d917a..d9f5eb94ff6e 100644
--- a/net/lnet/lnet/lib-move.c
+++ b/net/lnet/lnet/lib-move.c
@@ -3162,8 +3162,8 @@ lnet_resend_pending_msgs_locked(struct list_head *resendq, int cpt)
 	while (!list_empty(resendq)) {
 		struct lnet_peer_ni *lpni;
 
-		msg = list_entry(resendq->next, struct lnet_msg,
-				 msg_list);
+		msg = list_first_entry(resendq, struct lnet_msg,
+				       msg_list);
 
 		list_del_init(&msg->msg_list);
 
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org