From: Wu Fengguang <fengguang.wu@intel.com>
To: Jan Kara <jack@suse.cz>
Cc: Theodore Tso <tytso@mit.edu>,
Christoph Hellwig <hch@infradead.org>,
Dave Chinner <david@fromorbit.com>,
Chris Mason <chris.mason@oracle.com>,
Andrew Morton <akpm@linux-foundation.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
"Li, Shaohua" <shaohua.li@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"richard@rsk.demon.co.uk" <richard@rsk.demon.co.uk>,
"jens.axboe@oracle.com" <jens.axboe@oracle.com>,
linux-fsdevel@vger.kernel.org, Steve French <sfrench@samba.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Mark Fasheh <mfasheh@suse.com>,
Joel Becker <joel.becker@oracle.com>,
David Howells <dhowells@redhat.com>,
Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Subject: [RFC] writeback: abort writeback of the inode on wrap-around
Date: Fri, 2 Oct 2009 17:50:50 +0800 [thread overview]
Message-ID: <20091002095050.GA12750@localhost> (raw)
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
next reply other threads:[~2009-10-02 9:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-02 9:50 Wu Fengguang [this message]
2009-10-02 14:46 ` [RFC] writeback: abort writeback of the inode on wrap-around Wu Fengguang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091002095050.GA12750@localhost \
--to=fengguang.wu@intel.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=chris.mason@oracle.com \
--cc=david@fromorbit.com \
--cc=dhowells@redhat.com \
--cc=hch@infradead.org \
--cc=jack@suse.cz \
--cc=jens.axboe@oracle.com \
--cc=joel.becker@oracle.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mfasheh@suse.com \
--cc=richard@rsk.demon.co.uk \
--cc=sfrench@samba.org \
--cc=shaggy@linux.vnet.ibm.com \
--cc=shaohua.li@intel.com \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.