mark_buffer_dirty(9)
π 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β thebuffer_headto 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_dirtyis atomic. no cap. it takesbh->b_folio->mapping->i_private_lock, thei_pageslock, andmapping->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
bio_endio_bh(9)end_buffer_read_sync(9)bh_end_read(9)bh_end_write(9)bh_end_async_write(9)mmb_sync(9)block_dirty_folio(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)
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
- 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