The start time in writeback_inodes_wb() is not very useful because it slips at each invocation time. We shall use one _constant_ time at the beginning to cover this whole sync() work. The timestamp is now grabbed at work start time. It could be better set at the sync work submission time. CC: Jan Kara Signed-off-by: Wu Fengguang --- fs/fs-writeback.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) --- linux.orig/fs/fs-writeback.c 2009-10-06 23:39:33.000000000 +0800 +++ linux/fs/fs-writeback.c 2009-10-06 23:39:39.000000000 +0800 @@ -669,12 +669,11 @@ static long writeback_inodes_wb(struct b struct writeback_control *wbc) { struct super_block *sb = wbc->sb, *pin_sb = NULL; - const unsigned long start = jiffies; /* livelock avoidance */ unsigned long stop_time = 0; unsigned long wrote = 0; if (wbc->timeout) - stop_time = (start + wbc->timeout) | 1; + stop_time = (jiffies + wbc->timeout) | 1; spin_lock(&inode_lock); @@ -699,13 +698,6 @@ static long writeback_inodes_wb(struct b continue; } - /* - * Was this inode dirtied after sync_sb_inodes was called? - * This keeps sync from extra jobs and livelock. - */ - if (inode_dirtied_after(inode, start)) - break; - if (pin_sb_for_writeback(wbc, inode, &pin_sb)) { requeue_io(inode); continue; @@ -798,6 +790,13 @@ static long wb_writeback(struct bdi_writ long nr; struct inode *inode; + /* + * keep sync from extra jobs and livelock + */ + if (wbc.for_sync) { + wbc.older_than_this = &oldest_jif; + oldest_jif = jiffies; + } if (wbc.for_kupdate || wbc.for_background) { wbc.older_than_this = &oldest_jif; oldest_jif = jiffies - expire_interval; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/