qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH] qemu-img: Saner printing of large file sizes


From: Eric Blake
Subject: Re: [Qemu-block] [PATCH] qemu-img: Saner printing of large file sizes
Date: Sat, 30 Mar 2019 15:50:43 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.0

On 3/30/19 11:40 AM, Richard W.M. Jones wrote:
> On Sat, Mar 30, 2019 at 10:07:02AM -0500, 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).
>>
>> Reported-by: Richard W.M. Jones <address@hidden>
>> Signed-off-by: Eric Blake <address@hidden>
> 
> I tested this with a few large and a few more reasonable values and
> couldn't see anything wrong, so:
> 
> Tested-by: Richard W.M. Jones <address@hidden>

Thanks for testing. I'll need to squash in a few iotests fixes; for example:

--- /home/eblake/qemu/tests/qemu-iotests/104.out        2018-11-16
15:48:11.988526768 -0600
+++ /home/eblake/qemu/tests/qemu-iotests/104.out.bad    2019-03-30
15:47:30.487118666 -0500
@@ -4,9 +4,9 @@
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
-virtual size: 1.0K (1024 bytes)
+virtual size: 1 KiB (1024 bytes)
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1234
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
-virtual size: 1.5K (1536 bytes)
+virtual size: 1.5 KiB (1536 bytes)
 ***done

So it looks like I'll be sending another version for the sake of the
testsuite, but with no changes to the actual code.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]