[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 6/6] qemu-io: Add write -n for BDRV_REQ_NO_FALLBACK
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PATCH 6/6] qemu-io: Add write -n for BDRV_REQ_NO_FALLBACK |
Date: |
Fri, 22 Mar 2019 14:21:47 +0100 |
This makes the new BDRV_REQ_NO_FALLBACK flag available in the qemu-io
write command.
Signed-off-by: Kevin Wolf <address@hidden>
---
qemu-io-cmds.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
index 35dcdcf413..09750a23ce 100644
--- a/qemu-io-cmds.c
+++ b/qemu-io-cmds.c
@@ -946,6 +946,7 @@ static void write_help(void)
" -b, -- write to the VM state rather than the virtual disk\n"
" -c, -- write compressed data with blk_write_compressed\n"
" -f, -- use Force Unit Access semantics\n"
+" -n, -- with -z, don't allow slow fallback\n"
" -p, -- ignored for backwards compatibility\n"
" -P, -- use different pattern to fill file\n"
" -C, -- report statistics in a machine parsable format\n"
@@ -964,7 +965,7 @@ static const cmdinfo_t write_cmd = {
.perm = BLK_PERM_WRITE,
.argmin = 2,
.argmax = -1,
- .args = "[-bcCfquz] [-P pattern] off len",
+ .args = "[-bcCfnquz] [-P pattern] off len",
.oneline = "writes a number of bytes at a specified offset",
.help = write_help,
};
@@ -983,7 +984,7 @@ static int write_f(BlockBackend *blk, int argc, char **argv)
int64_t total = 0;
int pattern = 0xcd;
- while ((c = getopt(argc, argv, "bcCfpP:quz")) != -1) {
+ while ((c = getopt(argc, argv, "bcCfnpP:quz")) != -1) {
switch (c) {
case 'b':
bflag = true;
@@ -997,6 +998,9 @@ static int write_f(BlockBackend *blk, int argc, char **argv)
case 'f':
flags |= BDRV_REQ_FUA;
break;
+ case 'n':
+ flags |= BDRV_REQ_NO_FALLBACK;
+ break;
case 'p':
/* Ignored for backwards compatibility */
break;
@@ -1037,6 +1041,11 @@ static int write_f(BlockBackend *blk, int argc, char
**argv)
return -EINVAL;
}
+ if ((flags & BDRV_REQ_NO_FALLBACK) && !zflag) {
+ printf("-n requires -z to be specified\n");
+ return -EINVAL;
+ }
+
if ((flags & BDRV_REQ_MAY_UNMAP) && !zflag) {
printf("-u requires -z to be specified\n");
return -EINVAL;
--
2.20.1
- [Qemu-block] [PATCH 0/6] block: Fix slow pre-zeroing in qemu-img convert, Kevin Wolf, 2019/03/22
- [Qemu-block] [PATCH 6/6] qemu-io: Add write -n for BDRV_REQ_NO_FALLBACK,
Kevin Wolf <=
- [Qemu-block] [PATCH 5/6] qemu-img: Use BDRV_REQ_NO_FALLBACK for pre-zeroing, Kevin Wolf, 2019/03/22
- [Qemu-block] [PATCH 4/6] file-posix: Support BDRV_REQ_NO_FALLBACK for zero writes, Kevin Wolf, 2019/03/22
- [Qemu-block] [PATCH 3/6] block: Advertise BDRV_REQ_NO_FALLBACK in filter drivers, Kevin Wolf, 2019/03/22
- [Qemu-block] [PATCH 2/6] block: Add BDRV_REQ_NO_FALLBACK, Kevin Wolf, 2019/03/22
- [Qemu-block] [PATCH 1/6] block: Remove error messages in bdrv_make_zero(), Kevin Wolf, 2019/03/22
- Re: [Qemu-block] [PATCH 0/6] block: Fix slow pre-zeroing in qemu-img convert, Eric Blake, 2019/03/22
- Re: [Qemu-block] [PATCH 0/6] block: Fix slow pre-zeroing in qemu-img convert, Nir Soffer, 2019/03/22