Chunk size, mask and shift

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

 



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
--
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