vfs: no fallback for ->copy_file_range
Now that we have generic_copy_file_range(), remove it as a fallback case when offloads fail. This puts the responsibility for executing fallbacks on the filesystems that implement ->copy_file_range and allows us to add operational validity checks to generic_copy_file_range(). Rework vfs_copy_file_range() to call a new do_copy_file_range() helper to execute the copying callout, and move calls to generic_file_copy_range() into filesystem methods where they currently return failures. [Amir] overlayfs is not responsible of executing the fallback. It is the responsibility of the underlying filesystem. Signed-off-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:

committed by
Darrick J. Wong

parent
f16acc9d9b
commit
64bf5ff58d
@@ -129,9 +129,9 @@ nfs4_file_flush(struct file *file, fl_owner_t id)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NFS_V4_2
|
||||
static ssize_t nfs4_copy_file_range(struct file *file_in, loff_t pos_in,
|
||||
struct file *file_out, loff_t pos_out,
|
||||
size_t count, unsigned int flags)
|
||||
static ssize_t __nfs4_copy_file_range(struct file *file_in, loff_t pos_in,
|
||||
struct file *file_out, loff_t pos_out,
|
||||
size_t count, unsigned int flags)
|
||||
{
|
||||
if (!nfs_server_capable(file_inode(file_out), NFS_CAP_COPY))
|
||||
return -EOPNOTSUPP;
|
||||
@@ -140,6 +140,20 @@ static ssize_t nfs4_copy_file_range(struct file *file_in, loff_t pos_in,
|
||||
return nfs42_proc_copy(file_in, pos_in, file_out, pos_out, count);
|
||||
}
|
||||
|
||||
static ssize_t nfs4_copy_file_range(struct file *file_in, loff_t pos_in,
|
||||
struct file *file_out, loff_t pos_out,
|
||||
size_t count, unsigned int flags)
|
||||
{
|
||||
ssize_t ret;
|
||||
|
||||
ret = __nfs4_copy_file_range(file_in, pos_in, file_out, pos_out, count,
|
||||
flags);
|
||||
if (ret == -EOPNOTSUPP)
|
||||
ret = generic_copy_file_range(file_in, pos_in, file_out,
|
||||
pos_out, count, flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static loff_t nfs4_file_llseek(struct file *filep, loff_t offset, int whence)
|
||||
{
|
||||
loff_t ret;
|
||||
|
Reference in New Issue
Block a user