summaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/blockdev.c b/blockdev.c
index b307ed9ba9..0e67d06330 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -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, "