[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC V6 07/33] qcow2: Add qcow2_dedup and related funct
From: |
Benoît Canet |
Subject: |
Re: [Qemu-devel] [RFC V6 07/33] qcow2: Add qcow2_dedup and related functions |
Date: |
Wed, 6 Feb 2013 19:10:50 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
> > +/*
> > + * Build a QCowHashNode from a given QCowHash and insert it into the tree
> > + *
> > + * @hash: the given QCowHash
> > + */
> > +static void qcow2_build_and_insert_hash_node(BlockDriverState *bs,
> > + QCowHash *hash)
> > +{
> > + BDRVQcowState *s = bs->opaque;
> > + QCowHashNode *hash_node;
> > +
> > + /* build the hash node with QCOW_FLAG_EMPTY as offsets so we will
> > remember
> > + * to fill these field later with real values.
> > + */
> > + hash_node = qcow2_dedup_build_qcow_hash_node(hash,
> > + QCOW_FLAG_EMPTY,
> > + QCOW_FLAG_EMPTY);
> > + g_tree_insert(s->dedup_tree_by_hash, &hash_node->hash, hash_node);
> > +}
>
> Interesting function, it doesn't return hash_node. Someone will have to
> look it up.
>
> Also, we put an incomplete node into dedup_tree_by_hash. The caller
> must ensure that other coroutines do not use dedup_tree_by_hash() before
> we've filled in real values, or the callers need to check for
> QCOW_FLAG_EMPTY. Seems a little risky, so why insert before completing
> the hash node?
>
It's done like this so the next iteration of the deduplication loop
will find that a cluster is duplicated if so and stop rigth here.
I can fill the missing information of the qcow hash node only long after that
when the new cluster cluster is allocated.
- Re: [Qemu-devel] [RFC V6 32/33] qemu-iotests: Filter dedup=on/off so existing tests don't break., (continued)
- [Qemu-devel] [RFC V6 31/33] qcow: Set large dedup hash block size., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V6 33/33] qcow2: Add qcow2_dedup_init and qcow2_dedup_close., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V6 08/33] qcow2: Add qcow2_dedup_store_new_hashes., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V6 27/33] qcow2: Adapt checking of QCOW_OFLAG_COPIED for dedup., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V6 07/33] qcow2: Add qcow2_dedup and related functions, Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V6 13/33] qcow2: make the deduplication forget a cluster hash when a cluster is to dedupe, Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V6 29/33] qcow2: Do not overwrite existing entries with QCOW_OFLAG_COPIED., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V6 26/33] qcow2: Add verification of dedup table., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V6 23/33] qcow2: Add qcow2_dedup_is_running to probe if dedup is running., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V6 24/33] qcow2: Integrate deduplication in qcow2_co_writev loop., Benoît Canet, 2013/02/06