lkml.org 
[lkml]   [2005]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH][RESEND] don't allow sys_readahead() on files opened with O_DIRECT
IMO sys_readahead() doesn't make sense if the file is opened with
O_DIRECT, because the page cache is stuffed but never used. Therefore
this patch changes that by letting the call return with -EINVAL.

Signed-off-by: Jan Blunck <j.blunck@tu-harburg.de>

mm/filemap.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletion(-)

Index: experimental-jb/mm/filemap.c
===================================================================
--- experimental-jb.orig/mm/filemap.c
+++ experimental-jb/mm/filemap.c
@@ -1111,7 +1111,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,
\
 
 \ /
  Last update: 2005-08-23 17:20    [W:0.070 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site