* [PATCH] don't allow sys_readahead() on files opened with O_DIRECT
@ 2005-06-06 11:39 Jan Blunck
2005-06-06 11:43 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Jan Blunck @ 2005-06-06 11:39 UTC (permalink / raw)
To: Andrew Morton; +Cc: Linux-Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: filemap.c_direct_IO_readahead.diff --]
[-- Type: text/x-patch, Size: 813 bytes --]
do_readahead() doesn't make sense if the file is opened with O_DIRECT,
since only the page cache is stuffed but never used.
Signed-off-by: Jan Blunck <j.blunck@tu-harburg.de>
mm/filemap.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletion(-)
Index: experimental-um/mm/filemap.c
===================================================================
--- experimental-um.orig/mm/filemap.c
+++ experimental-um/mm/filemap.c
@@ -1110,7 +1110,8 @@ static ssize_t
do_readahead(struct address_space *mapping, struct file *filp,
unsigned long index, unsigned long nr)
{
- if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage)
+ if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage
+ || mapping->a_ops->direct_IO)
return -EINVAL;
force_page_cache_readahead(mapping, filp, index,
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] don't allow sys_readahead() on files opened with O_DIRECT
2005-06-06 11:39 [PATCH] don't allow sys_readahead() on files opened with O_DIRECT Jan Blunck
@ 2005-06-06 11:43 ` Christoph Hellwig
2005-06-06 12:44 ` Jan Blunck
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2005-06-06 11:43 UTC (permalink / raw)
To: Jan Blunck; +Cc: Andrew Morton, Linux-Kernel Mailing List
your check is wrong, it's testing whether the filesystem supports O_DIRECT, not
whether sys_readahead is used on a file descriptor that has been opened with O_DIRECT
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] don't allow sys_readahead() on files opened with O_DIRECT
2005-06-06 11:43 ` Christoph Hellwig
@ 2005-06-06 12:44 ` Jan Blunck
0 siblings, 0 replies; 3+ messages in thread
From: Jan Blunck @ 2005-06-06 12:44 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Andrew Morton, Linux-Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 222 bytes --]
Christoph Hellwig wrote:
> your check is wrong, it's testing whether the filesystem supports O_DIRECT, not
> whether sys_readahead is used on a file descriptor that has been opened with O_DIRECT
D'oh! You're right.
Jan
[-- Attachment #2: filemap.c_direct_IO_readahead.diff --]
[-- Type: text/x-patch, Size: 814 bytes --]
do_readahead() doesn't make sense if the file is opened with O_DIRECT,
since only the page cache is stuffed but never used.
Signed-off-by: Jan Blunck <j.blunck@tu-harburg.de>
mm/filemap.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletion(-)
Index: experimental-um/mm/filemap.c
===================================================================
--- experimental-um.orig/mm/filemap.c
+++ experimental-um/mm/filemap.c
@@ -1110,7 +1110,8 @@ static ssize_t
do_readahead(struct address_space *mapping, struct file *filp,
unsigned long index, unsigned long nr)
{
- if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage)
+ if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage
+ || (filp->f_flags & O_DIRECT))
return -EINVAL;
force_page_cache_readahead(mapping, filp, index,
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-06-06 12:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-06 11:39 [PATCH] don't allow sys_readahead() on files opened with O_DIRECT Jan Blunck
2005-06-06 11:43 ` Christoph Hellwig
2005-06-06 12:44 ` Jan Blunck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®