check_mapping(9)
π 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 π«Ά
- Kernel file
./drivers/mtd/ubi/eba.c struct ubi_eba_entry(9)struct ubi_eba_table(9)ubi_next_sqnum(9)ubi_get_compat(9)ubi_eba_get_ldesc(9)ubi_eba_create_table(9)ubi_eba_destroy_table(9)ubi_eba_copy_table(9)ubi_eba_replace_table(9)ltree_lookup(9)ltree_add_entry(9)leb_read_lock(9)leb_read_unlock(9)leb_write_lock(9)leb_write_trylock(9)leb_write_unlock(9)ubi_eba_is_mapped(9)ubi_eba_unmap_leb(9)ubi_eba_read_leb(9)ubi_eba_read_leb_sg(9)try_recover_peb(9)recover_peb(9)try_write_vid_and_data(9)ubi_eba_write_leb(9)ubi_eba_write_leb_st(9)is_error_sane(9)ubi_eba_copy_leb(9)print_rsvd_warning(9)self_check_eba(9)ubi_eba_init(9)
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
- 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