[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: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [RFC V6 07/33] qcow2: Add qcow2_dedup and related functions |
Date: |
Wed, 6 Feb 2013 22:19:20 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Wed, Feb 06, 2013 at 01:31:40PM +0100, Benoît Canet wrote:
> +/* Deduplicate all the cluster that can be deduplicated.
> + *
> + * Next it compute the number of non deduplicable sectors to come while
> storing
s/compute/computes/
> + * the hashes of these sectors in a linked list for later usage.
> + * Then it compute the first duplicated cluster hash that come after non
s/compute/computes/
s/come/comes/
> + * deduplicable cluster, this hash will be used at next call of the function
> + *
> + * @ds: a structure containing the state of the deduplication
> + * for this write request
> + * @sector_num: The logical sector
> + * @data: the buffer containing the data to deduplicate
> + * @data_nr: the size of the buffer in sectors
> + *
> + */
> +int qcow2_dedup(BlockDriverState *bs,
> + QCowDedupState *ds,
> + uint64_t sector_num,
> + uint8_t *data,
> + int data_nr)
> +{
> + BDRVQcowState *s = bs->opaque;
> + int ret = 0;
> + int deduped_clusters_nr = 0;
> + int left_to_process;
> + int begining_index;
> +
> + begining_index = sector_num & (s->cluster_sectors - 1);
s/begining/beginning/ but start_index would be shorter.
> +
> + left_to_process = (data_nr / s->cluster_sectors) -
> + ds->nb_clusters_processed;
data_nr must be a multiple of cluster_sectors?
- [Qemu-devel] [RFC V6 31/33] qcow: Set large dedup hash block size., (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