From: Andrew Morton <akpm@osdl.org>
To: Zach Brown <zach.brown@oracle.com>
Cc: linux-kernel@vger.kernel.org, zach.brown@oracle.com
Subject: Re: [Patch] invalidate range of pages after direct IO write
Date: Thu, 3 Feb 2005 16:19:27 -0800 [thread overview]
Message-ID: <20050203161927.0090655c.akpm@osdl.org> (raw)
In-Reply-To: <20050129011906.29569.18736.24335@volauvent.pdx.zabbo.net>
Zach Brown <zach.brown@oracle.com> wrote:
>
> After a direct IO write only invalidate the pages that the write intersected.
> invalidate_inode_pages2_range(mapping, pgoff start, pgoff end) is added and
> called from generic_file_direct_IO(). This doesn't break some subtle agreement
> with some other part of the code, does it?
It should be OK.
Note that the same optimisation should be made in the call to
unmap_mapping_range() in generic_file_direct_IO(). Currently we try and
unmap the whole file, even if we're only writing a single byte. Given that
you're now calculating iov_length() in there we might as well use that
number a few lines further up in that function.
Note that invalidate_inode_pages[_range2] also does the unmapping thing -
in the direct-io case we don't expect that path th ever trigger: the only
way we'll find mapped pages here is if someone raced and faulted a page
back in.
Reading the code, I'm unable to convince myself that it won't go into an
infinite loop if it finds a page at page->index = -1. But I didn't try
very hard ;)
Minor note on this:
return invalidate_inode_pages2_range(mapping, 0, ~0UL);
I just use `-1' there. We don't _know_ that pgoff_t is an unsigned long.
Some smarty may come along one day and make it unsigned long long, in which
case the code will break. Using -1 here just works everywhere.
I'll make that change and plop the patch into -mm, but we need to think
about the infinite-loop problem..
next prev parent reply other threads:[~2005-02-04 0:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-29 2:16 [Patch] invalidate range of pages after direct IO write Zach Brown
2005-02-04 0:19 ` Andrew Morton [this message]
2005-02-04 1:52 ` Zach Brown
2005-02-04 2:28 ` Andrew Morton
2005-02-04 23:12 ` Zach Brown
2005-02-04 23:35 ` Andrew Morton
2005-02-07 21:19 ` Zach Brown
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=20050203161927.0090655c.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=linux-kernel@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).