badblocks_set(9)
β¨ badblocks_set(9) β¨
okay so this one is from the Kernel API Manual, and it's lowkey one of my fave little functions because it's just doing honest bookkeeping work π
πΈ NAME πΈ
badblocks_set β add a range of bad blocks to the table. that's it, that's the whole vibe π
π¦ SYNOPSIS π¦
bool badblocks_set (struct badblocks *bb , sector_t s , sector_t sectors
, int acknowledged );
like look at that signature. it's giving "i know exactly what i'm doing" π₯
π ARGUMENTS π
bbβ thebadblocksstructure that holds all the badblock information. the main character of this whole situation πsβ first sector to mark as bad. where the chaos starts β¨sectorsβ number of sectors to mark as bad. how far the chaos spreads πacknowledgedβ whether to mark the bad sectors as acknowledged. yes/no, that's the whole question π«Ά
β DESCRIPTION β
so here's the tea: this might extend the table, or it might contract it if two adjacent ranges can be merged. either way, the algorithm is not out here guessing β we binary-search to find the 'insertion' point, then decide how best to handle it from there. ngl, that's kind of iconic of it π§
π RETURN π
true: success πfalse: failed to set badblocks (out of space) π
and fr fr, a partial setting will be treated as failure. so no half-slay, it's all or nothing bestie π
π₯ SEE ALSO π₯
- Kernel file
./block/badblocks.c badblocks_check(9),badblocks_clear(9),ack_all_badblocks(9),badblocks_show(9),badblocks_store(9),badblocks_init(9),badblocks_exit(9)
go read the whole friend group, they all hang out together π
that's the whole page bestie, mwah π β from ./block, stamped October 2026, and yeah the page really is called badblocks_set(9) in case you forgot already π
π¦ 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