[lustre-devel] [PATCH 07/21] lustre: use list_first_entry() in lnet/klnds subdirectory.
Andreas Dilger
adilger at whamcloud.com
Thu Feb 7 16:59:42 PST 2019
On Feb 6, 2019, at 17:03, NeilBrown <neilb at suse.com> wrote:
>
> Convert
> list_entry(foo->next .....)
> to
> list_first_entry(foo, ....)
>
> in 'lnet/klnds
>
> In several cases the call is combined with a list_empty() test and
> list_first_entry_or_null() is used
>
> Signed-off-by: NeilBrown <neilb at suse.com>
>
> @@ -1853,8 +1855,9 @@ static void kiblnd_destroy_pool_list(struct list_head *head)
> {
> struct kib_pool *pool;
>
> - while (!list_empty(head)) {
> - pool = list_entry(head->next, struct kib_pool, po_list);
> + while ((pool = list_first_entry_or_null(head,
> + struct kib_pool,
> + po_list)) != NULL) {
> list_del(&pool->po_list);
>
> LASSERT(pool->po_owner);
> @@ -1869,7 +1872,7 @@ static void kiblnd_fail_poolset(struct kib_poolset *ps, struct list_head *zombie
>
> spin_lock(&ps->ps_lock);
> while (!list_empty(&ps->ps_pool_list)) {
> - struct kib_pool *po = list_entry(ps->ps_pool_list.next,
> + struct kib_pool *po = list_first_entry(&ps->ps_pool_list,
> struct kib_pool, po_list);
> po->po_failed = 1;
> list_del(&po->po_list);
Why not use the same style as elsewhere in the code:
while ((po = list_first_entry_or_null(&ps->ps_pool_list,
struct kib_pool,
po_list)) != NULL) {
?
Cheers, Andreas
---
Andreas Dilger
Principal Lustre Architect
Whamcloud
More information about the lustre-devel
mailing list