mark_buffer_dirty(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– mark_buffer_dirty(9) πŸ’–

okay so welcome to the mark_buffer_dirty page, bestie β€” it lives in the Kernel API Manual and it's genuinely one of those little functions that keeps the whole filesystem from gaslighting itself. let's get into it 🫢


✨ NAME ✨

mark_buffer_dirty β€” mark a buffer_head as needing writeout πŸ”₯


🌸 SYNOPSIS 🌸

void mark_buffer_dirty (struct buffer_head *bh );

that's it. that's the whole vibe. one arg, no return, no drama. πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • bh β€” the buffer_head to mark dirty. this is your main character right here πŸ‘‘

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the whole little ritual, and it happens in order so pay attention:

mark_buffer_dirty will set the dirty bit against the buffer, then set its backing page dirty, then tag the page as dirty in the page cache, and then attach the address_space's inode to its superblock's dirty inode list. like, it's a whole four-step glow-up for that buffer ✨

lowkey important: mark_buffer_dirty is atomic. no cap. it takes bh->b_folio->mapping->i_private_lock, the i_pages lock, and mapping->host->i_lock.

three locks. three. she's holding all of them at once, so respect the icon and don't do anything goofy in there, iykyk 😭


🌈 SEE ALSO 🌈

Kernel file ./fs/buffer.c

like a whole group chat of buffer functions, honestly. go read them all πŸ’œ


and that's the page, bestie 🧚 this one came out of ./fs in October 2026, so if the date or the source ever changes, that's the version you're looking at. slay, bye πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from