Whamcloud - gitweb
LU-9679 various: use list_splice and list_splice_init 57/37457/2
authorMr NeilBrown <neilb@suse.de>
Wed, 13 Nov 2019 03:03:12 +0000 (14:03 +1100)
committerOleg Drokin <green@whamcloud.com>
Thu, 20 Feb 2020 07:13:40 +0000 (07:13 +0000)
commit45a64335d0e326a411fe6a68cce77e618924f59f
treefc6d11e1546a6f7c741a2d2587e2ae3793df11e4
parenta1b8fd633d2eb3f92151eafcb22e7413ec33bf03
LU-9679 various: use list_splice and list_splice_init

The construct
   list_add(to, from);
   list_del(from);
is equivalent to
   list_splice(from, to);
providing 'to' has been initialized.
Similarly with list_del_init and list_splice_init.
There is no need to check if list_empty(from) first.

Also looping over a list moving individiual entries to
another list can more easily be done with list_splice.

These changes improve code clarity.

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I710eb3bbd83c75e6c8f00b8d0a4c256ad28f9082
Reviewed-on: https://review.whamcloud.com/37457
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.super@gmail.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/klnds/socklnd/socklnd.c
lnet/klnds/socklnd/socklnd_cb.c
lnet/klnds/socklnd/socklnd_proto.c
lnet/lnet/api-ni.c
lnet/selftest/conrpc.c
lustre/ldlm/ldlm_lockd.c