[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 18/37] qcow2: make is_allocated return true for zer
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 18/37] qcow2: make is_allocated return true for zero clusters |
Date: |
Tue, 2 Apr 2013 16:45:23 -0500 |
From: Paolo Bonzini <address@hidden>
Otherwise, live migration of the top layer will miss zero clusters and
let the backing file show through. This also matches what is done in qed.
QCOW2_CLUSTER_ZERO clusters are invalid in v2 image files. Check this
directly in qcow2_get_cluster_offset instead of replicating the test
everywhere.
Cc: address@hidden
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
(cherry picked from commit 381b487d54ba18c73df9db8452028a330058c505)
Signed-off-by: Michael Roth <address@hidden>
---
block/qcow2-cluster.c | 3 +++
block/qcow2.c | 6 +-----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 56fccf9..bb04432 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -454,6 +454,9 @@ int qcow2_get_cluster_offset(BlockDriverState *bs, uint64_t
offset,
*cluster_offset &= L2E_COMPRESSED_OFFSET_SIZE_MASK;
break;
case QCOW2_CLUSTER_ZERO:
+ if (s->qcow_version < 3) {
+ return -EIO;
+ }
c = count_contiguous_clusters(nb_clusters, s->cluster_size,
&l2_table[l2_index], 0,
QCOW_OFLAG_COMPRESSED | QCOW_OFLAG_ZERO);
diff --git a/block/qcow2.c b/block/qcow2.c
index 7610e56..b4c7c54 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -584,7 +584,7 @@ static int coroutine_fn
qcow2_co_is_allocated(BlockDriverState *bs,
*pnum = 0;
}
- return (cluster_offset != 0);
+ return (cluster_offset != 0) || (ret == QCOW2_CLUSTER_ZERO);
}
/* handle reading after the end of the backing file */
@@ -665,10 +665,6 @@ static coroutine_fn int qcow2_co_readv(BlockDriverState
*bs, int64_t sector_num,
break;
case QCOW2_CLUSTER_ZERO:
- if (s->qcow_version < 3) {
- ret = -EIO;
- goto fail;
- }
qemu_iovec_memset(&hd_qiov, 0, 0, 512 * cur_nr_sectors);
break;
--
1.7.9.5
- [Qemu-stable] [PATCH 08/37] vga: fix byteswapping., (continued)
- [Qemu-stable] [PATCH 08/37] vga: fix byteswapping., Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 11/37] scsi-disk: handle io_canceled uniformly and correctly, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 10/37] qemu-ga: make guest-sync-delimited available during fsfreeze, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 07/37] help: add docs for multiqueue tap options, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 12/37] iscsi: look for pkg-config file too, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 13/37] scsi: do not call scsi_read_data/scsi_write_data for a canceled request, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 14/37] scsi-disk: do not complete canceled UNMAP requests, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 16/37] Allow virtio-net features for legacy s390 virtio bus, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 17/37] pseries: Add compatible property to root of device tree, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 15/37] rtc-test: Fix test failures with recent glib, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 18/37] qcow2: make is_allocated return true for zero clusters,
Michael Roth <=
- [Qemu-stable] [PATCH 19/37] qemu-ga: use key-value store to avoid recycling fd handles after restart, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 21/37] tcg: Fix occasional TCG broken problem when ldst optimization enabled, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 22/37] virtio-ccw: Queue sanity check for notify hypercall., Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 20/37] qga/main.c: Don't use g_key_file_get/set_int64, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 24/37] configure: Require at least spice-protocol-0.12.3, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 23/37] qemu-bridge-helper: force usage of a very high MAC address for the bridge, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 26/37] target-ppc: Fix CPU_POWERPC_MPC8547E, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 25/37] pseries: Add cleanup hook for PAPR virtual LAN device, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 33/37] linux-user/syscall.c: handle FUTEX_WAIT_BITSET in do_futex, Michael Roth, 2013/04/02
- [Qemu-stable] [PATCH 35/37] linux-user: make bogus negative iovec lengths fail EINVAL, Michael Roth, 2013/04/02