[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 38/54] qemu-io: Add -C for opening with copy-on-read
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 38/54] qemu-io: Add -C for opening with copy-on-read |
Date: |
Fri, 6 Oct 2017 17:54:06 +0200 |
From: Eric Blake <address@hidden>
Make it easier to enable copy-on-read during iotests, by
exposing a new bool option to main and open.
Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
qemu-io.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/qemu-io.c b/qemu-io.c
index 265445ad89..c70bde3eb1 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -102,6 +102,7 @@ static void open_help(void)
" Opens a file for subsequent use by all of the other qemu-io commands.\n"
" -r, -- open file read-only\n"
" -s, -- use snapshot file\n"
+" -C, -- use copy-on-read\n"
" -n, -- disable host cache, short for -t none\n"
" -U, -- force shared permissions\n"
" -k, -- use kernel AIO implementation (on Linux only)\n"
@@ -120,7 +121,7 @@ static const cmdinfo_t open_cmd = {
.argmin = 1,
.argmax = -1,
.flags = CMD_NOFILE_OK,
- .args = "[-rsnkU] [-t cache] [-d discard] [-o options] [path]",
+ .args = "[-rsCnkU] [-t cache] [-d discard] [-o options] [path]",
.oneline = "open the file specified by path",
.help = open_help,
};
@@ -145,7 +146,7 @@ static int open_f(BlockBackend *blk, int argc, char **argv)
QDict *opts;
bool force_share = false;
- while ((c = getopt(argc, argv, "snro:kt:d:U")) != -1) {
+ while ((c = getopt(argc, argv, "snCro:kt:d:U")) != -1) {
switch (c) {
case 's':
flags |= BDRV_O_SNAPSHOT;
@@ -154,6 +155,9 @@ static int open_f(BlockBackend *blk, int argc, char **argv)
flags |= BDRV_O_NOCACHE;
writethrough = false;
break;
+ case 'C':
+ flags |= BDRV_O_COPY_ON_READ;
+ break;
case 'r':
readonly = 1;
break;
@@ -251,6 +255,7 @@ static void usage(const char *name)
" -r, --read-only export read-only\n"
" -s, --snapshot use snapshot file\n"
" -n, --nocache disable host cache, short for -t none\n"
+" -C, --copy-on-read enable copy-on-read\n"
" -m, --misalign misalign allocations for O_DIRECT\n"
" -k, --native-aio use kernel AIO implementation (on Linux only)\n"
" -t, --cache=MODE use the given cache mode for the image\n"
@@ -439,7 +444,7 @@ static QemuOptsList file_opts = {
int main(int argc, char **argv)
{
int readonly = 0;
- const char *sopt = "hVc:d:f:rsnmkt:T:U";
+ const char *sopt = "hVc:d:f:rsnCmkt:T:U";
const struct option lopt[] = {
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
@@ -448,6 +453,7 @@ int main(int argc, char **argv)
{ "read-only", no_argument, NULL, 'r' },
{ "snapshot", no_argument, NULL, 's' },
{ "nocache", no_argument, NULL, 'n' },
+ { "copy-on-read", no_argument, NULL, 'C' },
{ "misalign", no_argument, NULL, 'm' },
{ "native-aio", no_argument, NULL, 'k' },
{ "discard", required_argument, NULL, 'd' },
@@ -492,6 +498,9 @@ int main(int argc, char **argv)
flags |= BDRV_O_NOCACHE;
writethrough = false;
break;
+ case 'C':
+ flags |= BDRV_O_COPY_ON_READ;
+ break;
case 'd':
if (bdrv_parse_discard_flags(optarg, &flags) < 0) {
error_report("Invalid discard option: %s", optarg);
--
2.13.6
- [Qemu-block] [PULL 26/54] qemu-iotests: cleanup and fix search for programs, (continued)
- [Qemu-block] [PULL 26/54] qemu-iotests: cleanup and fix search for programs, Kevin Wolf, 2017/10/06
- [Qemu-block] [PULL 30/54] qemu-iotests: fix uninitialized variable, Kevin Wolf, 2017/10/06
- [Qemu-block] [PULL 28/54] qemu-iotests: do not include common.rc in "check", Kevin Wolf, 2017/10/06
- [Qemu-block] [PULL 27/54] qemu-iotests: limit non-_PROG-suffixed variables to common.rc, Kevin Wolf, 2017/10/06
- [Qemu-block] [PULL 31/54] qemu-iotests: get rid of $iam, Kevin Wolf, 2017/10/06
- [Qemu-block] [PULL 29/54] qemu-iotests: disintegrate more parts of common.config, Kevin Wolf, 2017/10/06
- [Qemu-block] [PULL 33/54] block: Introduce BdrvChildRole.update_filename, Kevin Wolf, 2017/10/06
- [Qemu-block] [PULL 32/54] qemu-iotests: merge "check" and "common", Kevin Wolf, 2017/10/06
- [Qemu-block] [PULL 34/54] commit: Support multiple roots above top node, Kevin Wolf, 2017/10/06
- [Qemu-block] [PULL 35/54] qemu-iotests: Allow QMP pretty printing in common.qemu, Kevin Wolf, 2017/10/06
- [Qemu-block] [PULL 38/54] qemu-io: Add -C for opening with copy-on-read,
Kevin Wolf <=
- [Qemu-block] [PULL 41/54] block: Add blkdebug hook for copy-on-read, Kevin Wolf, 2017/10/06
- [Qemu-block] [PULL 37/54] commit: Remove overlay_bs, Kevin Wolf, 2017/10/06
- [Qemu-block] [PULL 39/54] block: Uniform handling of 0-length bdrv_get_block_status(), Kevin Wolf, 2017/10/06
- [Qemu-block] [PULL 40/54] iotests: Restore stty settings on completion, Kevin Wolf, 2017/10/06
- [Qemu-block] [PULL 42/54] block: Perform copy-on-read in loop, Kevin Wolf, 2017/10/06
- [Qemu-block] [PULL 36/54] qemu-iotests: Test commit block job where top has two parents, Kevin Wolf, 2017/10/06
- [Qemu-block] [PULL 43/54] iotests: Add test 197 for covering copy-on-read, Kevin Wolf, 2017/10/06
- [Qemu-block] [PULL 44/54] block: use 1 MB bounce buffers for crypto instead of 16KB, Kevin Wolf, 2017/10/06
- [Qemu-block] [PULL 46/54] block: fix data type casting for crypto payload offset, Kevin Wolf, 2017/10/06
- [Qemu-block] [PULL 45/54] crypto: expose encryption sector size in APIs, Kevin Wolf, 2017/10/06