[PATCH 06/13] writeback: invoke all writeback contexts for flusher and dirtytime writeback

Kundan Kumar
2025-05-29T11:34:03Z

Modify flusher and dirtytime logic to iterate through all the writeback
contexts.

Signed-off-by: Kundan Kumar <kundan.kumar@samsung.com>
Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
---
fs/fs-writeback.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 72b73c3353fe..9b0940a6fe78 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -2389,12 +2389,14 @@ static void __wakeup_flusher_threads_bdi(struct backing_dev_info *bdi,
enum wb_reason reason)
{
struct bdi_writeback *wb;
+ struct bdi_writeback_ctx *bdi_wb_ctx;

if (!bdi_has_dirty_io(bdi))
return;

- list_for_each_entry_rcu(wb, &bdi->wb_ctx_arr[0]->wb_list, bdi_node)
- wb_start_writeback(wb, reason);
+ for_each_bdi_wb_ctx(bdi, bdi_wb_ctx)
+ list_for_each_entry_rcu(wb, &bdi_wb_ctx->wb_list, bdi_node)
+ wb_start_writeback(wb, reason);
}

void wakeup_flusher_threads_bdi(struct backing_dev_info *bdi,
@@ -2444,15 +2446,17 @@ static DECLARE_DELAYED_WORK(dirtytime_work, wakeup_dirtytime_writeback);
static void wakeup_dirtytime_writeback(struct work_struct *w)
{
struct backing_dev_info *bdi;
+ struct bdi_writeback_ctx *bdi_wb_ctx;

rcu_read_lock();
list_for_each_entry_rcu(bdi, &bdi_list, bdi_list) {
struct bdi_writeback *wb;

- list_for_each_entry_rcu(wb, &bdi->wb_ctx_arr[0]->wb_list,
- bdi_node)
- if (!list_empty(&wb->b_dirty_time))
- wb_wakeup(wb);
+ for_each_bdi_wb_ctx(bdi, bdi_wb_ctx)
+ list_for_each_entry_rcu(wb, &bdi_wb_ctx->wb_list,
+ bdi_node)
+ if (!list_empty(&wb->b_dirty_time))
+ wb_wakeup(wb);
}
rcu_read_unlock();
schedule_delayed_work(&dirtytime_work, dirtytime_expire_interval * HZ);
--
2.25.1