BLOCK MAP ENTRIES(9)
π Block map entries (9) π
okay so this is from the Kernel API Manual, section 9, and it's all about the little five-byte glow-up that is a block map entry. bestie, it's giving efficient. π
β¨ NAME β¨
Block map entries β the tiny packed representation of every logical block in the block map, section 9, kernel API vibes only π¦
πΈ DESCRIPTION πΈ
so here's the tea: the entry for each logical block in the block map gets encoded into five bytes total. five. that's it. and the whole point is that it saves space in both the on-disk layout and the in-memory layout β a double slay, no cap π β¨
each entry is made of:
- the 36 low-order bits of a
physical_block_number_tβ which addresses 256 terabytes when your block size is 4KB, iconic capacity behavior honestly π - a 4-bit encoding of a
block_mapping_state
now, of the 8 high bits of that 5-byte structure, it's split like this:
- Bits 7..4: the four highest bits of the 36-bit physical block number
- Bits 3..0: the 4-bit
block_mapping_state
and then the following 4 bytes are the low order bytes of the physical block number, in little-endian order. endianness girlies rise π«Ά
also: conversion functions to and from a data location are provided. they're literally right there. use them, don't hand-roll the bit shuffling, i'm begging π
π¦ SEE ALSO π¦
start with the kernel file itself, she's the main character:
- Kernel file
./drivers/md/dm-vdo/encodings.h
and then the whole friend group, in order, no skips π₯
vdo_are_same_version(9)vdo_pack_version_number(9)vdo_unpack_version_number(9)vdo_pack_header(9)vdo_unpack_header(9)vdo_get_index_region_start(9)vdo_get_data_region_start(9)vdo_get_index_region_size(9)vdo_pack_recovery_journal_entry(9)vdo_unpack_recovery_journal_entry(9)vdo_is_valid_recovery_journal_sector(9)vdo_compute_recovery_journal_block_number(9)vdo_get_journal_block_sector(9)vdo_pack_recovery_block_header(9)vdo_unpack_recovery_block_header(9)vdo_compute_slab_count(9)vdo_get_saved_reference_count_size(9)vdo_get_slab_journal_start_block(9)vdo_advance_journal_point(9)vdo_before_journal_point(9)vdo_pack_journal_point(9)vdo_unpack_journal_point(9)vdo_pack_slab_journal_block_header(9)vdo_unpack_slab_journal_block_header(9)vdo_pack_slab_journal_entry(9)vdo_unpack_slab_journal_entry(9)vdo_get_slab_summary_hint_shift(9)
that's the whole page, bestie, go read encodings.h and prosper π
source: ./drivers/md/dm-vdo β dated October 2026 β mwah, xoxo, the kernel API manual π§ββοΈβ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms