On 05/30/2018 01:55 AM, Chen Hanxiao wrote:
+ usage = u100 / nonroot_total + (u100 % nonroot_total != 0);
Why integral instead of floating point?
I followed the style of df from coreutils.
As the percentage already multiplied by 100,
I think it has enough precision.
You're making an arbitrary policy decision. Give the client a floating
point, and they can still truncate to print out a 2-digit percentage.
But give them a percentage, and for a 2T disk image, they are forced to
guess whether they are 20G high or low on usage, which starts to take a
non-trivial amount of time to copy that much data. In other words, I
think an int is wrong for being too imprecise.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org