[PATCH] cloner: add support for clone_file_range for cifs

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



Signed-off-by: Ronnie Sahlberg <lsahlber@xxxxxxxxxx>
---
 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




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux