mmb_sync(9)
πΎ mmb_sync(9) β the kernel API manual, bestie edition πΎ
okay so you found the mmb_sync page in the Kernel API Manual and you're like "what is this even" β don't worry, I got you. π
πΈ NAME πΈ
mmb_sync β write out & wait upon all buffers in a list
β¨ SYNOPSIS β¨
int mmb_sync (struct mapping_metadata_bhs *mmb );
π ARGUMENTS π
mmbβ the list of buffers to write. that's the whole vibe check, she's just a list of buffers π
π« DESCRIPTION π«
okay so first thing: it starts I/O against the buffers in the given list and then waits upon that I/O. literally starts it, then sits there waiting. no cap. π«Ά
basically, this is a convenience function for fsync. and mmb is for a file or directory which needs those buffers to be written for a successful fsync, iykyk.
now here's where it gets real β we have conflicting pressures: π
- we want to make sure that all initially dirty buffers get waited on
- but that any subsequently dirtied buffers don't
after all, we don't want fsync to last forever if somebody is actively writing to the file. imagine. π
so we do this in two main stages:
- first we copy dirty buffers to a temporary inode list, queueing the writes as we go.
- then we clean up, waiting for those writes to complete.
and here's the iconic safety detail: mark_buffer_dirty_inode doesn't touch b_assoc_buffers list if b_mmb is not NULL so we are sure the buffer stays on our list until I/O completes (at which point it can be reaped). slay. π₯
π¦ SEE ALSO π¦
kernel file ./fs/buffer.c β and honestly, the whole friend group: bio_endio_bh(9), end_buffer_read_sync(9), bh_end_read(9), bh_end_write(9), bh_end_async_write(9), block_dirty_folio(9), mark_buffer_dirty(9), __brelse(9), __bforget(9), bh_submit(9), bdev_getblk(9), __bread_gfp(9), block_invalidate_folio(9), clean_bdev_aliases(9), try_to_free_buffers(9), bh_uptodate_or_lock(9), __bh_read(9), __bh_read_batch(9)
ngl bestie, that's a lot of friends but they all ate. go read them too, periodt. π
πΈ okay that's the whole page!! this one came from ./fs and it's dated October 2026, and it's the mmb_sync(9) page from the Kernel API Manual. mwah, go sync something, ily πππ¦
π¦ 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