summaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2016-03-21 14:11:42 +0000
committerKevin Wolf <kwolf@redhat.com>2016-03-30 11:59:32 +0200
commitabb06c5ac1c86e747bbe08bf7b5b69723ad69832 (patch)
tree227d67569c4069dbb356410cbf77e0544224bda8 /block.c
parent543021569978c908fccff235bf90fc803e6fed1d (diff)
downloadqemu-abb06c5ac1c86e747bbe08bf7b5b69723ad69832.tar.gz
qemu-abb06c5ac1c86e747bbe08bf7b5b69723ad69832.tar.bz2
qemu-abb06c5ac1c86e747bbe08bf7b5b69723ad69832.zip
block: add flag to indicate that no I/O will be performed
When opening an image it is useful to know whether the caller intends to perform I/O on the image or not. In the case of encrypted images this will allow the block driver to avoid having to prompt for decryption keys when we merely want to query header metadata about the image. eg qemu-img info This flag is enforced at the top level only, since even if we don't want todo I/O on the 'qcow2' file payload, the underlying 'file' driver will still need todo I/O to read the qcow2 header, for example. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/block.c b/block.c
index 4158a3a36f..b4bec4b1e6 100644
--- a/block.c
+++ b/block.c
@@ -702,7 +702,8 @@ static void bdrv_inherited_options(int *child_flags, QDict *child_options,
flags |= BDRV_O_UNMAP;
/* Clear flags that only apply to the top layer */
- flags &= ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING | BDRV_O_COPY_ON_READ);
+ flags &= ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING | BDRV_O_COPY_ON_READ |
+ BDRV_O_NO_IO);
*child_flags = flags;
}
@@ -722,7 +723,7 @@ static void bdrv_inherited_fmt_options(int *child_flags, QDict *child_options,
child_file.inherit_options(child_flags, child_options,
parent_flags, parent_options);
- *child_flags &= ~BDRV_O_PROTOCOL;
+ *child_flags &= ~(BDRV_O_PROTOCOL | BDRV_O_NO_IO);
}
const BdrvChildRole child_format = {