Skip to content

Commit

Permalink
gfs2: Switch to wait_event in gfs2_logd
Browse files Browse the repository at this point in the history
In gfs2_logd(), switch from an open-coded wait loop to
wait_event_interruptible_timeout().

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
  • Loading branch information
Andreas Gruenbacher committed Sep 5, 2023
1 parent 66fa991 commit 6df373b
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions fs/gfs2/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6df373b

Please sign in to comment.