[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 19/22] blockdev: add discard suboption to -drive
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 19/22] blockdev: add discard suboption to -drive |
Date: |
Fri, 22 Feb 2013 22:23:48 +0100 |
From: Paolo Bonzini <address@hidden>
Add support for BDRV_O_UNMAP from the QEMU command-line.
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
blockdev.c | 11 +++++++++++
qemu-options.hx | 2 ++
2 files changed, 13 insertions(+)
diff --git a/blockdev.c b/blockdev.c
index b307ed9..0e67d06 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, "
diff --git a/qemu-options.hx b/qemu-options.hx
index 2832d82..51ff726 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -440,6 +440,8 @@ These options have the same definition as they have in
@option{-hdachs}.
@var{cache} is "none", "writeback", "unsafe", "directsync" or "writethrough"
and controls how the host cache is used to access block data.
@item address@hidden
@var{aio} is "threads", or "native" and selects between pthread based disk I/O
and native Linux AIO.
address@hidden address@hidden
address@hidden is one of "ignore" (or "off") or "unmap" (or "on") and controls
whether @dfn{discard} (also known as @dfn{trim} or @dfn{unmap}) requests are
ignored or passed to the filesystem. Some machine types may not support
discard requests.
@item address@hidden
Specify which disk @var{format} will be used rather than detecting
the format. Can be used to specifiy format=raw to avoid interpreting
--
1.8.1.2
- [Qemu-devel] [PATCH 09/22] block: refuse negative iops and bps values, (continued)
- [Qemu-devel] [PATCH 09/22] block: refuse negative iops and bps values, Kevin Wolf, 2013/02/22
- [Qemu-devel] [PATCH 08/22] block: use Error in do_check_io_limits(), Kevin Wolf, 2013/02/22
- [Qemu-devel] [PATCH 06/22] qemu-img: add compressed clusters to BlockFragInfo, Kevin Wolf, 2013/02/22
- [Qemu-devel] [PATCH 05/22] qemu-img: fix missing space in qemu-img check output, Kevin Wolf, 2013/02/22
- [Qemu-devel] [PATCH 12/22] qemu-img: Add compare subcommand, Kevin Wolf, 2013/02/22
- [Qemu-devel] [PATCH 11/22] qemu-img: Add "Quiet mode" option, Kevin Wolf, 2013/02/22
- [Qemu-devel] [PATCH 15/22] coroutine: move pooling to common code, Kevin Wolf, 2013/02/22
- [Qemu-devel] [PATCH 13/22] qemu-iotests: Add qemu-img compare test, Kevin Wolf, 2013/02/22
- [Qemu-devel] [PATCH 16/22] coroutine: trim down nesting level in perf_nesting test, Kevin Wolf, 2013/02/22
- [Qemu-devel] [PATCH 17/22] block: complete all IOs before .bdrv_truncate, Kevin Wolf, 2013/02/22
- [Qemu-devel] [PATCH 19/22] blockdev: add discard suboption to -drive,
Kevin Wolf <=
- [Qemu-devel] [PATCH 18/22] block: implement BDRV_O_UNMAP, Kevin Wolf, 2013/02/22
- [Qemu-devel] [PATCH 21/22] blockdev: enable discard by default, Kevin Wolf, 2013/02/22
- [Qemu-devel] [PATCH 14/22] qemu-iotests: Test qcow2 image creation options, Kevin Wolf, 2013/02/22
- [Qemu-devel] [PATCH 20/22] qemu-nbd: add --discard option, Kevin Wolf, 2013/02/22
- [Qemu-devel] [PATCH 22/22] pc: add compatibility machine types for 1.4, Kevin Wolf, 2013/02/22