Re: [PATCH v2] m: readahead: return the value which force_page_cache_readahead() returns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch fix one issue, but cause 2 issues: *readahead() will return
read bytes when succeed (just like common read functions).

One for readahead(), which I already sent related patch for it.

The other for madvise(), I fix it, just use LTP test it (after finish
test, I will send fix patch for it).


Thanks.

On 08/21/2013 10:41 AM, Chen Gang 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.
> 
> Signed-off-by: Chen Gang <gang.chen@xxxxxxxxxxx>
> ---
>  mm/madvise.c   |    4 ++--
>  mm/readahead.c |    3 +--
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/madvise.c b/mm/madvise.c
> index 936799f..3d0d484 100644
> --- a/mm/madvise.c
> +++ b/mm/madvise.c
> @@ -247,8 +247,8 @@ static long madvise_willneed(struct vm_area_struct *vma,
>  		end = vma->vm_end;
>  	end = ((end - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
>  
> -	force_page_cache_readahead(file->f_mapping, file, start, end - start);
> -	return 0;
> +	return force_page_cache_readahead(file->f_mapping, file,
> +					start, end - start);
>  }
>  
>  /*
> diff --git a/mm/readahead.c b/mm/readahead.c
> index e4ed041..1b21b5c 100644
> --- a/mm/readahead.c
> +++ b/mm/readahead.c
> @@ -572,8 +572,7 @@ do_readahead(struct address_space *mapping, struct file *filp,
>  	if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage)
>  		return -EINVAL;
>  
> -	force_page_cache_readahead(mapping, filp, index, nr);
> -	return 0;
> +	return force_page_cache_readahead(mapping, filp, index, nr);
>  }
>  
>  SYSCALL_DEFINE3(readahead, int, fd, loff_t, offset, size_t, count)
> 


-- 
Chen Gang

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]