]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
gfs2: Use wait_event_freezable_timeout() for freezable kthread
authorKevin Hao <haokexin@gmail.com>
Mon, 18 Dec 2023 05:35:58 +0000 (13:35 +0800)
committerAndreas Gruenbacher <agruenba@redhat.com>
Thu, 21 Dec 2023 21:53:46 +0000 (22:53 +0100)
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 <haokexin@gmail.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/log.c
fs/gfs2/quota.c

index 860176989751e58e9fa7d59b715108ec8f6b33e7..6b3ba8f7b67a936a0344e2fba27be079f68fbb52 100644 (file)
@@ -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) ||
index 1da9a600db7e941b2a2261056340306cb237acf1..ac40b81ee52696f68bcbab1b5d054b62521b104d 100644 (file)
@@ -1603,11 +1603,9 @@ int gfs2_quotad(void *data)
                quotad_check_timeo(sdp, "sync", gfs2_quota_sync, t,
                                   &quotad_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(),