]> git.proxmox.com Git - mirror_qemu.git/commit - qga/qapi-schema.json
qemu-ga: add guest-fstrim command
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 13 Jun 2012 05:41:28 +0000 (07:41 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 21 Jun 2012 22:59:27 +0000 (17:59 -0500)
commiteab5fd5989a1ac48d123ccaec7346ce325b9ee77
tree2552c109491a2b1070b306bd6dcead17622de0dc
parentaf02203fbe03f0634fea26a6e30febdeed14ede9
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>
qapi-schema-guest.json
qga/commands-posix.c
qga/commands-win32.c