qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] qga: add mountpoint usage to GuestFilesystemInf


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] qga: add mountpoint usage to GuestFilesystemInfo
Date: Wed, 30 May 2018 08:05:34 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

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



reply via email to

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