md_write_metadata(9)
πΎ 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 tordevβ 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 topageπ§ 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 callmd_super_waitafter issuing io to allrdev. 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 π
- Kernel file
./drivers/md/md.c stop_sync_thread(9)
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
- 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