diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2018-10-29 19:41:49 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2018-10-29 19:41:49 -0400 |
commit | 42ec3d4c02187a18e27ff94b409ec27234bf2ffd (patch) | |
tree | c9db04db8187c370718a43e6067af0e5aa944500 /fs/nfsd/vfs.c | |
parent | 8dde90bca6fca3736ea20109654bcf6dcf2ecf1d (diff) |
vfs: make remap_file_range functions take and return bytes completed
Change the remap_file_range functions to take a number of bytes to
operate upon and return the number of bytes they operated on. This is a
requirement for allowing fs implementations to return short clone/dedupe
results to the user, which will enable us to obey resource limits in a
graceful manner.
A subsequent patch will enable copy_file_range to signal to the
->clone_file_range implementation that it can handle a short length,
which will be returned in the function's return value. For now the
short return is not implemented anywhere so the behavior won't change --
either copy_file_range manages to clone the entire range or it tries an
alternative.
Neither clone ioctl can take advantage of this, alas.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/nfsd/vfs.c')
-rw-r--r-- | fs/nfsd/vfs.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index b53e76391e52..ac6cb6101cbe 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -541,8 +541,12 @@ __be32 nfsd4_set_nfs4_label(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
541 | __be32 nfsd4_clone_file_range(struct file *src, u64 src_pos, struct file *dst, | 541 | __be32 nfsd4_clone_file_range(struct file *src, u64 src_pos, struct file *dst, |
542 | u64 dst_pos, u64 count) | 542 | u64 dst_pos, u64 count) |
543 | { | 543 | { |
544 | return nfserrno(vfs_clone_file_range(src, src_pos, dst, dst_pos, | 544 | loff_t cloned; |
545 | count)); | 545 | |
546 | cloned = vfs_clone_file_range(src, src_pos, dst, dst_pos, count); | ||
547 | if (count && cloned != count) | ||
548 | cloned = -EINVAL; | ||
549 | return nfserrno(cloned < 0 ? cloned : 0); | ||
546 | } | 550 | } |
547 | 551 | ||
548 | ssize_t nfsd_copy_file_range(struct file *src, u64 src_pos, struct file *dst, | 552 | ssize_t nfsd_copy_file_range(struct file *src, u64 src_pos, struct file *dst, |