From: Ronnie Sahlberg <lsahlber@redhat.com>
To: fstests@vger.kernel.org
Subject: [PATCH] cloner: add support for clone_file_range for cifs
Date: Tue, 11 Sep 2018 15:28:06 +1000 [thread overview]
Message-ID: <20180911052806.1302-2-lsahlber@redhat.com> (raw)
In-Reply-To: <20180911052806.1302-1-lsahlber@redhat.com>
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
src/cloner.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/cloner.c b/src/cloner.c
index ffad82f0..9f9156e5 100644
--- a/src/cloner.c
+++ b/src/cloner.c
@@ -120,6 +120,18 @@ clone_file_range_btrfs(int src_fd, int dst_fd, uint64_t src_off,
}
static int
+clone_file_range_cifs(int fd_in, int fd_out, loff_t off_in,
+ loff_t off_out, size_t len)
+{
+ int ret;
+
+ ret = copy_file_range(fd_in, &off_in, fd_out, &off_out, len, 0);
+ if (ret < 0)
+ ret = errno;
+ return 0;
+}
+
+static int
clone_file_range(unsigned int fs_type, int src_fd, int dst_fd, uint64_t src_off,
uint64_t dst_off, uint64_t len)
{
@@ -128,7 +140,9 @@ clone_file_range(unsigned int fs_type, int src_fd, int dst_fd, uint64_t src_off,
return clone_file_range_btrfs(src_fd, dst_fd, src_off, dst_off,
len);
break;
- case CIFS_MAGIC_NUMBER: /* only supports full file server-side copies */
+ case CIFS_MAGIC_NUMBER:
+ return clone_file_range_cifs(src_fd, dst_fd, src_off, dst_off,
+ len);
default:
return ENOTSUP;
break;
--
2.13.3
next prev parent reply other threads:[~2018-09-11 10:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-11 5:28 [PATCH 0/1] cloner: add support for clone_file_range for cifs Ronnie Sahlberg
2018-09-11 5:28 ` Ronnie Sahlberg [this message]
2018-09-11 7:02 ` [PATCH] " Christoph Hellwig
2018-09-11 7:26 ` ronnie sahlberg
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=20180911052806.1302-2-lsahlber@redhat.com \
--to=lsahlber@redhat.com \
--cc=fstests@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.