aboutsummaryrefslogtreecommitdiff
path: root/qapi-schema-guest.json
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-06-13 07:41:28 +0200
committerMichael Roth <mdroth@linux.vnet.ibm.com>2012-06-21 17:59:27 -0500
commiteab5fd5989a1ac48d123ccaec7346ce325b9ee77 (patch)
tree2552c109491a2b1070b306bd6dcead17622de0dc /qapi-schema-guest.json
parentaf02203fbe03f0634fea26a6e30febdeed14ede9 (diff)
downloadqemu-eab5fd5989a1ac48d123ccaec7346ce325b9ee77.zip
qemu-eab5fd5989a1ac48d123ccaec7346ce325b9ee77.tar.gz
qemu-eab5fd5989a1ac48d123ccaec7346ce325b9ee77.tar.bz2
qemu-ga: add guest-fstrim command
FITRIM is a mounted filesystem feature to discard (or "trim") blocks which are not in use by the filesystem. This is useful for solid-state drives (SSDs) and thinly-provisioned storage. Provide access to the feature from the host so that filesystems can be trimmed periodically or before migration. Here is an example using scsi_debug: # modprobe scsi_debug lbpu=1 lbpws=1 # sg_vpd -p0xb2 /dev/sdb Logical block provisioning VPD page (SBC): Unmap command supported (LBPU): 1 Write same (16) with unmap bit supported (LBWS): 1 Write same (10) with unmap bit supported (LBWS10): 0 # mke2fs /dev/sdb # cat /sys/bus/pseudo/drivers/scsi_debug/map 1-616,16257-16383 # mount /dev/sdb /run/media/pbonzini/test # dd if=/dev/zero of=/run/media/pbonzini/test/file # cat map 1-616,645-1588,1599-4026,4029-16383 # rm /run/media/pbonzini/test/file # ./qemu-ga /dev/fd/0 {"execute":"guest-fstrim"} {"return": {}} # cat map 1-612 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'qapi-schema-guest.json')
-rw-r--r--qapi-schema-guest.json20
1 files changed, 20 insertions, 0 deletions
diff --git a/qapi-schema-guest.json b/qapi-schema-guest.json
index d4055d2..d955cf1 100644
--- a/qapi-schema-guest.json
+++ b/qapi-schema-guest.json
@@ -351,6 +351,26 @@
'returns': 'int' }
##
+# @guest-fstrim:
+#
+# Discard (or "trim") blocks which are not in use by the filesystem.
+#
+# @minimum:
+# Minimum contiguous free range to discard, in bytes. Free ranges
+# smaller than this may be ignored (this is a hint and the guest
+# may not respect it). By increasing this value, the fstrim
+# operation will complete more quickly for filesystems with badly
+# fragmented free space, although not all blocks will be discarded.
+# The default value is zero, meaning "discard every free block".
+#
+# Returns: Nothing.
+#
+# Since: 1.2
+##
+{ 'command': 'guest-fstrim',
+ 'data': { '*minimum': 'int' } }
+
+##
# @guest-suspend-disk
#
# Suspend guest to disk.