Re: [PATCH RFCv2 02/10] dm-dedup: core deduplication logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 28, 2014 at 06:02:11PM -0400, Vasily Tarasov wrote:

[..]
> +/*
> + * Creates a bitmap of all PBNs in use by walking through
> + * kvs_lbn_pbn. Then walks through kvs_hash_pbn and deletes
> + * any entries which do not have an lbn-to-pbn mapping.
> + */
> +static int mark_and_sweep(struct dedup_config *dc)
> +{
> +	int err = 0;
> +	uint64_t data_size = 0;
> +	uint64_t bitmap_size = 0;
> +	struct mark_and_sweep_data ms_data;
> +
> +	BUG_ON(!dc);
> +
> +	data_size = i_size_read(dc->data_dev->bdev->bd_inode);
> +	bitmap_size = data_size / dc->block_size;
> +
> +	memset(&ms_data, 0, sizeof(struct mark_and_sweep_data));
> +
> +	ms_data.bitmap = vmalloc(BITS_TO_LONGS(bitmap_size) *
> +			sizeof(unsigned long));
> +	if (!ms_data.bitmap) {
> +		DMERR("Could not vmalloc ms_data.bitmap");
> +		err = -ENOMEM;
> +		goto out;
> +	}
> +	bitmap_zero(ms_data.bitmap, bitmap_size);
> +
> +	ms_data.bitmap_len = bitmap_size;
> +	ms_data.cleanup_count = 0;
> +	ms_data.dc = dc;
> +
> +	/* Create bitmap of used pbn blocks */
> +	err = dc->kvs_lbn_pbn->kvs_iterate(dc->kvs_lbn_pbn,
> +			&mark_lbn_pbn_bitmap, (void *)&ms_data);
> +	if (err < 0)
> +		goto out_free;
> +
> +	/* Cleanup hashes based on above bitmap of used pbn blocks */
> +	err = dc->kvs_hash_pbn->kvs_iterate(dc->kvs_hash_pbn,
> +			&cleanup_hash_pbn, (void *)&ms_data);

How does the locking work in general for this target. So far I have not
seen any locks being taken anywhere. I want to know what's the thought
process and what locks are where and what are they protecting.

For example, here, we create a bitmap of unused pbn first and then
go on to remove those pbn. How do we know that some unused pbn
did not get reused again by the time we called cleanup_hash_pbn.

I see that last patch in the series removed mark_and_sweep logic
and replaced with garbage_collect. Please rework the series so that
mark_and_sweep is not introduced to begin with.

Thanks
Vivek

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux