qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: vsementsov@virtuozzo.com, berrange@redhat.com,
	qemu-block@nongnu.org, tao3.xu@intel.com, armbru@redhat.com,
	"libvirt-list@redhat.com" <libvirt-list@redhat.com>
Subject: Re: [PATCH 3/3] utils: Deprecate inexact fractional suffix sizes
Date: Thu, 4 Feb 2021 14:02:54 -0600	[thread overview]
Message-ID: <e7cfe14c-2a55-47be-a840-6a6a943e9072@redhat.com> (raw)
In-Reply-To: <20210204190708.1306296-4-eblake@redhat.com>

On 2/4/21 1:07 PM, Eric Blake wrote:
> The value '1.1k' is inexact; 1126.4 bytes is not possible, so we
> happen to truncate it to 1126.  Our use of fractional sizes is
> intended for convenience, but when a user specifies a fraction that is
> not a clean translation to binary, truncating/rounding behind their
> backs can cause confusion.  Better is to deprecate inexact values,
> which still leaves '1.5k' as valid, but alerts the user to spell out
> their values as a precise byte number in cases where they are
> currently being rounded.

And I promptly forgot to save my changes in my editor.  Consider this
squashed in:

diff --git i/docs/system/deprecated.rst w/docs/system/deprecated.rst
index c404c3926e6f..8e5e05a10642 100644
--- i/docs/system/deprecated.rst
+++ w/docs/system/deprecated.rst
@@ -154,6 +154,15 @@ Input parameters that take a size value should only
use a size suffix
 the value is hexadecimal.  That is, '0x20M' is deprecated, and should
 be written either as '32M' or as '0x2000000'.

+inexact sizes via scaled fractions (since 6.0)
+''''''''''''''''''''''''''''''''''''''''''''''
+
+Input parameters that take a size value should only use a fractional
+size (such as '1.5M') that will result in an exact byte value.  The
+use of inexact values (such as '1.1M') that require truncation or
+rounding is deprecated, and you should instead consider writing your
+unusual size in bytes (here, '1153433' or '1153434' as desired).
+
 QEMU Machine Protocol (QMP) commands
 ------------------------------------



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



  reply	other threads:[~2021-02-04 20:04 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04 19:07 [PATCH 0/3] Improve do_strtosz precision Eric Blake
2021-02-04 19:07 ` [PATCH 1/3] utils: Improve qemu_strtosz() to have 64 bits of precision Eric Blake
2021-02-04 20:12   ` Eric Blake
2021-02-05 10:06     ` Vladimir Sementsov-Ogievskiy
2021-02-05 10:18       ` Vladimir Sementsov-Ogievskiy
2021-02-05 14:06       ` Eric Blake
2021-02-05 14:10         ` Daniel P. Berrangé
2021-02-05 10:07   ` Vladimir Sementsov-Ogievskiy
2021-02-05 14:12     ` Eric Blake
2021-02-05 10:28   ` Richard W.M. Jones
2021-02-05 14:15     ` Eric Blake
2021-02-05 11:02   ` Daniel P. Berrangé
2021-02-05 14:27     ` Eric Blake
2021-02-05 14:36       ` Daniel P. Berrangé
2021-02-05 11:34   ` Daniel P. Berrangé
2021-02-05 14:36     ` Eric Blake
2021-02-04 19:07 ` [PATCH 2/3] utils: Deprecate hex-with-suffix sizes Eric Blake
2021-02-05 10:25   ` Vladimir Sementsov-Ogievskiy
2021-02-05 10:31     ` Richard W.M. Jones
2021-02-05 13:38     ` Eric Blake
2021-02-05 11:13   ` Daniel P. Berrangé
2021-02-05 13:40     ` Eric Blake
2021-02-05 14:02       ` Daniel P. Berrangé
2021-02-04 19:07 ` [PATCH 3/3] utils: Deprecate inexact fractional suffix sizes Eric Blake
2021-02-04 20:02   ` Eric Blake [this message]
2021-02-05 10:34   ` Richard W.M. Jones
2021-02-05 14:19     ` Eric Blake
2021-02-05 10:38   ` Vladimir Sementsov-Ogievskiy
2021-02-05 11:10   ` Daniel P. Berrangé
2021-02-05 14:28     ` Eric Blake
2021-02-05 14:40       ` Daniel P. Berrangé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e7cfe14c-2a55-47be-a840-6a6a943e9072@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=libvirt-list@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=tao3.xu@intel.com \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).