cbd/README

51 lines
1.8 KiB
Plaintext
Raw Normal View History

This is a device mapper block compression driver.
Note:
- Sectors are always 512 bytes (kernel constant).
- Physical blocks are always 4kb (internal constant).
- Logical blocks are variable 4kb .. 1gb.
- All integers are little endian.
Block device layout:
- byte[4096] header
/* Offset 0 */
- byte[4] magic
- u16 version_major
- u16 version_minor
- u16 flags
- u8 algorithm (1=lz4, 2=zlib, ...) [1]
- u8 compression (1..9) [1]
- u16 pbat_len [1]
- u16 lblk_shift (1..18) [4 = 64kb]
- u64 nr_pblk
- u32 nr_zones
- u32 lblk_per_zone
- byte[32] reserved
/* Offset 64 */
- u64 pblk_alloc
- byte[] reserved
- byte[] zone ... vector of zone
Device size limits:
- Min: header plus one zone (header, pbat, lbat, data)
Arbitrarily limit to 1mb (?)
- Max: 2^48 pblk = 1eb
There are six different lblk_alloc sizes:
Struct name Size lblk_size device_pblk_size
=========== ==== ========= ================
lblk_alloc_16_16 2+2*8 <= 64kb <= 64k
lblk_alloc_16_32 2+4*8 <= 64kb <= 4g
lblk_alloc_16_48 2+6*8 <= 64kb <= 256t
lblk_alloc_32_16 4+2*8 > 64kb <= 64k
lblk_alloc_32_32 4+4*8 > 64kb <= 4g
lblk_alloc_32_48 4+6*8 > 64kb <= 256t
Zone layout:
- byte[4k*pbat_len] Physical block allocation table (pbat)
- lblk_alloc_x_y[] Logical block allocation table (lbat)
Note: padded to pblk size
- data[4k*pbat_len*4k*8] Data
One pblk per bit in pbat