From: Eric Blake <eblake@redhat.com>
To: Justin Ossevoort <justin@quarantainenet.nl>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qga/commands-posix: Fix bug in guest-fstrim
Date: Tue, 31 Mar 2015 11:01:55 -0600 [thread overview]
Message-ID: <551AD303.10402@redhat.com> (raw)
In-Reply-To: <1427814871-1936-1-git-send-email-justin@quarantainenet.nl>
[-- Attachment #1: Type: text/plain, Size: 2171 bytes --]
On 03/31/2015 09:14 AM, Justin Ossevoort wrote:
> The FITRIM ioctl updates the fstrim_range structure it receives. This
> way the caller can determine how many bytes were trimmed. The
> guest-fstrim logic reuses the same fstrim_range for each filesystem,
> effectively limiting each filesystem to trim at most as much as the
> previous was able to trim.
>
> If a previous filesystem would have trimmed 0 bytes, than the next
> filesystem would report an error 'Invalid argument' because a FITRIM
> request with length 0 is not valid.
>
> This change resets the fstrim_range structure for each filesystem. It
> also returns all bytes trimmed for all filesystems, providing a hint to
> the caller about how effective the guest-fstrim request was.
>
> Signed-off-by: Justin Ossevoort <justin@quarantainenet.nl>
> ---
> -# Returns: Nothing.
> +# Returns: Number of bytes trimmed by this call.
> #
> # Since: 1.2
> ##
> { 'command': 'guest-fstrim',
> - 'data': { '*minimum': 'int' } }
> + 'data': { '*minimum': 'int' },
> + 'returns': 'int' }
No. Please don't add any new non-dictionary returns (see my pending
patch that would flag this as not being on the whitelist:
https://lists.gnu.org/archive/html/qemu-devel/2015-03/msg05046.html
). This is particularly true for an already existing command (clients
might not be prepared for older guest agent returning an empty
dictionary in place of an int; but SHOULD be prepared to see if the
returned dictionary is empty).
Better would be to add a key to the returned dictionary that reports
either total amount trimmed, or even better, an array reporting stats
for each file system trimmed; something like:
{ "return": { "trimmed":
[ { "name":"abc", "mountpoint":"xyz", "trimmed":123 },
{ "name":"def", "mountpoint":"pqr", "trimmed":456 } ] } }
where the 'name' and 'mountpoint' keys of each array element correspond
to the data given by the 'GuestFilesystemInfo' type in
'guest-get-fsinfo' (so that the two commands have correlated information).
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
prev parent reply other threads:[~2015-03-31 17:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-31 15:14 [Qemu-devel] [PATCH] qga/commands-posix: Fix bug in guest-fstrim Justin Ossevoort
2015-03-31 16:52 ` Paolo Bonzini
2015-03-31 17:03 ` Eric Blake
2015-04-01 7:54 ` Paolo Bonzini
2015-04-01 12:33 ` Eric Blake
2015-04-01 16:49 ` Paolo Bonzini
2015-04-02 7:37 ` Justin Ossevoort
2015-03-31 17:01 ` Eric Blake [this message]
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=551AD303.10402@redhat.com \
--to=eblake@redhat.com \
--cc=justin@quarantainenet.nl \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.