BLOCK MAP ENTRIES(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 πŸ”₯


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