md_write_metadata(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’Ύ md_write_metadata(9) β€” bestie edition

okay so this is a page from the Kernel API Manual ✨ and it's literally about md_write_metadata β€” the little function that gets your metadata onto the actual disk. buckle up πŸŽ€


🌸 NAME 🌸

md_write_metadata β€” write metadata to underlying disk, including array superblock, badblocks, bitmap superblock and bitmap bits. that's the whole menu, bestie πŸ’…


✨ SYNOPSIS ✨

void md_write_metadata (struct mddev *mddev , struct md_rdev *rdev ,
sector_t sector , int size , struct page *page , unsigned int offset );

no cap, that's the whole signature. six args. she's thorough πŸ‘‘


πŸ¦‹ ARGUMENTS πŸ¦‹

  • mddev β€” the array to write πŸ’– this is the big boss array itself.
  • rdev β€” the underlying disk to write 🫢 the actual physical disk doing the heavy lifting.
  • sector β€” the offset to rdev ⭐ where on that disk we're landing.
  • size β€” the length of the metadata 🌸 how many bytes of the stuff we're pushing out.
  • page β€” the metadata πŸŽ€ the actual payload, sitting pretty in a page.
  • offset β€” the offset to page 🧚 where inside that page our data starts.

πŸ”₯ DESCRIPTION πŸ”₯

okay so here's the vibe: it writes size bytes of page starting from offset, out to sector of rdev. that's the whole core move, iykyk πŸ’…

then it increments mddev->pending_writes before returning, and decrements it on completion, waking up sb_wait 😭 yes she's tracking herself, it's called accountability.

⚠️ important, bestie: the caller must call md_super_wait after issuing io to all rdev. not optional. like, do it. πŸ™ˆ

and if an error occurred, md_error will be called, and the rdev will be kicked out from mddev πŸ’€ yeah. eviction. brutal but fair.


🌈 SEE ALSO 🌈


that's the whole page, bestie β€” go write some metadata, slay πŸ’œ

source: ./drivers/md Β· October 2026 Β· md_write_metadata(9) β€” mwah, see u in the group chat 🫢✨

πŸ“¦ where this page comes from