From: Jan Kara Date: Wed, 19 Oct 2011 09:44:41 +0000 (+0200) Subject: writeback: Include all dirty inodes in background writeback X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1bc36b6426ae49139e9f56491db76b95921454d7;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git 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: Jan Kara Signed-off-by: Wu Fengguang --- diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 517f211a3bd4..92d353e069dc 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -743,11 +743,17 @@ static long wb_writeback(struct bdi_writeback *wb, if (work->for_background && !over_bground_thresh(wb->bdi)) 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) { oldest_jif = jiffies - 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); if (list_empty(&wb->b_io))