• P
    qemu-ga: add guest-fstrim command · eab5fd59
    Paolo Bonzini 提交于
    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: NPaolo Bonzini <pbonzini@redhat.com>
    Reviewed-by: NLuiz Capitulino <lcapitulino@redhat.com>
    Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
    Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
    eab5fd59
qapi-schema-guest.json 13.4 KB