qemu-io-cmds.c (8e6dad2028d01b7f9ec76cf3b83457fab57fa1eb) qemu-io-cmds.c (6cf42ca2f9782f0335abf3e6b611fbced40cd099)
1/*
2 * Command line utility to exercise the QEMU I/O path.
3 *
4 * Copyright (C) 2009-2016 Red Hat, Inc.
5 * Copyright (c) 2003-2005 Silicon Graphics, Inc.
6 *
7 * This work is licensed under the terms of the GNU GPL, version 2 or later.
8 * See the COPYING file in the top-level directory.

--- 2102 unchanged lines hidden (view full) ---

2111 BlockDriverState *bs = blk_bs(blk);
2112 QemuOpts *qopts;
2113 QDict *opts;
2114 int c;
2115 int flags = bs->open_flags;
2116 bool writethrough = !blk_enable_write_cache(blk);
2117 bool has_rw_option = false;
2118 bool has_cache_option = false;
1/*
2 * Command line utility to exercise the QEMU I/O path.
3 *
4 * Copyright (C) 2009-2016 Red Hat, Inc.
5 * Copyright (c) 2003-2005 Silicon Graphics, Inc.
6 *
7 * This work is licensed under the terms of the GNU GPL, version 2 or later.
8 * See the COPYING file in the top-level directory.

--- 2102 unchanged lines hidden (view full) ---

2111 BlockDriverState *bs = blk_bs(blk);
2112 QemuOpts *qopts;
2113 QDict *opts;
2114 int c;
2115 int flags = bs->open_flags;
2116 bool writethrough = !blk_enable_write_cache(blk);
2117 bool has_rw_option = false;
2118 bool has_cache_option = false;
2119
2120 BlockReopenQueue *brq;
2121 Error *local_err = NULL;
2122
2123 while ((c = getopt(argc, argv, "c:o:rw")) != -1) {
2124 switch (c) {
2125 case 'c':
2126 if (bdrv_parse_cache_mode(optarg, &flags, &writethrough) < 0) {
2127 error_report("Invalid cache option: %s", optarg);
2128 return -EINVAL;

--- 76 unchanged lines hidden (view full) ---

2205 qobject_unref(opts);
2206 return -EINVAL;
2207 }
2208 } else {
2209 qdict_put_bool(opts, BDRV_OPT_CACHE_DIRECT, flags & BDRV_O_NOCACHE);
2210 qdict_put_bool(opts, BDRV_OPT_CACHE_NO_FLUSH, flags & BDRV_O_NO_FLUSH);
2211 }
2212
2119 Error *local_err = NULL;
2120
2121 while ((c = getopt(argc, argv, "c:o:rw")) != -1) {
2122 switch (c) {
2123 case 'c':
2124 if (bdrv_parse_cache_mode(optarg, &flags, &writethrough) < 0) {
2125 error_report("Invalid cache option: %s", optarg);
2126 return -EINVAL;

--- 76 unchanged lines hidden (view full) ---

2203 qobject_unref(opts);
2204 return -EINVAL;
2205 }
2206 } else {
2207 qdict_put_bool(opts, BDRV_OPT_CACHE_DIRECT, flags & BDRV_O_NOCACHE);
2208 qdict_put_bool(opts, BDRV_OPT_CACHE_NO_FLUSH, flags & BDRV_O_NO_FLUSH);
2209 }
2210
2213 bdrv_subtree_drained_begin(bs);
2214 brq = bdrv_reopen_queue(NULL, bs, opts, true);
2215 bdrv_reopen_multiple(brq, &local_err);
2216 bdrv_subtree_drained_end(bs);
2211 bdrv_reopen(bs, opts, true, &local_err);
2217
2218 if (local_err) {
2219 error_report_err(local_err);
2220 return -EINVAL;
2221 }
2222
2223 blk_set_enable_write_cache(blk, !writethrough);
2224 return 0;

--- 301 unchanged lines hidden ---
2212
2213 if (local_err) {
2214 error_report_err(local_err);
2215 return -EINVAL;
2216 }
2217
2218 blk_set_enable_write_cache(blk, !writethrough);
2219 return 0;

--- 301 unchanged lines hidden ---