block_invalidate_folio(9)
π block_invalidate_folio(9) β from the Kernel API Manual, bestie
okay so bestie, buckle up, we're getting into block_invalidate_folio β it lives in the Kernel API Manual and it's genuinely one of those little functions that's doing main character work behind the scenes π«Ά
β¨ NAME β¨
block_invalidate_folio β invalidate part or all of a buffer-backed folio. literally what it says on the tin π
πΈ SYNOPSIS πΈ
void block_invalidate_folio (struct folio *folio , size_t offset ,
size_t length );
like, no return value, it just goes and does the thing π
π ARGUMENTS π
folioβ the folio which is affected. this is the one getting the ~treatment~ π¦offsetβ start of the range to invalidate β¨lengthβ length of the range to invalidate β¨
π DESCRIPTION π
so block_invalidate_folio gets called when all or part of the folio has been invalidated by a truncate operation. yep, truncate said "you're done here" and this is the function that handles the emotional fallout π
now, the vibe check: block_invalidate_folio does not have to release all buffers. like, that's not the assignment. but it must make sure of two things, no cap:
- no dirty buffer is left outside
offset - no I/O is underway against any of the blocks which are outside the truncation point
why tho? because the caller is about to free (and possibly reuse) those blocks on-disk. so anything still dirty or still doing I/O out there is gonna be a whole mess π₯π
so yeah, not optional. the must is doing heavy lifting there, bestie, respect it.
π SEE ALSO π
Kernel file ./fs/buffer.c β and the whole friend group came through:
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), mark_buffer_dirty(9), __brelse(9), __bforget(9), bh_submit(9), bdev_getblk(9), __bread_gfp(9), clean_bdev_aliases(9), try_to_free_buffers(9), bh_uptodate_or_lock(9), __bh_read(9), __bh_read_batch(9)
that's the whole page, icon behaviour only πβ this cutie comes to you from ./fs, dated October 2026, and it's block_invalidate_folio(9) β ily, go read fs/buffer.c ππ§π
π¦ 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