[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC V1 12/14] qcow2: Add qcow2_dedup_update_metrics to
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [RFC V1 12/14] qcow2: Add qcow2_dedup_update_metrics to compute dedup RAM usage. |
Date: |
Wed, 16 Jan 2013 13:10:12 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
On 01/16/2013 09:25 AM, Benoît Canet wrote:
> ---
> block/qcow2-dedup.c | 13 +++++++++++++
> block/qcow2.h | 1 +
> 2 files changed, 14 insertions(+)
>
> diff --git a/block/qcow2-dedup.c b/block/qcow2-dedup.c
> index db23b71..4305746 100644
> --- a/block/qcow2-dedup.c
> +++ b/block/qcow2-dedup.c
> @@ -1311,3 +1311,16 @@ void qcow2_dedup_close(BlockDriverState *bs)
> {
> qcow2_dedup_free(bs);
> }
> +
> +#define GTREE_NODE_SIZE sizeof(int) * 5
Improperly parenthesized. Also, this feels like a magic number, is
there an actual sizeof(struct) you could use instead of hand-computing
how much is used per node?
> +
> +void qcow2_dedup_update_metrics(BlockDriverState *bs)
> +{
> + BDRVQcowState *s = bs->opaque;
> +
> + uint64_t nb_hashs = s->dedup_metrics.ram_hash_creations -
> + s->dedup_metrics.ram_hash_deletions;
> +
> + s->dedup_metrics.ram_usage = nb_hashs * GTREE_NODE_SIZE * 2;
But you got lucky that order of operations didn't care about the missing
() here.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [RFC V1 07/14] qcow2: Count QCowHashNode removal from tree for metrics., (continued)
- [Qemu-devel] [RFC V1 07/14] qcow2: Count QCowHashNode removal from tree for metrics., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V1 06/14] qcow2: Count QCowHashNode creation metrics., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V1 10/14] qapi: Add support for deduplication infos in qapi-schema.json., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V1 14/14] qapi: Return virtual block device deduplication metrics in QMP, Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V1 13/14] qcow2: returns deduplication metrics and status via bdrv_get_info(), Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V1 11/14] block: Add deduplication metrics to BlockDriverInfo., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V1 12/14] qcow2: Add qcow2_dedup_update_metrics to compute dedup RAM usage., Benoît Canet, 2013/01/16
- Re: [Qemu-devel] [RFC V1 12/14] qcow2: Add qcow2_dedup_update_metrics to compute dedup RAM usage.,
Eric Blake <=