Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752875Ab2FTGhd (ORCPT ); Wed, 20 Jun 2012 02:37:33 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:18152 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752322Ab2FTGha (ORCPT ); Wed, 20 Jun 2012 02:37:30 -0400 X-IronPort-AV: E=Sophos;i="4.77,441,1336320000"; d="scan'208";a="5230807" Message-ID: <4FE16FB5.1000601@cn.fujitsu.com> Date: Wed, 20 Jun 2012 14:37:41 +0800 From: Wanlong Gao Reply-To: gaowanlong@cn.fujitsu.com Organization: Fujitsu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0 MIME-Version: 1.0 To: KOSAKI Motohiro CC: linux-kernel@vger.kernel.org, linux-mm@kvack.org, KOSAKI Motohiro , Hugh Dickins , Andrew Morton , Hillf Danton , Eric Wong Subject: Re: [PATCH] mm, fadvise: don't return -EINVAL when filesystem has no optimization way References: <1339792575-17637-1-git-send-email-kosaki.motohiro@gmail.com> <4FE16E50.9030304@cn.fujitsu.com> <4FE16ED3.2090403@gmail.com> In-Reply-To: <4FE16ED3.2090403@gmail.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/06/20 14:37:50, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/06/20 14:37:52, Serialize complete at 2012/06/20 14:37:52 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2412 Lines: 68 On 06/20/2012 02:33 PM, KOSAKI Motohiro wrote: > (6/20/12 2:31 AM), Wanlong Gao wrote: >> On 06/16/2012 04:36 AM, kosaki.motohiro@gmail.com wrote: >>> From: KOSAKI Motohiro >>> >>> Eric Wong reported his test suite was fail when /tmp is tmpfs. >>> >>> https://lkml.org/lkml/2012/2/24/479 >>> >>> Current,input check of POSIX_FADV_WILLNEED has two problems. >>> >>> 1) require a_ops->readpage. >>> But in fact, force_page_cache_readahead() only require >>> a target filesystem has either ->readpage or ->readpages. >>> 2) return -EINVAL when filesystem don't have ->readpage. >>> But, posix says, it should be retrieved a hint. Thus fadvise() >>> should return 0 if filesystem has no optimization way. >>> Especially, userland application don't know a filesystem type >>> of TMPDIR directory as Eric pointed out. Then, userland can't >>> avoid this error. We shouldn't encourage to ignore syscall >>> return value. >>> >>> Thus, this patch change a return value to 0 when filesytem don't >>> support readahead. >>> >>> Cc: linux-mm@kvack.org >>> Cc: Hugh Dickins >>> Cc: Andrew Morton >>> Cc: Hillf Danton >>> Signed-off-by: Eric Wong >>> Tested-by: Eric Wong >>> Signed-off-by: KOSAKI Motohiro >>> --- >>> mm/fadvise.c | 18 +++++++----------- >>> 1 files changed, 7 insertions(+), 11 deletions(-) >>> >>> diff --git a/mm/fadvise.c b/mm/fadvise.c >>> index 469491e..33e6baf 100644 >>> --- a/mm/fadvise.c >>> +++ b/mm/fadvise.c >>> @@ -93,11 +93,6 @@ SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice) >>> spin_unlock(&file->f_lock); >>> break; >>> case POSIX_FADV_WILLNEED: >>> - if (!mapping->a_ops->readpage) { >>> - ret = -EINVAL; >>> - break; >>> - } >> >> Why not check both readpage and readpages, if they are not here, >> just beak and no following force_page_cache_readahead ? > > They are checked in force_page_cache_readahead. I see, thank you. Reviewed-by: Wanlong Gao > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/