提交 1bc36b64 编写于 作者: J Jan Kara 提交者: Wu Fengguang

writeback: Include all dirty inodes in background writeback

Current livelock avoidance code makes background work to include only inodes
that were dirtied before background writeback has started. However background
writeback can be running for a long time and thus excluding newly dirtied
inodes can eventually exclude significant portion of dirty inodes making
background writeback inefficient. Since background writeback avoids livelocking
the flusher thread by yielding to any other work, there is no real reason why
background work should not include all dirty inodes so change the logic in
wb_writeback().
Signed-off-by: NJan Kara <jack@suse.cz>
Signed-off-by: NWu Fengguang <fengguang.wu@intel.com>
上级 b3bba872
...@@ -743,11 +743,17 @@ static long wb_writeback(struct bdi_writeback *wb, ...@@ -743,11 +743,17 @@ static long wb_writeback(struct bdi_writeback *wb,
if (work->for_background && !over_bground_thresh(wb->bdi)) if (work->for_background && !over_bground_thresh(wb->bdi))
break; break;
/*
* Kupdate and background works are special and we want to
* include all inodes that need writing. Livelock avoidance is
* handled by these works yielding to any other work so we are
* safe.
*/
if (work->for_kupdate) { if (work->for_kupdate) {
oldest_jif = jiffies - oldest_jif = jiffies -
msecs_to_jiffies(dirty_expire_interval * 10); msecs_to_jiffies(dirty_expire_interval * 10);
work->older_than_this = &oldest_jif; } else if (work->for_background)
} oldest_jif = jiffies;
trace_writeback_start(wb->bdi, work); trace_writeback_start(wb->bdi, work);
if (list_empty(&wb->b_io)) if (list_empty(&wb->b_io))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册