bdev_mark_dead(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’€ 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 β€” a bool that 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 surprise is set to true β†’ 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:

  1. syncs out all the dirty data πŸ”₯
  2. writes back the inodes πŸŽ€
  3. 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 πŸ’œ

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