summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-01-15 14:15:26 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-02-16 19:14:30 +0100
commita12bbb494faea1625e96768a0caa9c7ab67517d4 (patch)
treea13cdca9a93a7de04972a4e029d6cde6d34d8d04
parent9a269387a0a962f9eb7c5974409ec6cdb390fc50 (diff)
downloadlinux-a12bbb494faea1625e96768a0caa9c7ab67517d4.tar.gz
linux-a12bbb494faea1625e96768a0caa9c7ab67517d4.tar.bz2
linux-a12bbb494faea1625e96768a0caa9c7ab67517d4.zip
bcachefs: bch2_kthread_io_clock_wait() no longer sleeps until full amount
commit d92b83f592d810aded2e5f90db5f560cc8cf577b upstream. Drop t he loop in bch2_kthread_io_clock_wait(): this allows the code that uses it to be woken up for other reasons, and fixes a bug where rebalance wouldn't wake up when a scan was requested. This raises the possibility of spurious wakeups, but callers should always be able to handle that reasonably well. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/bcachefs/clock.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/bcachefs/clock.c b/fs/bcachefs/clock.c
index f41889093a2c..363644451106 100644
--- a/fs/bcachefs/clock.c
+++ b/fs/bcachefs/clock.c
@@ -109,7 +109,7 @@ void bch2_kthread_io_clock_wait(struct io_clock *clock,
if (cpu_timeout != MAX_SCHEDULE_TIMEOUT)
mod_timer(&wait.cpu_timer, cpu_timeout + jiffies);
- while (1) {
+ do {
set_current_state(TASK_INTERRUPTIBLE);
if (kthread && kthread_should_stop())
break;
@@ -119,7 +119,7 @@ void bch2_kthread_io_clock_wait(struct io_clock *clock,
schedule();
try_to_freeze();
- }
+ } while (0);
__set_current_state(TASK_RUNNING);
del_timer_sync(&wait.cpu_timer);