aboutsummaryrefslogtreecommitdiff
path: root/scripts/vmstate-static-checker.py
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2025-05-09 15:40:21 -0500
committerEric Blake <eblake@redhat.com>2025-05-14 16:08:23 -0500
commit52726096707c5c8b90597c445de897fa64d56e73 (patch)
tree60a6f05a19b725daf4f838e10a511020db8a4c0c /scripts/vmstate-static-checker.py
parent31bf15d97dd1d205a3b264675f9a1b3bd1939068 (diff)
downloadqemu-52726096707c5c8b90597c445de897fa64d56e73.zip
qemu-52726096707c5c8b90597c445de897fa64d56e73.tar.gz
qemu-52726096707c5c8b90597c445de897fa64d56e73.tar.bz2
block: Add new bdrv_co_is_all_zeroes() function
There are some optimizations that require knowing if an image starts out as reading all zeroes, such as making blockdev-mirror faster by skipping the copying of source zeroes to the destination. The existing bdrv_co_is_zero_fast() is a good building block for answering this question, but it tends to give an answer of 0 for a file we just created via QMP 'blockdev-create' or similar (such as 'qemu-img create -f raw'). Why? Because file-posix.c insists on allocating a tiny header to any file rather than leaving it 100% sparse, due to some filesystems that are unable to answer alignment probes on a hole. But teaching file-posix.c to read the tiny header doesn't scale - the problem of a small header is also visible when libvirt sets up an NBD client to a just-created file on a migration destination host. So, we need a wrapper function that handles a bit more complexity in a common manner for all block devices - when the BDS is mostly a hole, but has a small non-hole header, it is still worth the time to read that header and check if it reads as all zeroes before giving up and returning a pessimistic answer. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-ID: <20250509204341.3553601-19-eblake@redhat.com>
Diffstat (limited to 'scripts/vmstate-static-checker.py')
0 files changed, 0 insertions, 0 deletions