ubi_early_get_peb(9)
π ubi_early_get_peb(9) β from the Kernel API Manual, bestie
okay so picture this: it's kernel API manual o'clock, and we're talking about ubi_early_get_peb. yeah. that one. and yes before you ask, it's a 9 β section 9, kernel API, we love a niche manual section. let's get into it β¨
πΈ NAME πΈ
ubi_early_get_peb β get a free physical eraseblock. that's it. that's the whole job. she's a simple girl with a simple purpose π
β¨ SYNOPSIS β¨
struct ubi_ainf_peb * ubi_early_get_peb (struct ubi_device *ubi , struct
ubi_attach_info *ai );
like, look at her. returning a pointer to a struct ubi_ainf_peb * and taking two args. main character energy fr fr π
π«Ά ARGUMENTS π«Ά
ubiβ the UBI device description object. your device. your little guy. this is who you're working with πaiβ the attaching information. the lore, basically. the context you need to actually do the thing πΈ
π DESCRIPTION π
okay so real talk: this function returns a free physical eraseblock. periodt.
here's the vibe check though β it's supposed to be called on the UBI initialization stages, when the wear-leveling subsystem is not initialized yet. so like, early. before the glow-up. before wear-leveling even shows up to the party π
what she does, step by step:
- picks a physical eraseblock from one of the lists
- writes the EC header if it is needed
- removes it from the list
and then she's done. iconic behavior honestly π
on success, this function returns a pointer to the "aeb" of the found free PEB. on failure? an error code. so like, check your return values bestie, don't just vibe and assume π
π¦ SEE ALSO π¦
the whole friend group, no cap β all of these live over in the kernel file ./drivers/mtd/ubi/attach.c:
find_or_add_av(9)ubi_find_or_add_av(9)ubi_alloc_aeb(9)ubi_free_aeb(9)add_to_list(9)add_corrupted(9)add_fastmap(9)validate_vid_hdr(9)add_volume(9)ubi_compare_lebs(9)ubi_add_to_av(9)ubi_add_av(9)ubi_find_av(9)ubi_remove_av(9)early_erase_peb(9)check_corruption(9)scan_peb(9)late_analysis(9)destroy_av(9)destroy_ai(9)scan_all(9)scan_fast(9)ubi_attach(9)self_check_ai(9)
lowkey that's a lot of (9)s and I respect every single one of them π«‘
mwah π that's the page! this cutie lives in ./drivers/mtd/ubi, and she was last touched up in October 2026 β remember her fondly, go read your PEBs, and stay hydrated bestie ππ§
π¦ 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