On 01.04.19 16:57, Eric Blake wrote: > Disk sizes close to INT64_MAX cause overflow, for some pretty > ridiculous output: > > $ ./nbdkit -U - memory size=$((2**63 - 512)) --run 'qemu-img info $nbd' > image: nbd+unix://?socket=/tmp/nbdkitHSAzNz/socket > file format: raw > virtual size: -8388607T (9223372036854775296 bytes) > disk size: unavailable > > But there's no reason to have two separate implementations of integer > to human-readable abbreviation, where one has overflow and stops at > 'T', while the other avoids overflow and goes all the way to 'E'. With > this patch, the output now claims 8EiB instead of -8388607T, which > really is the correct rounding of largest file size supported by qemu > (we could go 511 bytes larger if we used byte-accurate sizing instead > of rounding up to the next sector boundary, but that wouldn't change > the human-readable result). > > Quite a few iotests need updates to expected output to match. > > Reported-by: Richard W.M. Jones <rjo...@redhat.com> > Signed-off-by: Eric Blake <ebl...@redhat.com> > Tested-by: Richard W.M. Jones <rjo...@redhat.com> > Reviewed-by: Alberto Garcia <be...@igalia.com> > Reviewed-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> > --- > > v2 - actually update iotests to match; no change to block/ code so R-b added
There are more iotests this breaks. First, there is 059 for vmdk, which looks just like the rest. But for -m32, it gets a bit more difficult. Every size above 999 GB (1000 GB gets rounded to 1 TB, which is 2^31 * 512) gets printed as "inf [unit]": $ ./qemu-img create -f qcow2 /tmp/foo.qcow2 1T $ ./qemu-img info /tmp/foo.qcow2 [...] virtual size: inf TiB (1099511627776 bytes) [...] $ ./qemu-img create -f qcow2 /tmp/foo.qcow2 1P $ ./qemu-img info /tmp/foo.qcow2 [...] virtual size: inf PiB (1125899906842624 bytes) [...] This breaks the iotests that test the maximum disk size of more exotic formats. I can see failures for vdi, vhdx, and parallels. But regardless of the iotests, we shouldn’t show the size as infinite just because of -m32. Max
signature.asc
Description: OpenPGP digital signature