block/qapi: reduce the execution time of qmp_query_blockstats
commita6baa60807f88ba7d97b1787797fb58882ccbfb9
authorDou Liyang <douly.fnst@cn.fujitsu.com>
Sun, 15 Jan 2017 08:01:15 +0000 (15 16:01 +0800)
committerMax Reitz <mreitz@redhat.com>
Sat, 11 Feb 2017 23:47:42 +0000 (12 00:47 +0100)
tree2422b1d9b02c72567b70e7cd63e8ca25957175f4
parent20a6d768f5c1a590d8a42c343aa862f89966cb23
block/qapi: reduce the execution time of qmp_query_blockstats

In order to reduce the execution time, this patch optimize
the qmp_query_blockstats():
Remove the next_query_bds function.
Remove the bdrv_query_stats function.
Remove some judgement sentence.

The original qmp_query_blockstats calls next_query_bds to get
the next objects in each loops. In the next_query_bds, it checks
the query_nodes and blk. It also call bdrv_query_stats to get
the stats, In the bdrv_query_stats, it checks blk and bs each
times. This waste more times, which may stall the main loop a
bit. And if the disk is too many and donot use the dataplane
feature, this may affect the performance in main loop thread.

This patch removes that two functions, and makes the structure
clearly.

Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
Message-id: 1484467275-27919-3-git-send-email-douly.fnst@cn.fujitsu.com
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[mreitz: Removed duplicate info->value assignment]
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/qapi.c