]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: Use COPY_REFLINK in context_copy_blocks()
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 12 Oct 2022 18:04:11 +0000 (20:04 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 11 Nov 2022 12:47:47 +0000 (13:47 +0100)
We might be copying between files without a loop device involved.
In that case, a reflink is possible and will be much faster.

src/partition/repart.c

index 94a87b978836110f637719d041d6b94ba536155b..3a4f181370ae0dfb02437f0fab2eaf3989a10f07 100644 (file)
@@ -3200,7 +3200,7 @@ static int context_copy_blocks(Context *context) {
                 log_info("Copying in '%s' (%s) on block level into future partition %" PRIu64 ".",
                          p->copy_blocks_path, FORMAT_BYTES(p->copy_blocks_size), p->partno);
 
-                r = copy_bytes(p->copy_blocks_fd, target_fd, p->copy_blocks_size, 0);
+                r = copy_bytes(p->copy_blocks_fd, target_fd, p->copy_blocks_size, COPY_REFLINK);
                 if (r < 0)
                         return log_error_errno(r, "Failed to copy in data from '%s': %m", p->copy_blocks_path);