aboutsummaryrefslogtreecommitdiff
path: root/block/qapi.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2014-05-22 13:28:45 +0200
committerKevin Wolf <kwolf@redhat.com>2014-12-10 10:31:09 +0100
commit9e193c5a652faff719d7186e27f680e3888925a6 (patch)
treea1e25e3f0078e5d407440252e6dd26c744c87455 /block/qapi.c
parent729962f6db43bf262a446f5e13d900ffb3c54a88 (diff)
block/qapi: Add cache information to query-block
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'block/qapi.c')
-rw-r--r--block/qapi.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/block/qapi.c b/block/qapi.c
index 3a14559ca0..fa68ba731f 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -40,6 +40,13 @@ BlockDeviceInfo *bdrv_block_device_info(BlockDriverState *bs)
info->encrypted = bs->encrypted;
info->encryption_key_missing = bdrv_key_required(bs);
+ info->cache = g_new(BlockdevCacheInfo, 1);
+ *info->cache = (BlockdevCacheInfo) {
+ .writeback = bdrv_enable_write_cache(bs),
+ .direct = !!(bs->open_flags & BDRV_O_NOCACHE),
+ .no_flush = !!(bs->open_flags & BDRV_O_NO_FLUSH),
+ };
+
if (bs->node_name[0]) {
info->has_node_name = true;
info->node_name = g_strdup(bs->node_name);