staging: lustre: ldlm: use list_first_entry in ldlm_lockd.c
authorNeilBrown <neilb@suse.com>
Wed, 13 Dec 2017 03:15:54 +0000 (14:15 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Dec 2017 11:32:12 +0000 (12:32 +0100)
This is only a small simplification, but it makes the code
a little clearer.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c

index ada50b6..5f6e7c9 100644 (file)
@@ -696,13 +696,13 @@ static int ldlm_bl_get_work(struct ldlm_bl_pool *blp,
        /* process a request from the blp_list at least every blp_num_threads */
        if (!list_empty(&blp->blp_list) &&
            (list_empty(&blp->blp_prio_list) || num_bl == 0))
-               blwi = list_entry(blp->blp_list.next,
-                                 struct ldlm_bl_work_item, blwi_entry);
+               blwi = list_first_entry(&blp->blp_list,
+                                       struct ldlm_bl_work_item, blwi_entry);
        else
                if (!list_empty(&blp->blp_prio_list))
-                       blwi = list_entry(blp->blp_prio_list.next,
-                                         struct ldlm_bl_work_item,
-                                         blwi_entry);
+                       blwi = list_first_entry(&blp->blp_prio_list,
+                                               struct ldlm_bl_work_item,
+                                               blwi_entry);
 
        if (blwi) {
                if (++num_bl >= num_th)