[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC V6 12/33] qcow2: Makes qcow2_alloc_cluster_link_l2
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [RFC V6 12/33] qcow2: Makes qcow2_alloc_cluster_link_l2 mark to deduplicate clusters. |
Date: |
Thu, 7 Feb 2013 10:43:19 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Wed, Feb 06, 2013 at 01:31:45PM +0100, Benoît Canet wrote:
> ---
> block/qcow2-cluster.c | 8 ++++++--
> block/qcow2-dedup.c | 7 +++++++
> block/qcow2.h | 3 +++
> 3 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
> index dbcb6d2..ef91216 100644
> --- a/block/qcow2-cluster.c
> +++ b/block/qcow2-cluster.c
> @@ -709,6 +709,7 @@ int qcow2_alloc_cluster_link_l2(BlockDriverState *bs,
> QCowL2Meta *m)
> qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_table);
>
> for (i = 0; i < m->nb_clusters; i++) {
> + uint64_t flags = 0;
> /* if two concurrent writes happen to the same unallocated cluster
> * each write allocates separate cluster and writes data concurrently.
> * The first one to complete updates l2 table with pointer to its
> @@ -718,9 +719,11 @@ int qcow2_alloc_cluster_link_l2(BlockDriverState *bs,
> QCowL2Meta *m)
> if(l2_table[l2_index + i] != 0)
> old_cluster[j++] = l2_table[l2_index + i];
>
> + flags = m->oflag_copied ? QCOW_OFLAG_COPIED : 0;
> + flags |= m->to_deduplicate ? QCOW_OFLAG_TO_DEDUP : 0;
It would be easier to have a m->l2_entry_flags field that is ORed in.
Then we don't need separate fields for QCOW_OFLAG_COPIED and
QCOW_OFLAG_TO_DEDUP, or code to check them and build flags.
- [Qemu-devel] [RFC V6 04/33] qcow2: Add qcow2_de dup_read_missing_and_concatenate, (continued)
- [Qemu-devel] [RFC V6 04/33] qcow2: Add qcow2_de dup_read_missing_and_concatenate, Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V6 06/33] qcow2: Create a way to link to l2 tables when deduplicating., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V6 05/33] qcow2: Make update_refcount public., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V6 11/33] qcow2: Add qcow2_dedup_grow_table and use it., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V6 12/33] qcow2: Makes qcow2_alloc_cluster_link_l2 mark to deduplicate clusters., Benoît Canet, 2013/02/06
- Re: [Qemu-devel] [RFC V6 12/33] qcow2: Makes qcow2_alloc_cluster_link_l2 mark to deduplicate clusters.,
Stefan Hajnoczi <=
- [Qemu-devel] [RFC V6 17/33] qcow2-cache: Allow to choose table size at creation., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V6 15/33] qcow2: Load and save deduplication table header extension., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V6 18/33] qcow2: Extract qcow2_add_feature and qcow2_remove_feature., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V6 16/33] qcow2: Extract qcow2_do_table_init., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V6 20/33] qcow2: Add a deduplication boolean to update_refcount., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V6 21/33] qcow2: Drop hash for a given cluster when dedup makes refcount > 2^16/2., Benoît Canet, 2013/02/06