summaryrefslogtreecommitdiff
path: root/qemu-io-cmds.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-05-16 10:43:03 -0600
committerMax Reitz <mreitz@redhat.com>2016-05-19 16:56:58 +0200
commit37546ff28fb89744ebf2223db22cbc253592abe1 (patch)
treeafeb3f34de755b9d181a20fba7eaf3aec3e5ae4f /qemu-io-cmds.c
parent9e28bb26c243c2c0ec96a900611f0658a0665b43 (diff)
downloadqemu-37546ff28fb89744ebf2223db22cbc253592abe1.tar.gz
qemu-37546ff28fb89744ebf2223db22cbc253592abe1.tar.bz2
qemu-37546ff28fb89744ebf2223db22cbc253592abe1.zip
qemu-iotests: Fix regression in 136 on aio_read invalid
Commit 093ea232 removed the ability for aio_read and aio_write to artificially inflate the invalid statistics counters for block devices, since it no longer flags unaligned offset or length. Add 'aio_read -i' and 'aio_write -i' to restore the ability, and update test 136 to use it. Reported-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com> Message-id: 1463416983-28318-4-git-send-email-eblake@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'qemu-io-cmds.c')
-rw-r--r--qemu-io-cmds.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
index b5dbc676aa..e766791ffc 100644
--- a/qemu-io-cmds.c
+++ b/qemu-io-cmds.c
@@ -1274,6 +1274,7 @@ static void aio_read_help(void)
" used to ensure all outstanding aio requests have been completed.\n"
" -C, -- report statistics in a machine parsable format\n"
" -P, -- use a pattern to verify read data\n"
+" -i, -- treat request as invalid, for exercising stats\n"
" -v, -- dump buffer to standard output\n"
" -q, -- quiet mode, do not show I/O statistics\n"
"\n");
@@ -1286,7 +1287,7 @@ static const cmdinfo_t aio_read_cmd = {
.cfunc = aio_read_f,
.argmin = 2,
.argmax = -1,
- .args = "[-Cqv] [-P pattern] off len [len..]",
+ .args = "[-Ciqv] [-P pattern] off len [len..]",
.oneline = "asynchronously reads a number of bytes",
.help = aio_read_help,
};
@@ -1297,7 +1298,7 @@ static int aio_read_f(BlockBackend *blk, int argc, char **argv)
struct aio_ctx *ctx = g_new0(struct aio_ctx, 1);
ctx->blk = blk;
- while ((c = getopt(argc, argv, "CP:qv")) != -1) {
+ while ((c = getopt(argc, argv, "CP:iqv")) != -1) {
switch (c) {
case 'C':
ctx->Cflag = true;
@@ -1310,6 +1311,11 @@ static int aio_read_f(BlockBackend *blk, int argc, char **argv)
return 0;
}
break;
+ case 'i':
+ printf("injecting invalid read request\n");
+ block_acct_invalid(blk_get_stats(blk), BLOCK_ACCT_READ);
+ g_free(ctx);
+ return 0;
case 'q':
ctx->qflag = true;
break;
@@ -1367,6 +1373,7 @@ static void aio_write_help(void)
" -P, -- use different pattern to fill file\n"
" -C, -- report statistics in a machine parsable format\n"
" -f, -- use Force Unit Access semantics\n"
+" -i, -- treat request as invalid, for exercising stats\n"
" -q, -- quiet mode, do not show I/O statistics\n"
" -u, -- with -z, allow unmapping\n"
" -z, -- write zeroes using blk_aio_write_zeroes\n"
@@ -1380,7 +1387,7 @@ static const cmdinfo_t aio_write_cmd = {
.cfunc = aio_write_f,
.argmin = 2,
.argmax = -1,
- .args = "[-Cfquz] [-P pattern] off len [len..]",
+ .args = "[-Cfiquz] [-P pattern] off len [len..]",
.oneline = "asynchronously writes a number of bytes",
.help = aio_write_help,
};
@@ -1393,7 +1400,7 @@ static int aio_write_f(BlockBackend *blk, int argc, char **argv)
int flags = 0;
ctx->blk = blk;
- while ((c = getopt(argc, argv, "CfqP:uz")) != -1) {
+ while ((c = getopt(argc, argv, "CfiqP:uz")) != -1) {
switch (c) {
case 'C':
ctx->Cflag = true;
@@ -1414,6 +1421,11 @@ static int aio_write_f(BlockBackend *blk, int argc, char **argv)
return 0;
}
break;
+ case 'i':
+ printf("injecting invalid write request\n");
+ block_acct_invalid(blk_get_stats(blk), BLOCK_ACCT_WRITE);
+ g_free(ctx);
+ return 0;
case 'z':
ctx->zflag = true;
break;