Prev: [PATCH 06/13] writeback: merge for_kupdate and !for_kupdate cases
Next: [PATCH 03/13] writeback: add comment to the dirty limits functions
From: Wu Fengguang on 5 Aug 2010 12:40 Introduce writeback_control.inodes_written to count successful ->write_inode() calls. A non-zero value means there are some progress on writeback, in which case more writeback will be tried. This prevents aborting a background writeback work prematurely when the current set of inodes for IO happen to be only metadata-only dirty. Acked-by: Mel Gorman <mel(a)csn.ul.ie> Signed-off-by: Wu Fengguang <fengguang.wu(a)intel.com> --- fs/fs-writeback.c | 5 +++++ include/linux/writeback.h | 1 + 2 files changed, 6 insertions(+) --- linux-next.orig/fs/fs-writeback.c 2010-08-05 23:30:45.000000000 +0800 +++ linux-next/fs/fs-writeback.c 2010-08-05 23:38:55.000000000 +0800 @@ -389,6 +389,8 @@ writeback_single_inode(struct inode *ino int err = write_inode(inode, wbc); if (ret == 0) ret = err; + if (!err) + wbc->inodes_written++; } spin_lock(&inode_lock); @@ -642,6 +644,7 @@ static long wb_writeback(struct bdi_writ wbc.nr_to_write = MAX_WRITEBACK_PAGES; wbc.pages_skipped = 0; + wbc.inodes_written = 0; trace_wbc_writeback_start(&wbc, wb->bdi); if (work->sb) @@ -664,6 +667,8 @@ static long wb_writeback(struct bdi_writ */ if (wbc.nr_to_write < MAX_WRITEBACK_PAGES) continue; + if (wbc.inodes_written) + continue; /* * Nothing written and no more inodes for IO, bail --- linux-next.orig/include/linux/writeback.h 2010-08-05 23:28:35.000000000 +0800 +++ linux-next/include/linux/writeback.h 2010-08-05 23:40:46.000000000 +0800 @@ -34,6 +34,7 @@ struct writeback_control { long nr_to_write; /* Write this many pages, and decrement this for each page written */ long pages_skipped; /* Pages which were not written */ + long inodes_written; /* # of inodes (metadata) written */ /* * For a_ops->writepages(): is start or end are non-zero then this is -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |