diff options
author | Anna Schumaker <Anna.Schumaker@netapp.com> | 2016-09-07 15:57:30 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2016-10-07 14:54:25 -0400 |
commit | 29ae7f9dc21a7dda41d78b27bbda7d427ece8ad4 (patch) | |
tree | c162c3003ef26c71d4c1d7353b6f75e75b559ab8 /fs/nfsd/vfs.c | |
parent | 42e616167abb7e4074cfba3a2ca19fa2aba40048 (diff) |
NFSD: Implement the COPY call
I only implemented the sync version of this call, since it's the
easiest. I can simply call vfs_copy_range() and have the vfs do the
right thing for the filesystem being exported.
Signed-off-by: Anna Schumaker <bjschuma@netapp.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/vfs.c')
-rw-r--r-- | fs/nfsd/vfs.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index ff476e654b8f..8ca642fe9b21 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -513,6 +513,22 @@ __be32 nfsd4_clone_file_range(struct file *src, u64 src_pos, struct file *dst, | |||
513 | count)); | 513 | count)); |
514 | } | 514 | } |
515 | 515 | ||
516 | ssize_t nfsd_copy_file_range(struct file *src, u64 src_pos, struct file *dst, | ||
517 | u64 dst_pos, u64 count) | ||
518 | { | ||
519 | |||
520 | /* | ||
521 | * Limit copy to 4MB to prevent indefinitely blocking an nfsd | ||
522 | * thread and client rpc slot. The choice of 4MB is somewhat | ||
523 | * arbitrary. We might instead base this on r/wsize, or make it | ||
524 | * tunable, or use a time instead of a byte limit, or implement | ||
525 | * asynchronous copy. In theory a client could also recognize a | ||
526 | * limit like this and pipeline multiple COPY requests. | ||
527 | */ | ||
528 | count = min_t(u64, count, 1 << 22); | ||
529 | return vfs_copy_file_range(src, src_pos, dst, dst_pos, count, 0); | ||
530 | } | ||
531 | |||
516 | __be32 nfsd4_vfs_fallocate(struct svc_rqst *rqstp, struct svc_fh *fhp, | 532 | __be32 nfsd4_vfs_fallocate(struct svc_rqst *rqstp, struct svc_fh *fhp, |
517 | struct file *file, loff_t offset, loff_t len, | 533 | struct file *file, loff_t offset, loff_t len, |
518 | int flags) | 534 | int flags) |