[PATCH] bcache: Use the lastest writeback_delay value when writeback thread is woken up

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When users reset writeback_delay value and woke up writeback
thread via sysfs interface, expect the writeback thread
to do actual writeback work, but in reality, the writeback
thread probably continue to sleep.

For example the following script set writeback_delay to 0 and
wake up writeback thread, but writeback thread just continue to
sleep:
echo 0 > /sys/block/bcache0/bcache/writeback_delay
echo 1 > /sys/block/bcache0/bcache/writeback_running

Using the lastest value when writeback thread is woken up can
urge it to do actual writeback work.

Signed-off-by: Julian Sun <sunjunchao2870@xxxxxxxxx>
---
 drivers/md/bcache/writeback.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
index c1d28e365910..0d2d06aaacfe 100644
--- a/drivers/md/bcache/writeback.c
+++ b/drivers/md/bcache/writeback.c
@@ -825,8 +825,10 @@ static int bch_writeback_thread(void *arg)
 			while (delay &&
 			       !kthread_should_stop() &&
 			       !test_bit(CACHE_SET_IO_DISABLE, &c->flags) &&
-			       !test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags))
+			       !test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags)) {
 				delay = schedule_timeout_interruptible(delay);
+				delay = min(delay, dc->writeback_delay * HZ);
+			}
 
 			bch_ratelimit_reset(&dc->writeback_rate);
 		}
-- 
2.39.5





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux