get_bbt_block(9)
π get_bbt_block(9) π
okay so bestie, we're in the Kernel API Manual today and this one is a little NAND-flash baddie called get_bbt_block. she's lowkey the one who finds you a place to live. let's get into it π«Ά
β¨ NAME β¨
get_bbt_block β get the first valid eraseblock suitable to store a BBT πΈ
β¨ SYNOPSIS β¨
int get_bbt_block (struct nand_chip *this , struct nand_bbt_descr *td ,
struct nand_bbt_descr *md , int chip );
β¨ ARGUMENTS β¨
thisβ the NAND device itself, the main character πtdβ the BBT description, aka the vibe info for the BBTmdβ the mirror BBT descriptor (yes girl, she has a mirror version too πͺ)chipβ the CHIP selector, so we know which chip we're talking about
π DESCRIPTION π
so this function returns a positive block number pointing at a valid eraseblock that's suitable to store a BBT β meaning it's inside the range reserved for BBT, no cap β¨. if all the blocks are already used or marked bad, she hits you with -ENOSPC and it's giving "no space, sorry bestie" π.
and here's the cute part: if td->pages[chip] was already pointing to a valid block, we just re-use it π. she's not gonna do extra work for no reason. otherwise, we go searching for the next valid one, like a little scavenger hunt but for eraseblocks π¦β
ngl, -ENOSPC means everything's taken or marked bad β no block for you, and that's just how it is π
π SEE ALSO π
Kernel file ./drivers/mtd/nand/raw/nand_bbt.c, plus the whole friend group:
check_pattern(9), check_short_pattern(9), add_marker_len(9), read_bbt(9), read_abs_bbt(9), scan_read_oob(9), read_abs_bbts(9), create_bbt(9), search_bbt(9), search_read_bbts(9), mark_bbt_block_bad(9), write_bbt(9), nand_memory_bbt(9), check_create(9), nand_update_bbt(9), mark_bbt_region(9), verify_bbt_descr(9), nand_scan_bbt(9), nand_create_badblock_pattern(9), nand_create_bbt(9), nand_isreserved_bbt(9), nand_isbad_bbt(9), nand_markbad_bbt(9) π
and that's the whole page, icon. straight out of ./drivers/mtd/nand/raw, dated October 2026 β periodt, go read the source, ily, bye π§π
π¦ 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