[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH RFC v3 1/2] block/qapi: reduce the coupling betw
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH RFC v3 1/2] block/qapi: reduce the coupling between the bdrv_query_stats and bdrv_query_bds_stats |
Date: |
Fri, 13 Jan 2017 09:00:49 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 |
On 01/04/2017 12:58 AM, Dou Liyang wrote:
> the bdrv_query_stats and bdrv_query_bds_stats functions need to call
> each other, that increases the coupling. it also makes the program
> complicated and makes some unnecessary judgements.
s/judgements/judgments/ - although I wonder if 'tests' would be a
simpler word.
>
> remove the call from bdrv_query_bds_stats to bdrv_query_stats, just
> take some recursion to make it clearly.
>
> avoid judging whether the blk is NULL during querying the bds stats.
Again, 'testing' might read nicer than 'judging'.
> it is unnecessary.
>
> Signed-off-by: Dou Liyang <address@hidden>
> ---
> block/qapi.c | 26 ++++++++++++++------------
> 1 file changed, 14 insertions(+), 12 deletions(-)
>
> -static void bdrv_query_bds_stats(BlockStats *s, const BlockDriverState *bs,
> +static BlockStats *bdrv_query_bds_stats(const BlockDriverState *bs,
> bool query_backing)
> {
> + BlockStats *s = NULL;
> +
> + s = g_malloc0(sizeof(*s));
Dead initialization to NULL since the very next statement overwrites it.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature