Commit d92b83f5 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: bch2_kthread_io_clock_wait() no longer sleeps until full amount

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: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 741c1d3e
...@@ -109,7 +109,7 @@ void bch2_kthread_io_clock_wait(struct io_clock *clock, ...@@ -109,7 +109,7 @@ void bch2_kthread_io_clock_wait(struct io_clock *clock,
if (cpu_timeout != MAX_SCHEDULE_TIMEOUT) if (cpu_timeout != MAX_SCHEDULE_TIMEOUT)
mod_timer(&wait.cpu_timer, cpu_timeout + jiffies); mod_timer(&wait.cpu_timer, cpu_timeout + jiffies);
while (1) { do {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
if (kthread && kthread_should_stop()) if (kthread && kthread_should_stop())
break; break;
...@@ -119,7 +119,7 @@ void bch2_kthread_io_clock_wait(struct io_clock *clock, ...@@ -119,7 +119,7 @@ void bch2_kthread_io_clock_wait(struct io_clock *clock,
schedule(); schedule();
try_to_freeze(); try_to_freeze();
} } while (0);
__set_current_state(TASK_RUNNING); __set_current_state(TASK_RUNNING);
del_timer_sync(&wait.cpu_timer); del_timer_sync(&wait.cpu_timer);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment