]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
writeback: Include all dirty inodes in background writeback
authorJan Kara <jack@suse.cz>
Wed, 19 Oct 2011 09:44:41 +0000 (11:44 +0200)
committerWu Fengguang <fengguang.wu@intel.com>
Thu, 8 Dec 2011 02:49:40 +0000 (10:49 +0800)
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 <jack@suse.cz>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
fs/fs-writeback.c

index ac86f8b3e3cb1cf050753148c3f3d065b18e6cf9..56340aea615be94f338496773cf916929e6574f7 100644 (file)
@@ -754,11 +754,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))