linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] writeback: abort writeback of the inode on wrap-around
@ 2009-10-02  9:50 Wu Fengguang
  2009-10-02 14:46 ` Wu Fengguang
  0 siblings, 1 reply; 2+ messages in thread
From: Wu Fengguang @ 2009-10-02  9:50 UTC (permalink / raw)
  To: Jan Kara
  Cc: Theodore Tso, Christoph Hellwig, Dave Chinner, Chris Mason,
	Andrew Morton, Peter Zijlstra, Li, Shaohua,
	linux-kernel@vger.kernel.org, richard@rsk.demon.co.uk,
	jens.axboe@oracle.com, linux-fsdevel, Steve French,
	Alexander Viro, Mark Fasheh, Joel Becker, David Howells,
	Dave Kleikamp

When past EOF, abort the writeback of the current inode, which will
instruct writeback_single_inode() to redirty_tail() it. 

This is the right behavior for
- sync writeback (is already so with range_whole)
  we have scanned the inode address space, and don't care any more newly
  dirtied pages. So shall update its i_dirtied_when and exclude it from
  the todo list.
- periodic writeback
  any more newly dirtied pages should be associated with a new expire
  time. This also prevents pointless IO for busy overwriters.
- background writeback (irrelevant)
  it generally don't care the dirty timestamp.

That should get rid of one inefficient IO pattern of .range_cyclic when
writeback_index wraps, in which the submitted pages may be consisted of
two distant ranges: submit [10000-10100], (wrap), submit [0-100].

The new .stop_on_wrap is a quick hack to show the basic idea. Ideal
would be to just convert the existing .range_cyclic to new behavior.
This should simplify a lot of code.

Since this involves many filesystems. I'd like to ask if any of them
in fact _desire_ the current .range_cyclic semantics to wrap?

Thanks,
Fengguang
---
 fs/fs-writeback.c         |    1 +
 include/linux/writeback.h |    1 +
 mm/page-writeback.c       |    4 +++-
 3 files changed, 5 insertions(+), 1 deletion(-)

--- linux.orig/fs/fs-writeback.c	2009-10-02 16:46:36.000000000 +0800
+++ linux/fs/fs-writeback.c	2009-10-02 17:01:27.000000000 +0800
@@ -810,6 +810,7 @@ static long wb_writeback(struct bdi_writ
 		.for_kupdate		= args->for_kupdate,
 		.for_background		= args->for_background,
 		.range_cyclic		= args->range_cyclic,
+		.stop_on_wrap		= 1,
 	};
 	unsigned long oldest_jif;
 	long wrote = 0;
--- linux.orig/include/linux/writeback.h	2009-10-02 16:46:36.000000000 +0800
+++ linux/include/linux/writeback.h	2009-10-02 16:57:13.000000000 +0800
@@ -57,6 +57,7 @@ struct writeback_control {
 	unsigned for_background:1;	/* A background writeback */
 	unsigned for_reclaim:1;		/* Invoked from the page allocator */
 	unsigned range_cyclic:1;	/* range_start is cyclic */
+	unsigned stop_on_wrap:1;	/* stop when write index is to wrap */
 	unsigned more_io:1;		/* more io to be dispatched */
 	/*
 	 * write_cache_pages() won't update wbc->nr_to_write and
--- linux.orig/mm/page-writeback.c	2009-10-02 16:46:36.000000000 +0800
+++ linux/mm/page-writeback.c	2009-10-02 16:57:13.000000000 +0800
@@ -913,7 +913,9 @@ continue_unlock:
 			break;
 		}
 	}
-	if (!cycled && !done) {
+	if (wbc->stop_on_wrap)
+		done_index = 0;
+	else if (!cycled && !done) {
 		/*
 		 * range_cyclic:
 		 * We hit the last page and there is more work to be done: wrap

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-02 14:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-02  9:50 [RFC] writeback: abort writeback of the inode on wrap-around Wu Fengguang
2009-10-02 14:46 ` Wu Fengguang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).