fs: dlm: use list_empty() to check last iteration
authorAlexander Aring <aahringo@redhat.com>
Tue, 30 Nov 2021 19:47:14 +0000 (14:47 -0500)
committerDavid Teigland <teigland@redhat.com>
Tue, 7 Dec 2021 18:42:26 +0000 (12:42 -0600)
This patch will use list_empty(&ls->ls_cb_delay) to check for last list
iteration. In case of a multiply count of MAX_CB_QUEUE and the list is
empty we do a extra goto more which we can avoid by checking on
list_empty().

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
fs/dlm/ast.c

index 27bae7d4a477a1b8d69d943d8088e76e6263deea..bfac462dd3e8f13c5b5b7ae06c61e9df71a62426 100644 (file)
@@ -300,6 +300,7 @@ void dlm_callback_resume(struct dlm_ls *ls)
 {
        struct dlm_lkb *lkb, *safe;
        int count = 0, sum = 0;
+       bool empty;
 
        clear_bit(LSFL_CB_DELAY, &ls->ls_flags);
 
@@ -315,10 +316,11 @@ more:
                if (count == MAX_CB_QUEUE)
                        break;
        }
+       empty = list_empty(&ls->ls_cb_delay);
        mutex_unlock(&ls->ls_cb_mutex);
 
        sum += count;
-       if (count == MAX_CB_QUEUE) {
+       if (!empty) {
                count = 0;
                cond_resched();
                goto more;