All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kinglong Mee <kinglongmee@gmail.com>
To: Anna Schumaker <Anna.Schumaker@netapp.com>,
	Trond.Myklebust@primarydata.com, linux-nfs@vger.kernel.org,
	"J. Bruce Fields" <bfields@fieldses.org>,
	kinglongmee@gmail.com
Subject: Re: [PATCH 4/7] VFS: Fall back on splice if no copy function defined
Date: Thu, 13 Aug 2015 21:03:45 +0800	[thread overview]
Message-ID: <55CC95B1.3040502@gmail.com> (raw)
In-Reply-To: <1438979904-8775-5-git-send-email-Anna.Schumaker@Netapp.com>

On 8/8/2015 04:38, Anna Schumaker wrote:
> The NFS server will need a fallback for filesystems that don't have any
> kind of copy acceleration yet.  Let's handle this by having
> vfs_copy_range() fall back to splice, enabling an in-kernel fallback for
> all filesystems.

I'd like do the job in nfsd_copy_range().

If user only want call the underlay filesystem's copy_file_range()?
want get an error if not support. But, this patch lets the syscall
to another logical of calling do_splice_direct().

thanks,
Kinglong Mee

> 
> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
> ---
>  fs/read_write.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/read_write.c b/fs/read_write.c
> index 3804547..e564a6b 100644
> --- a/fs/read_write.c
> +++ b/fs/read_write.c
> @@ -1358,7 +1358,7 @@ ssize_t vfs_copy_file_range(struct file *file_in, loff_t pos_in,
>  	if (!(file_in->f_mode & FMODE_READ) ||
>  	    !(file_out->f_mode & FMODE_WRITE) ||
>  	    (file_out->f_flags & O_APPEND) ||
> -	    !file_in->f_op || !file_in->f_op->copy_file_range)
> +	    !file_in->f_op)
>  		return -EINVAL;
>  
>  	inode_in = file_inode(file_in);
> @@ -1382,8 +1382,12 @@ ssize_t vfs_copy_file_range(struct file *file_in, loff_t pos_in,
>  	if (ret)
>  		return ret;
>  
> -	ret = file_in->f_op->copy_file_range(file_in, pos_in, file_out, pos_out,
> -					     len, flags);
> +	ret = -ENOTSUPP;
> +	if (file_in->f_op->copy_file_range)
> +		ret = file_in->f_op->copy_file_range(file_in, pos_in, file_out,
> +						     pos_out, len, flags);
> +	if (ret == -ENOTSUPP)
> +		ret = do_splice_direct(file_in, &pos_in, file_out, &pos_out, len, flags);
>  	if (ret > 0) {
>  		fsnotify_access(file_in);
>  		add_rchar(current, ret);
> 

  reply	other threads:[~2015-08-13 13:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-07 20:38 [PATCH 0/7] NFSv4.2: Add support for the COPY operation Anna Schumaker
2015-08-07 20:38 ` [PATCH 1/7] vfs: add copy_file_range syscall and vfs helper Anna Schumaker
2015-08-07 20:38 ` [PATCH 2/7] x86: add sys_copy_file_range to syscall tables Anna Schumaker
2015-08-07 20:38 ` [PATCH 3/7] btrfs: add .copy_file_range file operation Anna Schumaker
2015-08-07 20:38 ` [PATCH 4/7] VFS: Fall back on splice if no copy function defined Anna Schumaker
2015-08-13 13:03   ` Kinglong Mee [this message]
2015-08-07 20:38 ` [PATCH 5/7] nfsd: Pass filehandle to nfs4_preprocess_stateid_op() Anna Schumaker
2015-08-07 20:38 ` [PATCH 6/7] NFSD: Implement the COPY call Anna Schumaker
2015-08-07 20:38 ` [PATCH 7/7] NFS: Add COPY nfs operation Anna Schumaker
2015-08-07 20:38 ` [RFC] vfs_copy_range() test program Anna Schumaker
2015-08-10 21:07 ` [PATCH 0/7] NFSv4.2: Add support for the COPY operation J. Bruce Fields
2015-08-11 17:52   ` Anna Schumaker

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=55CC95B1.3040502@gmail.com \
    --to=kinglongmee@gmail.com \
    --cc=Anna.Schumaker@netapp.com \
    --cc=Trond.Myklebust@primarydata.com \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    /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.