> > The kworker routine update_writeback_rate() is schedued to update the > writeback rate in every 5 seconds by default. Before calling > __update_writeback_rate() to do real job, semaphore dc->writeback_lock > should be held by the kworker routine. > > At the same time, bcache writeback thread routine bch_writeback_thread() > also needs to hold dc->writeback_lock before flushing dirty data back > into the backing device. If the dirty data set is large, it might be > very long time for bch_writeback_thread() to scan all dirty buckets and > releases dc->writeback_lock. Hi Coly, cached_dev_write() needs dc->writeback_lock, if the writeback thread holds writeback_lock too long, high write IO latency may happen. I wonder if it is a nicer way to limit the scale of the scanning in writeback. For example, just scan 512GB in stead of the whole cache disk。