[PATCH 24/45] writeback: remove global nr_to_write and use timeout instead

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The global wbc.timeout could be useful when we decide to do two sync
scans on dirty pages and dirty metadata. XFS could say: please return to
sync dirty metadata after 10s. Would need another b_io_metadata queue,
but that's possible.

CC: Theodore Ts'o <tytso@xxxxxxx>
CC: Chris Mason <chris.mason@xxxxxxxxxx>
CC: Dave Chinner <david@xxxxxxxxxxxxx> 
CC: Christoph Hellwig <hch@xxxxxxxxxxxxx>
CC: Jan Kara <jack@xxxxxxx> 
CC: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> 
CC: Jens Axboe <jens.axboe@xxxxxxxxxx> 
Signed-off-by: Wu Fengguang <fengguang.wu@xxxxxxxxx>
---
 fs/fs-writeback.c         |    6 ++++++
 include/linux/writeback.h |    1 +
 mm/backing-dev.c          |    1 +
 3 files changed, 8 insertions(+)

--- linux.orig/fs/fs-writeback.c	2009-10-06 23:38:44.000000000 +0800
+++ linux/fs/fs-writeback.c	2009-10-06 23:38:45.000000000 +0800
@@ -666,6 +666,10 @@ static void writeback_inodes_wb(struct b
 {
 	struct super_block *sb = wbc->sb, *pin_sb = NULL;
 	const unsigned long start = jiffies;	/* livelock avoidance */
+	unsigned long stop_time = 0;
+
+	if (wbc->timeout)
+		stop_time = (start + wbc->timeout) | 1;
 
 	spin_lock(&inode_lock);
 
@@ -723,6 +727,8 @@ static void writeback_inodes_wb(struct b
 		}
 		if (!list_empty(&wb->b_more_io))
 			wbc->more_io = 1;
+		if (stop_time && time_after(jiffies, stop_time))
+			break;
 	}
 
 	unpin_sb_for_writeback(&pin_sb);
--- linux.orig/mm/backing-dev.c	2009-10-06 23:38:45.000000000 +0800
+++ linux/mm/backing-dev.c	2009-10-06 23:38:45.000000000 +0800
@@ -339,6 +339,7 @@ static void bdi_flush_io(struct backing_
 		.older_than_this	= NULL,
 		.range_cyclic		= 1,
 		.nr_to_write		= 1024,
+		.timeout		= HZ,
 	};
 
 	writeback_inodes_wbc(&wbc);
--- linux.orig/include/linux/writeback.h	2009-10-06 23:38:44.000000000 +0800
+++ linux/include/linux/writeback.h	2009-10-06 23:38:45.000000000 +0800
@@ -42,6 +42,7 @@ struct writeback_control {
 	struct super_block *sb;		/* if !NULL, only write inodes from
 					   this super_block */
 	enum writeback_sync_modes sync_mode;
+	int timeout;
 	unsigned long *older_than_this;	/* If !NULL, only write back inodes
 					   older than this */
 	long nr_to_write;		/* Write this many pages, and decrement


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux