No Description
Tom Marshall d87de4e238 WIP: Add info command 3 months ago
cbd WIP: Add info command 3 months ago
dm-compress Simplify lbd a bit, as logical block shift cannot be zero 4 months ago
include WIP: Add info command 3 months ago
libcbd WIP: Add info command 3 months ago
.gitignore Add ignore for newer kernel module build outputs 4 months ago
Makefile WIP: Add info command 3 months ago
README Remove variable pblk and pbat sizes, optimize, and cleanup 4 months ago
TODO Reset objects outside cache lock 1 year ago

README

This is a device mapper block compression driver.

Note:
- Sectors are always 512 bytes (kernel constant).
- Physical blocks are always 4kb.
- Logical blocks are variable 4kb .. 4mb.
- All integers are little endian.

Block device layout:
- pblk[0] header (512 bytes)
/* Offset 0: magic and version */
- byte[4] magic
- u16 version_major
- u16 version_minor
/* Offset 8: parameters */
- u16 flags
- u8 compression
hi nybble: algorithm (1=lz4, 2=zlib, ...) [1]
lo nybble: level (1..9) [1]
- u8 lblk_shift (1..10) [4 = 64kb (*)]
- u8 lba_elem_pblk_bytes (2, 4, 6)
- u8[3] pad
- u32 nr_zones
- u32 lblk_per_zone
- byte[40] reserved
/* Offset 64: stats */
- u64 pblk_used
- u64 lblk_used
- byte[48] reserved
/* Offset 128: reserved */
- byte[384] reserved
- pblk[] zone ... vector of zone

(*) The maximum lblk_shift may be less than 10 because lblk_alloc size
must be <= pblk size.

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_shift lblk_size device pblks
=========== ===== ========== ========= ============
lblk_alloc_16_16 2+2*n 1..10 <= 64kb <= 64k
lblk_alloc_16_32 2+4*n 1..9 <= 64kb <= 4g
lblk_alloc_16_48 2+6*n 1..9 <= 64kb <= 256t
lblk_alloc_32_16 4+2*n 1..10 > 64kb <= 64k
lblk_alloc_32_32 4+4*n 1..9 > 64kb <= 4g
lblk_alloc_32_48 4+6*n 1..9 > 64kb <= 256t


Zone layout:
- byte[pblk_size] Physical block allocation table (pbat)
- lblk_alloc_x_y[] Logical block allocation table (lbat)
Note: padded to pblk size
- data[] Data
One pblk per bit in pbat