summaryrefslogtreecommitdiff
path: root/src/import/qcow2-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-01-17 18:11:45 +0100
committerLennart Poettering <lennart@poettering.net>2015-01-19 20:24:09 +0100
commit1c7dd82563ff2e71a067aea20d2acb2d0553644b (patch)
treef26693719aeea09d4ab0f94e503bf82de96fa241 /src/import/qcow2-util.c
parent1e20b41187ff7d27477b5322690e447753c66ace (diff)
qcow2: when dissecting qcow2, use btrfs clone ioctls for reflinking blocks to target
Diffstat (limited to 'src/import/qcow2-util.c')
-rw-r--r--src/import/qcow2-util.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/import/qcow2-util.c b/src/import/qcow2-util.c
index c84c6aa0d7..9b0c23bb14 100644
--- a/src/import/qcow2-util.c
+++ b/src/import/qcow2-util.c
@@ -24,6 +24,7 @@
#include "util.h"
#include "sparse-endian.h"
#include "qcow2-util.h"
+#include "btrfs-util.h"
#define QCOW2_MAGIC 0x514649fb
@@ -85,6 +86,11 @@ static int copy_cluster(
void *buffer) {
ssize_t l;
+ int r;
+
+ r = btrfs_clone_range(sfd, soffset, dfd, doffset, cluster_size);
+ if (r >= 0)
+ return r;
l = pread(sfd, buffer, cluster_size, soffset);
if (l < 0)