qemu-e2k/block
Eric Blake 4341df8a83 qcow2: Correctly report status of preallocated zero clusters
We were throwing away the preallocation information associated with
zero clusters.  But we should be matching the well-defined semantics
in bdrv_get_block_status(), where (BDRV_BLOCK_ZERO |
BDRV_BLOCK_OFFSET_VALID) informs the user which offset is reserved,
while still reminding the user that reading from that offset is
likely to read garbage.

count_contiguous_clusters_by_type() is now used only for unallocated
cluster runs, hence it gets renamed and tightened.

Making this change lets us see which portions of an image are zero
but preallocated, when using qemu-img map --output=json.  The
--output=human side intentionally ignores all zero clusters, whether
or not they are preallocated.

The fact that there is no change to qemu-iotests './check -qcow2'
merely means that we aren't yet testing this aspect of qemu-img;
a later patch will add a test.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-id: 20170507000552.20847-5-eblake@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
2017-05-11 14:28:06 +02:00
..
Makefile.objs block/vxhs.c: Add support for a new block device type called "vxhs" 2017-04-24 15:08:42 -04:00
accounting.c block: Clean up includes 2016-01-20 13:36:23 +01:00
backup.c backup: React to bdrv_is_allocated() errors 2017-03-13 12:49:33 +01:00
blkdebug.c blkdebug: Add ability to override unmap geometries 2017-05-11 14:28:06 +02:00
blkreplay.c block: Do not unref bs->file on error in BD's open 2017-04-27 16:12:13 +02:00
blkverify.c qobject: Use simpler QDict/QList scalar insertion macros 2017-05-09 09:13:51 +02:00
block-backend.c block: Drop permissions when migration completes 2017-05-11 12:08:24 +02:00
bochs.c block: do not set BDS read_only if copy_on_read enabled 2017-04-24 15:09:33 -04:00
cloop.c block: do not set BDS read_only if copy_on_read enabled 2017-04-24 15:09:33 -04:00
commit.c block: Add errp to b{lk,drv}_truncate() 2017-04-28 16:02:02 +02:00
crypto.c block: Add errp to BD.bdrv_truncate() 2017-04-28 16:02:03 +02:00
curl.c qobject: Use simpler QDict/QList scalar insertion macros 2017-05-09 09:13:51 +02:00
dirty-bitmap.c block: More operations for meta dirty bitmap 2016-10-24 17:56:07 +02:00
dmg-bz2.c dmg: Move libbz2 code to dmg-bz2.so 2016-10-07 14:14:06 +02:00
dmg.c block: do not set BDS read_only if copy_on_read enabled 2017-04-24 15:09:33 -04:00
dmg.h dmg: Move libbz2 code to dmg-bz2.so 2016-10-07 14:14:06 +02:00
file-posix.c file-posix: Remove .bdrv_inactivate/invalidate_cache 2017-05-11 12:08:24 +02:00
file-win32.c file-win32: Error out if locking=on 2017-05-11 11:08:41 +02:00
gluster.c sockets: Rename SocketAddressFlat to SocketAddress 2017-05-09 09:14:40 +02:00
io.c block: fix alignment calculations in bdrv_co_do_zero_pwritev 2017-04-27 16:24:01 +02:00
iscsi-opts.c block/iscsi: statically link qemu_iscsi_opts 2017-01-27 18:07:58 +01:00
iscsi.c block: Add .bdrv_truncate() error messages 2017-04-28 16:02:03 +02:00
linux-aio.c block: explicitly acquire aiocontext in aio callbacks that need it 2017-02-21 11:39:39 +00:00
mirror.c block: Add errp to b{lk,drv}_truncate() 2017-04-28 16:02:02 +02:00
nbd-client.c nbd-client: fix handling of hungup connections 2017-03-27 16:50:36 +02:00
nbd-client.h nbd: drop unused NBDClientSession.is_unix field 2017-03-27 14:41:01 +02:00
nbd.c sockets: Limit SocketAddressLegacy to external interfaces 2017-05-09 09:14:40 +02:00
nfs.c qobject: Use simpler QDict/QList scalar insertion macros 2017-05-09 09:13:51 +02:00
null.c qobject: Use simpler QDict/QList scalar insertion macros 2017-05-09 09:13:51 +02:00
parallels.c block: Add errp to b{lk,drv}_truncate() 2017-04-28 16:02:02 +02:00
qapi.c block: Don't bother asserting type of output visitor's output 2017-02-22 19:52:20 +01:00
qcow.c block: Add errp to b{lk,drv}_truncate() 2017-04-28 16:02:02 +02:00
qcow2-cache.c qcow2: Remove stale comment 2016-11-25 13:51:30 +01:00
qcow2-cluster.c qcow2: Correctly report status of preallocated zero clusters 2017-05-11 14:28:06 +02:00
qcow2-refcount.c qcow2: Use consistent switch indentation 2017-05-11 14:28:06 +02:00
qcow2-snapshot.c block: Convert bdrv_pwrite(v/_sync) to BdrvChild 2016-07-05 16:46:27 +02:00
qcow2.c qcow2: Fix preallocation size formula 2017-05-11 12:08:24 +02:00
qcow2.h qcow2: Reuse preallocated zero clusters 2017-05-11 12:08:24 +02:00
qed-check.c qed: Use DIV_ROUND_UP 2016-06-07 18:19:24 +03:00
qed-cluster.c block: explicitly acquire aiocontext in aio callbacks that need it 2017-02-21 11:39:39 +00:00
qed-gencb.c block: Clean up includes 2016-01-20 13:36:23 +01:00
qed-l2-cache.c block: Clean up includes 2016-01-20 13:36:23 +01:00
qed-table.c block: explicitly acquire aiocontext in aio callbacks that need it 2017-02-21 11:39:39 +00:00
qed.c block: Add .bdrv_truncate() error messages 2017-04-28 16:02:03 +02:00
qed.h block: explicitly acquire aiocontext in timers that need it 2017-02-21 11:14:08 +00:00
quorum.c qobject: Use simpler QDict/QList scalar insertion macros 2017-05-09 09:13:51 +02:00
raw-format.c block: Add .bdrv_truncate() error messages 2017-04-28 16:02:03 +02:00
rbd.c qobject: Use simpler QDict/QList scalar insertion macros 2017-05-09 09:13:51 +02:00
replication.c block: Make errp the last parameter of commit_active_start 2017-04-24 09:13:44 +02:00
sheepdog.c sockets: Limit SocketAddressLegacy to external interfaces 2017-05-09 09:14:40 +02:00
snapshot.c qobject: Use simpler QDict/QList scalar insertion macros 2017-05-09 09:13:51 +02:00
ssh.c qobject: Use simpler QDict/QList scalar insertion macros 2017-05-09 09:13:51 +02:00
stream.c block: Add Error parameter to bdrv_set_backing_hd() 2017-02-28 20:47:51 +01:00
throttle-groups.c coroutine-lock: add mutex argument to CoQueue APIs 2017-02-21 11:39:40 +00:00
trace-events block/vxhs.c: Add support for a new block device type called "vxhs" 2017-04-24 15:08:42 -04:00
vdi.c block: Add errp to b{lk,drv}_truncate() 2017-04-28 16:02:02 +02:00
vhdx-endian.c vhdx: Use QEMU UUID API 2016-09-23 11:42:52 +08:00
vhdx-log.c block: Add errp to b{lk,drv}_truncate() 2017-04-28 16:02:02 +02:00
vhdx.c block: Add errp to b{lk,drv}_truncate() 2017-04-28 16:02:02 +02:00
vhdx.h block: vhdx - update PAYLOAD_BLOCK_UNMAPPED value to match 1.00 spec 2014-12-12 15:42:22 +00:00
vmdk.c block: Add errp to b{lk,drv}_truncate() 2017-04-28 16:02:02 +02:00
vpc.c block: Add errp to b{lk,drv}_truncate() 2017-04-28 16:02:02 +02:00
vvfat.c qobject: Use simpler QDict/QList scalar insertion macros 2017-05-09 09:13:51 +02:00
vxhs.c qobject: Use simpler QDict/QList scalar insertion macros 2017-05-09 09:13:51 +02:00
win32-aio.c block: explicitly acquire aiocontext in aio callbacks that need it 2017-02-21 11:39:39 +00:00
write-threshold.c block: use bdrv_add_before_write_notifier 2016-10-07 13:34:07 +02:00