diff mbox series

[18/27] lustre: fld: use list_first/last_entry() for list heads

Message ID 20250321130711.3257092-19-jsimmons@infradead.org (mailing list archive)
State New
Headers show
Series lustre: sync to OpenSFS tree July 27, 2023 | expand

Commit Message

James Simmons March 21, 2025, 1:07 p.m. UTC
From: Mr NeilBrown <neilb@suse.de>

This patch changes
    list_entry(foo.next, ...)
to
    list_first_entry(&foo, ...)

in cases where 'foo' is a list head - not a list member.

WC-bug-id: https://jira.whamcloud.com/browse/LU-6142
Lustre-commit: 94b72e3478d73133c ("LU-6142 lustre: use list_first/last_entry() for list heads")
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50828
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/fld/fld_request.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/lustre/fld/fld_request.c b/fs/lustre/fld/fld_request.c
index 0fe8cef6e945..eb9f43cf8fe1 100644
--- a/fs/lustre/fld/fld_request.c
+++ b/fs/lustre/fld/fld_request.c
@@ -447,7 +447,7 @@  int fld_client_lookup(struct lu_client_fld *fld, u64 seq, u32 *mds,
 			target = list_entry(fld->lcf_targets.next,
 					    struct lu_fld_target, ft_chain);
 		else
-			target = list_entry(target->ft_chain.next,
+			target = list_first_entry(&target->ft_chain,
 						 struct lu_fld_target,
 						 ft_chain);
 		spin_unlock(&fld->lcf_lock);