check_mapping(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… check_mapping(9) β€” the kernel api manual, but make it make sense πŸŽ€

okay so bestie, welcome to check_mapping(9) from the Kernel API Manual ✨ this one's a lil UBI detective story and honestly it ate. let's get into it 🫢


🌸 NAME 🌸

check_mapping β€” check and fixup a mapping πŸ’– (yes, both. it checks and it fixes, she's multifunctional)


✨ SYNOPSIS ✨

int check_mapping (struct ubi_device *ubi , struct ubi_volume *vol , int
lnum , int *pnum );

literally the whole signature, character for character, no cap πŸ”₯


πŸ¦‹ ARGUMENTS πŸ¦‹

  • ubi β€” the UBI device description object, aka the big boss device πŸ’…
  • vol β€” the volume description object, her volume bestie πŸŽ€
  • lnum β€” logical eraseblock number, the LEB in question ✨
  • pnum β€” physical eraseblock number, the PEB that's supposedly behind it πŸ‘‘

πŸ’œ DESCRIPTION πŸ’œ

so here's the vibe check πŸ‘€ β€” this function checks whether a given mapping is actually valid. sounds simple right? it's giving "just look at it" but it's NOT, okay 😭

here's the plot twist: Fastmap cannot track LEB unmap operations. like, it just can't, bless her. so if such an unmapping operation gets interrupted mid-way, the mapping still looks good β€” totally fine, nothing to see here β€” but the moment somebody does the first read, an ECC gets reported to the upper layer πŸ’€ rude.

normally this gets patched up during the full-scan at attach time, so it's all chill. but for Fastmap? nope, we've gotta deal with it while reading, live, in the moment, main character energy πŸ”₯

and if the PEB behind a LEB is showing this symptom (the original calls it "symthom" and honestly, we respect the spelling, we're keeping the energy πŸ™ˆ), then we change the mapping to UBI_LEB_UNMAPPED and schedule that PEB for erasure. bye girl πŸ‘‹ she's getting wiped.

returns 0 on success, or a negative error code in case of failure 😭 that's the whole mood.


πŸ’– SEE ALSO πŸ’–

the whole group chat, in this exact order, no skipping 🫢


aaaand that's the page!! 🌈 this lil angel lives in ./drivers/mtd/ubi, she was stamped October 2026, and her name is check_mapping(9) β€” ok bye, love u, go read your eraseblocks πŸ’œπŸ§šβ€β™€οΈβ­

πŸ“¦ where this page comes from