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

James Simmons jsimmons at infradead.org
Fri Mar 21 06:07:01 PDT 2025


From: Mr NeilBrown <neilb at 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 at suse.de>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50828
Reviewed-by: Arshad Hussain <arshad.hussain at aeoncomputing.com>
Reviewed-by: James Simmons <jsimmons at infradead.org>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
 fs/lustre/fld/fld_request.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);
-- 
2.39.3



More information about the lustre-devel mailing list