Description of problem: The dump info for qcow2: external data file images is a little hard to understand, which needs to improve. Version-Release number of selected component (if applicable): kernel-4.18.0-80.el8 qemu: upstream with latest commit id - afccfc0c4c6134a7bc9da6375996b3b91d291de4 How reproducible: 100% Steps to Reproduce: Metadata: # qemu-img create -f qcow2 -o data_file=base.img,data_file_raw=off,preallocation=metadata base.qcow2 5G # qemu-img map base.qcow2 --output=json [{ "start": 0, "length": 2147479552, "depth": 0, "zero": true, "data": true, "offset": 0}, { "start": 2147479552, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 2147479552}, { "start": 2147483648, "length": 2147479552, "depth": 0, "zero": true, "data": true, "offset": 2147483648}, { "start": 4294963200, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 4294963200}, { "start": 4294967296, "length": 1073741824, "depth": 0, "zero": true, "data": true, "offset": 4294967296}] Falloc: # qemu-img create -f qcow2 -o data_file=base.img,data_file_raw=off,preallocation=falloc base.qcow2 5G # qemu-img map base.qcow2 --output=json [{ "start": 0, "length": 2147479552, "depth": 0, "zero": true, "data": true, "offset": 0}, { "start": 2147479552, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 2147479552}, { "start": 2147483648, "length": 2147479552, "depth": 0, "zero": true, "data": true, "offset": 2147483648}, { "start": 4294963200, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 4294963200}, { "start": 4294967296, "length": 1073741824, "depth": 0, "zero": true, "data": true, "offset": 4294967296}] Full: # qemu-img create -f qcow2 -o data_file=base.img,data_file_raw=off,preallocation=full base.qcow2 5G # qemu-img map base.qcow2 --output=json [{ "start": 0, "length": 2147479552, "depth": 0, "zero": true, "data": true, "offset": 0}, { "start": 2147479552, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 2147479552}, { "start": 2147483648, "length": 2147479552, "depth": 0, "zero": true, "data": true, "offset": 2147483648}, { "start": 4294963200, "length": 1073745920, "depth": 0, "zero": false, "data": true, "offset": 4294963200}] Actual results: As above. Expected results: Maybe the dump info should be like the one of the normal qcow2 files: Full: # qemu-img create -f qcow2 -o preallocation=full test.qcow2 5G Formatting 'test.qcow2', fmt=qcow2 size=5368709120 cluster_size=65536 preallocation=full lazy_refcounts=off refcount_bits=16 # qemu-img map --output=json test.qcow2 [{ "start": 0, "length": 5368709120, "depth": 0, "zero": false, "data": true, "offset": 458752}] Metadata: # qemu-img create -f qcow2 -o preallocation=metadata test.qcow2 5G Formatting 'test.qcow2', fmt=qcow2 size=5368709120 cluster_size=65536 preallocation=metadata lazy_refcounts=off refcount_bits=16 # qemu-img map --output=json test.qcow2 [{ "start": 0, "length": 458752, "depth": 0, "zero": false, "data": true, "offset": 327680}, { "start": 458752, "length": 536412160, "depth": 0, "zero": true, "data": true, "offset": 786432}, { "start": 536870912, "length": 536870912, "depth": 0, "zero": true, "data": true, "offset": 537264128}, { "start": 1073741824, "length": 536870912, "depth": 0, "zero": true, "data": true, "offset": 1074200576}, { "start": 1610612736, "length": 536870912, "depth": 0, "zero": true, "data": true, "offset": 1611137024}, { "start": 2147483648, "length": 65536, "depth": 0, "zero": false, "data": true, "offset": 2148139008}, { "start": 2147549184, "length": 536805376, "depth": 0, "zero": true, "data": true, "offset": 2148204544}, { "start": 2684354560, "length": 536870912, "depth": 0, "zero": true, "data": true, "offset": 2685075456}, { "start": 3221225472, "length": 536870912, "depth": 0, "zero": true, "data": true, "offset": 3222011904}, { "start": 3758096384, "length": 536870912, "depth": 0, "zero": true, "data": true, "offset": 3758948352}, { "start": 4294967296, "length": 65536, "depth": 0, "zero": false, "data": true, "offset": 4295950336}, { "start": 4295032832, "length": 536805376, "depth": 0, "zero": true, "data": true, "offset": 4296015872}, { "start": 4831838208, "length": 536866816, "depth": 0, "zero": true, "data": true, "offset": 4832886784}, { "start": 5368705024, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 5369753600}] Falloc: # qemu-img create -f qcow2 -o preallocation=falloc test.qcow2 5G Formatting 'test.qcow2', fmt=qcow2 size=5368709120 cluster_size=65536 preallocation=falloc lazy_refcounts=off refcount_bits=16 # qemu-img map --output=json test.qcow2 [{ "start": 0, "length": 327680, "depth": 0, "zero": false, "data": true, "offset": 458752}, { "start": 327680, "length": 5368381440, "depth": 0, "zero": true, "data": true, "offset": 786432}] Additional info:
Preallocation turned out to have real bugs. Unfortunately, it's probably a bit too late for 4.0, but I sent patches upstream: https://lists.gnu.org/archive/html/qemu-block/2019-04/msg00443.html
Tried to verify this bug as below: Tested with: qemu-kvm-4.1.0-1.module+el8.1.0+3966+4a23dca1 kernel-4.18.0-134.el8 Steps: Default/off: # qemu-img create -f qcow2 -o data_file=base.img,data_file_raw=off,preallocation=off base.qcow2 5G # qemu-img map base.qcow2 --output=json [{ "start": 0, "length": 5368709120, "depth": 0, "zero": true, "data": false}] Full: # qemu-img create -f qcow2 -o data_file=base.img,data_file_raw=off,preallocation=full base.qcow2 5G # qemu-img map base.qcow2 --output=json [{ "start": 0, "length": 5368709120, "depth": 0, "zero": false, "data": true, "offset": 0}] Folloc: # qemu-img create -f qcow2 -o data_file=base.img,data_file_raw=off,preallocation=falloc base.qcow2 5G # qemu-img map base.qcow2 --output=json [{ "start": 0, "length": 5368709120, "depth": 0, "zero": false, "data": true, "offset": 0}] # qemu-img map base.img --output=json [{ "start": 0, "length": 16384, "depth": 0, "zero": false, "data": true, "offset": 0}, { "start": 16384, "length": 5368692736, "depth": 0, "zero": true, "data": false, "offset": 16384}] Metadata: # qemu-img create -f qcow2 -o data_file=base.img,data_file_raw=off,preallocation=metadata base.qcow2 5G # qemu-img map base.qcow2 --output=json [{ "start": 0, "length": 5368709120, "depth": 0, "zero": false, "data": true, "offset": 0}]
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2019:3723