|
|
383d26 |
From de5542b5a8dc74f413bf2f1b0d5f4b370aa6801b Mon Sep 17 00:00:00 2001
|
|
|
383d26 |
From: Maxim Levitsky <mlevitsk@redhat.com>
|
|
|
383d26 |
Date: Wed, 5 Jun 2019 13:57:05 +0200
|
|
|
383d26 |
Subject: [PATCH 17/23] qemu-io: Add write -n for BDRV_REQ_NO_FALLBACK
|
|
|
383d26 |
|
|
|
383d26 |
RH-Author: Maxim Levitsky <mlevitsk@redhat.com>
|
|
|
383d26 |
Message-id: <20190605135705.24526-10-mlevitsk@redhat.com>
|
|
|
383d26 |
Patchwork-id: 88565
|
|
|
383d26 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 9/9] qemu-io: Add write -n for BDRV_REQ_NO_FALLBACK
|
|
|
383d26 |
Bugzilla: 1648622
|
|
|
383d26 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
383d26 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
383d26 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
383d26 |
|
|
|
383d26 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
383d26 |
|
|
|
383d26 |
This makes the new BDRV_REQ_NO_FALLBACK flag available in the qemu-io
|
|
|
383d26 |
write command.
|
|
|
383d26 |
|
|
|
383d26 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
383d26 |
Acked-by: Eric Blake <eblake@redhat.com>
|
|
|
383d26 |
|
|
|
383d26 |
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1648622
|
|
|
383d26 |
|
|
|
383d26 |
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
|
|
|
383d26 |
(Cherry picked from c6e3f520c802c5cb2de80576aba7f9f1fe985d8b)
|
|
|
383d26 |
|
|
|
383d26 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
383d26 |
---
|
|
|
383d26 |
qemu-io-cmds.c | 13 +++++++++++--
|
|
|
383d26 |
1 file changed, 11 insertions(+), 2 deletions(-)
|
|
|
383d26 |
|
|
|
383d26 |
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
|
|
|
383d26 |
index 9c51e57..ac8c533 100644
|
|
|
383d26 |
--- a/qemu-io-cmds.c
|
|
|
383d26 |
+++ b/qemu-io-cmds.c
|
|
|
383d26 |
@@ -945,6 +945,7 @@ static void write_help(void)
|
|
|
383d26 |
" -b, -- write to the VM state rather than the virtual disk\n"
|
|
|
383d26 |
" -c, -- write compressed data with blk_write_compressed\n"
|
|
|
383d26 |
" -f, -- use Force Unit Access semantics\n"
|
|
|
383d26 |
+" -n, -- with -z, don't allow slow fallback\n"
|
|
|
383d26 |
" -p, -- ignored for backwards compatibility\n"
|
|
|
383d26 |
" -P, -- use different pattern to fill file\n"
|
|
|
383d26 |
" -C, -- report statistics in a machine parsable format\n"
|
|
|
383d26 |
@@ -963,7 +964,7 @@ static const cmdinfo_t write_cmd = {
|
|
|
383d26 |
.perm = BLK_PERM_WRITE,
|
|
|
383d26 |
.argmin = 2,
|
|
|
383d26 |
.argmax = -1,
|
|
|
383d26 |
- .args = "[-bcCfquz] [-P pattern] off len",
|
|
|
383d26 |
+ .args = "[-bcCfnquz] [-P pattern] off len",
|
|
|
383d26 |
.oneline = "writes a number of bytes at a specified offset",
|
|
|
383d26 |
.help = write_help,
|
|
|
383d26 |
};
|
|
|
383d26 |
@@ -982,7 +983,7 @@ static int write_f(BlockBackend *blk, int argc, char **argv)
|
|
|
383d26 |
int64_t total = 0;
|
|
|
383d26 |
int pattern = 0xcd;
|
|
|
383d26 |
|
|
|
383d26 |
- while ((c = getopt(argc, argv, "bcCfpP:quz")) != -1) {
|
|
|
383d26 |
+ while ((c = getopt(argc, argv, "bcCfnpP:quz")) != -1) {
|
|
|
383d26 |
switch (c) {
|
|
|
383d26 |
case 'b':
|
|
|
383d26 |
bflag = true;
|
|
|
383d26 |
@@ -996,6 +997,9 @@ static int write_f(BlockBackend *blk, int argc, char **argv)
|
|
|
383d26 |
case 'f':
|
|
|
383d26 |
flags |= BDRV_REQ_FUA;
|
|
|
383d26 |
break;
|
|
|
383d26 |
+ case 'n':
|
|
|
383d26 |
+ flags |= BDRV_REQ_NO_FALLBACK;
|
|
|
383d26 |
+ break;
|
|
|
383d26 |
case 'p':
|
|
|
383d26 |
/* Ignored for backwards compatibility */
|
|
|
383d26 |
break;
|
|
|
383d26 |
@@ -1036,6 +1040,11 @@ static int write_f(BlockBackend *blk, int argc, char **argv)
|
|
|
383d26 |
return -EINVAL;
|
|
|
383d26 |
}
|
|
|
383d26 |
|
|
|
383d26 |
+ if ((flags & BDRV_REQ_NO_FALLBACK) && !zflag) {
|
|
|
383d26 |
+ printf("-n requires -z to be specified\n");
|
|
|
383d26 |
+ return -EINVAL;
|
|
|
383d26 |
+ }
|
|
|
383d26 |
+
|
|
|
383d26 |
if ((flags & BDRV_REQ_MAY_UNMAP) && !zflag) {
|
|
|
383d26 |
printf("-u requires -z to be specified\n");
|
|
|
383d26 |
return -EINVAL;
|
|
|
383d26 |
--
|
|
|
383d26 |
1.8.3.1
|
|
|
383d26 |
|