bdev_mark_dead(9)
π bdev_mark_dead β bestie, we gotta talk
okay so real talk: this is a page from the Kernel API Manual, section 9, all about bdev_mark_dead. yes, that name is exactly as dramatic as it sounds. no cap. π«Ά
β¨ NAME β¨
bdev_mark_dead β mark a block device as dead π
π SYNOPSIS π
void bdev_mark_dead (struct block_device *bdev , bool surprise );
that's it. that's the whole signature. two args, zero returns, one vibe check. πΈ
π¦ ARGUMENTS π¦
bdevβ the block device we're operating on, aka the main character of this whole situation πsurpriseβ aboolthat says whether this is a surprise removal (like... are we telling everyone the bad news, or did they already find out π)
π DESCRIPTION π
so the whole point of this function is literally just: tell the file system that this device (or its media) is dead. that's the job. that's the assignment. periodt.
now the surprise flag is doing a lot of heavy lifting:
- if
surpriseis set totrueβ the device or media is already gone. like, gone gone. it's giving "no warning, just vibes" π - if not β we're just preparing for an orderly removal. civilised. planned. we seen it coming β¨
and here's the tea π΅ β this function calls into the file system, which then typically:
- syncs out all the dirty data π₯
- writes back the inodes π
- invalidates any cached data in the inodes on the file system π§Ή
and in addition to all that, we also invalidate the block device mapping. love that for us. π¦
π SEE ALSO π
- Kernel file
./block/bdev.c bdev_validate_blocksize(9)bdev_freeze(9)bdev_thaw(9)bdev_deny_freeze(9)bdev_allow_freeze(9)bd_may_claim(9)bd_prepare_to_claim(9)bd_finish_claiming(9)bd_abort_claiming(9)bdev_open(9)bdev_yield_claim(9)bdev_fput(9)lookup_bdev(9)
like... the whole friend group is here. iykyk π«Ά
okay that's the page!! mwah π this beauty lives in ./block, it's dated October 2026, and the whole thing is filed under bdev_mark_dead(9) β go read the source bestie, slay π§π
π¦ 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