Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Kent Overstreet <kent.overstreet@linux.dev>

+2 -2
+2 -2
fs/bcachefs/clock.c
··· 109 109 if (cpu_timeout != MAX_SCHEDULE_TIMEOUT) 110 110 mod_timer(&wait.cpu_timer, cpu_timeout + jiffies); 111 111 112 - while (1) { 112 + do { 113 113 set_current_state(TASK_INTERRUPTIBLE); 114 114 if (kthread && kthread_should_stop()) 115 115 break; ··· 119 119 120 120 schedule(); 121 121 try_to_freeze(); 122 - } 122 + } while (0); 123 123 124 124 __set_current_state(TASK_RUNNING); 125 125 del_timer_sync(&wait.cpu_timer);