Go to file
Tom Marshall c4aabad212 Rename lbatpage to lbatpblk
This is more accurate, and will matter if pblk size is variable.
2019-11-11 21:07:11 +01:00
cbd Make cbd check actually do a check and do some cleanup 2019-11-11 20:48:46 +01:00
dm-compress Rename lbatpage to lbatpblk 2019-11-11 21:07:11 +01:00
include Rename lbatpage to lbatpblk 2019-11-11 21:07:11 +01:00
libcbd Make cbd check actually do a check and do some cleanup 2019-11-11 20:48:46 +01:00
.gitignore Add a .gitignore 2019-10-09 11:35:16 -07:00
Makefile Rename lbatpage to lbatpblk 2019-11-11 21:07:11 +01:00
README Start implementing stats 2019-11-04 12:25:54 -08:00
TODO Reset objects outside cache lock 2019-11-04 11:36:20 -08:00

README

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