Whamcloud - gitweb
LU-6142 lustre: ptlrpc: don't use list_for_each_entry_safe unnecessarily. 39/41939/3
authorNeil Brown <neilb@suse.de>
Mon, 1 Mar 2021 15:13:56 +0000 (10:13 -0500)
committerOleg Drokin <green@whamcloud.com>
Tue, 30 Mar 2021 04:15:44 +0000 (04:15 +0000)
commit5c89fa57cb2dfff667ddd75eaeb13f942f5b155d
tree7b68cbb15f6d15b223df6d5ac7d3c99615e0b701
parent0561c144cc1bb623e05d08b5055009e8d86047f4
LU-6142 lustre: ptlrpc: don't use list_for_each_entry_safe unnecessarily.

list_for_each_entry_safe() is only needed if the body of the
loop might change the list, or if it might drop a lock that would
otherwise prevent the list from being changed.

When the body does neither of these, list_for_each_entry() should be
preferred as it makes the behaviour of the loop more clear to readers.

In each of the cases changed there, the list cannot change while the
loop proceeds.

Change-Id: Ib0f08c5d4d7959b80a7a1490fb606e40e1cf5f85
Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-on: https://review.whamcloud.com/41939
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ptlrpc/client.c
lustre/ptlrpc/import.c
lustre/ptlrpc/ptlrpcd.c
lustre/ptlrpc/recover.c