qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 0/2] Fix guest-fstrim behaviour
@ 2015-04-30 14:29 Justin Ossevoort
  2015-04-30 14:29 ` [Qemu-devel] [PATCH v3 1/2] qga/commands-posix: Fix bug in guest-fstrim Justin Ossevoort
  2015-04-30 14:29 ` [Qemu-devel] [PATCH v3 2/2] qga/commands-posix: Return per path fstrim result Justin Ossevoort
  0 siblings, 2 replies; 6+ messages in thread
From: Justin Ossevoort @ 2015-04-30 14:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: mdroth, Justin Ossevoort

The qemu-ga 'guest-fstrim' command is currently not working properly.

There are 2 issues:
- The current implementation reuses a struct between ioctl() calls without
  reinitialising it's fields. This struct however is updated to reflect
  the result of the trim operation.
  Therefor only the first filesystem is thoroughly trimmed, the rest is only
  trimmed up to the amount that was trimmed by the previous filesystem.
- The current implementation will return an error if some filesystem returned
  an unexpected error. The first issue consistently causes this issue when
  the 'guest-fstrim' is performed multiple times in a row when multiple
  filesystems are being trimmed, as this causes a trim request for at most
  0 bytes, which is an error.

The first patch fixes the first issue by explicitly resetting the struct used
to perform the trim ioctl for each path. This is a pretty mundane change and
fixes most use-cases.

The second patch fixes the second issue by changing the returned value to
return a per-path result. This way all paths are always trimmed and dependening
on the outcome of the ioctl an error or some details about the trim are
returned.

There was an earlier request to mirror the fields from the 'guest-fsinfo'
operation. The trim operation however need not happen at the mountpoint level.
A logical future improvement would be to allow the caller to supply an optional
list of paths they want to trim, without needing to have intimate details about
the filesystem layout of the guest.

Justin Ossevoort (2):
  qga/commands-posix: Fix bug in guest-fstrim
  qga/commands-posix: Return per path fstrim result

 qga/commands-posix.c | 63 ++++++++++++++++++++++++++++++++++++----------------
 qga/qapi-schema.json | 32 +++++++++++++++++++++++---
 2 files changed, 73 insertions(+), 22 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-05-01 12:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-30 14:29 [Qemu-devel] [PATCH v3 0/2] Fix guest-fstrim behaviour Justin Ossevoort
2015-04-30 14:29 ` [Qemu-devel] [PATCH v3 1/2] qga/commands-posix: Fix bug in guest-fstrim Justin Ossevoort
2015-04-30 14:45   ` Thomas Huth
2015-04-30 14:29 ` [Qemu-devel] [PATCH v3 2/2] qga/commands-posix: Return per path fstrim result Justin Ossevoort
2015-04-30 16:35   ` Thomas Huth
2015-05-01 11:56     ` Justin Ossevoort

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).