]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
block/block-copy: fix s->copy_size for compressed cluster
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Tue, 29 Oct 2019 15:09:34 +0000 (18:09 +0300)
committerMax Reitz <mreitz@redhat.com>
Mon, 4 Nov 2019 08:21:45 +0000 (09:21 +0100)
0e2402452f1f20429 allowed writes larger than cluster, but that's
unsupported for compressed write. Fix it.

Fixes: 0e2402452f1f20429
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-id: 20191029150934.26416-1-vsementsov@virtuozzo.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/block-copy.c

index c39cc9cffe4010837897fd14bf523a5e1026547e..79798a1567b10d8b59b6bb045ca499026e00a018 100644 (file)
@@ -109,9 +109,9 @@ BlockCopyState *block_copy_state_new(BdrvChild *source, BdrvChild *target,
         s->use_copy_range = false;
         s->copy_size = cluster_size;
     } else if (write_flags & BDRV_REQ_WRITE_COMPRESSED) {
-        /* Compression is not supported for copy_range */
+        /* Compression supports only cluster-size writes and no copy-range. */
         s->use_copy_range = false;
-        s->copy_size = MAX(cluster_size, BLOCK_COPY_MAX_BUFFER);
+        s->copy_size = cluster_size;
     } else {
         /*
          * copy_range does not respect max_transfer (it's a TODO), so we factor