From: Andrew Morton <akpm@osdl.org>
To: Chris Mason <chris.mason@oracle.com>
Cc: linux-fsdevel@vger.kernel.org, zach.brown@oracle.com
Subject: Re: [RFC PATCH 0/2] O_DIRECT locking rework
Date: Fri, 20 Oct 2006 12:30:58 -0700 [thread overview]
Message-ID: <20061020123058.8b422339.akpm@osdl.org> (raw)
In-Reply-To: <20061020183237.GA8674@think.oraclecorp.com>
On Fri, 20 Oct 2006 14:32:37 -0400
Chris Mason <chris.mason@oracle.com> wrote:
> Hello everyone,
>
> O_DIRECT locking currently uses a few different per-inode locks to
> prevent races between buffered io and direct io. This is awkward, and
> sometimes grows races where we expose old data on disk.
>
> For example, I can't quite see how we protect from an mmap triggered
> writepage from filling a hole in the middle of an O_DIRECT read.
>
> This patch set changes O_DIRECT to use page locks instead of
> mutex/semaphores. It looks in the radix tree for pages affected by this
> O_DIRECT read/wrte and locks any pages it finds.
>
> For any pages not present, a stub page struct is inserted into the
> radix tree. The page cache routines are changed to either wait on this
> place holder page or ignore it as appropriate. Place holders are not
> valid pages at all, you can't trust page->index or any other field.
>
> The first patch introduces these place holder pages. The second patch
> changes fs/direct-io.c to use them. Patch #2 needs work,
> direct-io.c:lock_page_range can be made much faster, and it needs to be
> changed to work in chunks instead of pinning down the whole range at
> once.
>
> But, this is enough for people to comment on the basic idea. Testing
> has been very light. I'm not sure I've covered all of the buffered vs
> direct races yet. The main goal of posting now is to talk about the
> place holder pages and possible optimizations.
>
> For the XFS guys, you probably want to avoid the page locking steps as
> well, a later version will honor that.
>
Boy, it doesn't do much to simplify the code, does it? An opportunity for
Linus to again share with us his opinions on direct-io.
Conceptually, sticking locked pages into the mapping is a good thing to do,
because it meshes in with all our existing synchronisation design.
I think the fake placeholder page can be a kernel-wide thing rather than
per-dio? That would be most desirable because then we have
#define PagePlaceHolder(page) (page == global_placeholder_page)
which saves a precious page flag.
next prev parent reply other threads:[~2006-10-20 19:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-20 18:32 [RFC PATCH 0/2] O_DIRECT locking rework Chris Mason
2006-10-20 18:38 ` [RFC PATCH 1/2] placeholder pages Chris Mason
2006-10-20 18:41 ` [RFC PATCH 1/2] page cache locking for O_DIRECT Chris Mason
2006-10-20 19:30 ` Andrew Morton [this message]
2006-10-20 20:03 ` [RFC PATCH 0/2] O_DIRECT locking rework Zach Brown
2006-10-20 20:12 ` Chris Mason
2006-10-20 20:05 ` Chris Mason
2006-10-20 20:23 ` Andi Kleen
2006-10-24 19:34 ` Chris Mason
2006-10-24 19:38 ` [RFC PATCH 1/2] placeholder pages Chris Mason
2006-10-24 19:40 ` [RFC PATCH 2/2] O_DIRECT locking via placeholders Chris Mason
2006-10-24 20:28 ` [RFC PATCH 0/2] O_DIRECT locking rework Badari Pulavarty
2006-10-24 20:50 ` Chris Mason
2006-10-24 21:52 ` Badari Pulavarty
2006-10-24 22:22 ` Chris Mason
2006-10-24 22:47 ` Badari Pulavarty
2006-10-24 22:37 ` Russell Cattelan
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=20061020123058.8b422339.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=chris.mason@oracle.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=zach.brown@oracle.com \
/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 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).