[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[dm-devel] Chunk size, mask and shift
- From: Guilherme Moro <guilherme moro gmail com>
- To: dm-devel redhat com
- Subject: [dm-devel] Chunk size, mask and shift
- Date: Wed, 19 Aug 2009 11:58:48 -0300
hello,
Im trying to understand the dm-snapshot target, but Im not sure how it uses the size, mask and shift of the chunks, not sure if I understand it correctly.
Can anyone give an overall idea of why they are initialized this way
store->chunk_size = chunk_size_ulong;
store->chunk_mask = chunk_size_ulong - 1;
store->chunk_shift = ffs(chunk_size_ulong) - 1;
and why use this to translate sector to chunks
static inline chunk_t sector_to_chunk(struct dm_exception_store *store,
sector_t sector)
{
return (sector & ~store->chunk_mask) >> store->chunk_shift;
}
thanks,
Guilherme Moro
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]