From edd13270fa0660fda608b5f2bf989c770d90d469 Mon Sep 17 00:00:00 2001 From: Kevin Hao Date: Mon, 18 Dec 2023 13:35:58 +0800 Subject: gfs2: Use wait_event_freezable_timeout() for freezable kthread A freezable kernel thread can enter frozen state during freezing by either calling try_to_freeze() or using wait_event_freezable() and its variants. So for the following snippet of code in a kernel thread loop: try_to_freeze(); wait_event_interruptible_timeout(); We can change it to a simple wait_event_freezable_timeout() and then eliminate a function call. Signed-off-by: Kevin Hao Signed-off-by: Andreas Gruenbacher --- fs/gfs2/log.c | 4 +--- fs/gfs2/quota.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'fs/gfs2') diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 860176989751..6b3ba8f7b67a 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c @@ -1337,9 +1337,7 @@ int gfs2_logd(void *data) t = gfs2_tune_get(sdp, gt_logd_secs) * HZ; - try_to_freeze(); - - t = wait_event_interruptible_timeout(sdp->sd_logd_waitq, + t = wait_event_freezable_timeout(sdp->sd_logd_waitq, test_bit(SDF_FORCE_AIL_FLUSH, &sdp->sd_flags) || gfs2_ail_flush_reqd(sdp) || gfs2_jrnl_flush_reqd(sdp) || diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 1da9a600db7e..ac40b81ee526 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c @@ -1603,11 +1603,9 @@ int gfs2_quotad(void *data) quotad_check_timeo(sdp, "sync", gfs2_quota_sync, t, "ad_timeo, &tune->gt_quota_quantum); - try_to_freeze(); - t = min(quotad_timeo, statfs_timeo); - t = wait_event_interruptible_timeout(sdp->sd_quota_wait, + t = wait_event_freezable_timeout(sdp->sd_quota_wait, sdp->sd_statfs_force_sync || gfs2_withdrawing_or_withdrawn(sdp) || kthread_should_stop(), -- cgit