diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-02-08 14:06:12 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2013-02-22 21:29:42 +0100 |
commit | a9384aff5315e7568b6ebc171f4a482e01f06526 (patch) | |
tree | 6482bec7ed74afb86b53be6e563fe450dd4c252b /blockdev.c | |
parent | 9e8f1835ea3ab3be83634f34c1bb8b69cd871766 (diff) | |
download | qemu-a9384aff5315e7568b6ebc171f4a482e01f06526.zip qemu-a9384aff5315e7568b6ebc171f4a482e01f06526.tar.gz qemu-a9384aff5315e7568b6ebc171f4a482e01f06526.tar.bz2 |
blockdev: add discard suboption to -drive
Add support for BDRV_O_UNMAP from the QEMU command-line.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r-- | blockdev.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -391,6 +391,13 @@ DriveInfo *drive_init(QemuOpts *opts, BlockInterfaceType block_default_type) } } + if ((buf = qemu_opt_get(opts, "discard")) != NULL) { + if (bdrv_parse_discard_flags(buf, &bdrv_flags) != 0) { + error_report("invalid discard option"); + return NULL; + } + } + bdrv_flags |= BDRV_O_CACHE_WB; if ((buf = qemu_opt_get(opts, "cache")) != NULL) { if (bdrv_parse_cache_flags(buf, &bdrv_flags) != 0) { @@ -1501,6 +1508,10 @@ QemuOptsList qemu_drive_opts = { .type = QEMU_OPT_STRING, .help = "disk image", },{ + .name = "discard", + .type = QEMU_OPT_STRING, + .help = "discard operation (ignore/off, unmap/on)", + },{ .name = "cache", .type = QEMU_OPT_STRING, .help = "host cache usage (none, writeback, writethrough, " |