gfs2: Switch to wait_event in gfs2_logd
authorAndreas Gruenbacher <agruenba@redhat.com>
Thu, 17 Aug 2023 13:46:16 +0000 (15:46 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Tue, 5 Sep 2023 13:58:16 +0000 (15:58 +0200)
In gfs2_logd(), switch from an open-coded wait loop to
wait_event_interruptible_timeout().

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/log.c

index aa56879..d3da259 100644 (file)
@@ -1301,7 +1301,6 @@ int gfs2_logd(void *data)
 {
        struct gfs2_sbd *sdp = data;
        unsigned long t = 1;
-       DEFINE_WAIT(wait);
 
        while (!kthread_should_stop()) {
 
@@ -1338,17 +1337,11 @@ int gfs2_logd(void *data)
 
                try_to_freeze();
 
-               do {
-                       prepare_to_wait(&sdp->sd_logd_waitq, &wait,
-                                       TASK_INTERRUPTIBLE);
-                       if (!gfs2_ail_flush_reqd(sdp) &&
-                           !gfs2_jrnl_flush_reqd(sdp) &&
-                           !kthread_should_stop())
-                               t = schedule_timeout(t);
-               } while(t && !gfs2_ail_flush_reqd(sdp) &&
-                       !gfs2_jrnl_flush_reqd(sdp) &&
-                       !kthread_should_stop());
-               finish_wait(&sdp->sd_logd_waitq, &wait);
+               t = wait_event_interruptible_timeout(sdp->sd_logd_waitq,
+                               gfs2_ail_flush_reqd(sdp) ||
+                               gfs2_jrnl_flush_reqd(sdp) ||
+                               kthread_should_stop(),
+                               t);
        }
 
        return 0;