lkml.org 
[lkml]   [2009]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 24/45] writeback: remove global nr_to_write and use timeout instead
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@mit.edu>
CC: Chris Mason <chris.mason@oracle.com>
CC: Dave Chinner <david@fromorbit.com>
CC: Christoph Hellwig <hch@infradead.org>
CC: Jan Kara <jack@suse.cz>
CC: Peter Zijlstra <a.p.zijlstra@chello.nl>
CC: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
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



\
 
 \ /
  Last update: 2009-10-07 10:09    [W:0.242 / U:0.756 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site