All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>, Mel Gorman <mgorman@suse.de>,
	rientjes@google.com, sasha.levin@oracle.com,
	linux@rasmusvillemoes.dk, kosaki.motohiro@jp.fujitsu.com,
	Wu Fengguang <fengguang.wu@intel.com>,
	lczerner@redhat.com, linux-mm@kvack.org
Subject: Re: [PATCH v2] m: readahead: return the value which force_page_cache_readahead() returns
Date: Wed, 18 Sep 2013 09:59:35 +0800	[thread overview]
Message-ID: <52390907.7050101@asianux.com> (raw)
In-Reply-To: <20130917155644.cc988e7e929fee10e9c86d86@linux-foundation.org>

On 09/18/2013 06:56 AM, Andrew Morton wrote:
> On Wed, 21 Aug 2013 10:41:20 +0800 Chen Gang <gang.chen@asianux.com> wrote:
> 
>> force_page_cache_readahead() may fail, so need let the related upper
>> system calls know about it by its return value.
>>
>> For system call fadvise64_64(), ignore return value because fadvise()
>> shall return success even if filesystem can't retrieve a hint.
>>
> 
> Actually, force_page_cache_readahead() cannot fail - I see no code path
> via which it returns a -ve errno.
>

Hmm... except return -EINVAL, currently it is.

> Of course, that might change in the future and although readahead is
> usually a best-effort-dont-care-if-it-fails thing, I suppose that in
> the case of madvise() and sys_readahead() we should inform userspace,
> as readhead is the primary reason for thier performing the syscall.
> 

Yeah.

> 
> While we're there, please review...
> 
> From: Andrew Morton <akpm@linux-foundation.org>
> Subject: mm/readahead.c:do_readhead(): don't check for ->readpage
> 
> The callee force_page_cache_readahead() already does this and unlike
> do_readahead(), force_page_cache_readahead() remembers to check for
> ->readpages() as well.
> 
> 
> 
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  mm/readahead.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff -puN mm/readahead.c~a mm/readahead.c
> --- a/mm/readahead.c~a
> +++ a/mm/readahead.c
> @@ -569,7 +569,7 @@ static ssize_t
>  do_readahead(struct address_space *mapping, struct file *filp,
>  	     pgoff_t index, unsigned long nr)
>  {
> -	if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage)
> +	if (!mapping || !mapping->a_ops)
>  		return -EINVAL;
>  
>  	return force_page_cache_readahead(mapping, filp, index, nr);
> _
> 
> 
> 

At least for me, this patch sounds good.


And for the code below in "mm/readahead.c", I guess, skipping return
value of force_page_cache_readahead() is acceptable, but still better to
get some comments for it


505 void page_cache_sync_readahead(struct address_space *mapping,
506                                struct file_ra_state *ra, struct file
*filp,
507                                pgoff_t offset, unsigned long req_size)
508 {
509         /* no read-ahead */
510         if (!ra->ra_pages)
511                 return;
512
513         /* be dumb */
514         if (filp && (filp->f_mode & FMODE_RANDOM)) {
515                 force_page_cache_readahead(mapping, filp, offset,
req_size);
516                 return;
517         }
518
519         /* do read-ahead */
520         ondemand_readahead(mapping, ra, filp, false, offset, req_size);
521 }
522 EXPORT_SYMBOL_GPL(page_cache_sync_readahead);


Thanks.
-- 
Chen Gang

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2013-09-18  2:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-20  3:31 [PATCH] mm: readahead: return the value which force_page_cache_readahead() returns Chen Gang
2013-08-20 23:16 ` Andrew Morton
2013-08-21  2:29   ` Chen Gang
2013-08-21  2:41   ` [PATCH v2] m: " Chen Gang
2013-09-03  5:27     ` Chen Gang
2013-09-17 22:56     ` Andrew Morton
2013-09-18  1:59       ` Chen Gang [this message]
2013-10-15  8:06         ` [PATCH] mm/readahead.c: need always return 0 when system call readahead() succeeds Chen Gang
2013-10-15 12:12           ` [PATCH] mm/madvise.c: return 0 instead of read bytes after force_page_cache_readahead() succeeds Chen Gang
2013-10-16 23:06           ` [PATCH] mm/readahead.c: need always return 0 when system call readahead() succeeds David Rientjes
2013-10-17  0:57             ` Chen Gang
2013-10-17  1:17               ` David Rientjes
2013-10-17  1:32                 ` Chen Gang
2013-10-17  2:21                   ` David Rientjes
2013-10-17  2:37                     ` Chen Gang
2013-10-17  2:40                       ` Chen Gang
2013-10-15  8:20     ` [PATCH v2] m: readahead: return the value which force_page_cache_readahead() returns Chen Gang
2013-10-17  9:56       ` Chen Gang
2013-11-04  5:31         ` [PATCH v3] mm: readahead: check return " Chen Gang

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=52390907.7050101@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=akpm@linux-foundation.org \
    --cc=fengguang.wu@intel.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=lczerner@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mgorman@suse.de \
    --cc=rientjes@google.com \
    --cc=sasha.levin@oracle.com \
    --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.