clean_bdev_aliases(9)
π clean_bdev_aliases(9) π
okay bestie, welcome to the Kernel API Manual page for clean_bdev_aliases(9) β no cap, we're doing buffer-cache cleanup and being cute about it. π§β¨
πΈ NAME πΈ
clean_bdev_aliases β clean a range of buffers in block device. π
β¨ SYNOPSIS β¨
void clean_bdev_aliases (struct block_device *bdev , sector_t block ,
sector_t len );
π ARGUMENTS π
bdevβ Block device to clean buffers in. πblockβ Start of a range of blocks to clean. βlenβ Number of blocks to clean. π
π¦ DESCRIPTION π¦
Okay so here's the vibe: we're taking a range of blocks for data, and we do not want writeback of any buffer-cache aliases starting from the return of this function until something explicitly marks the buffer dirty β hopefully that will not happen until we free that block ;-). We don't even need to mark it not-uptodate β nobody can expect anything from a newly allocated buffer anyway. We used to use unmap_buffer for this kind of invalidation, but that was wrong. We definitely don't want to mark the alias unmapped, for example β it would confuse anyone who might pick it with bread afterwards... π
Also.. note that bforget doesn't lock the buffer. So there can be writeout I/O going on against recently-freed buffers. We don't wait on that I/O in bforget β it's more efficient to wait on the I/O only if we really need to. That happens here. ππ₯
π 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), mark_buffer_dirty(9), __brelse(9), __bforget(9), bh_submit(9), bdev_getblk(9), __bread_gfp(9), block_invalidate_folio(9), try_to_free_buffers(9), bh_uptodate_or_lock(9), __bh_read(9), __bh_read_batch(9). π«Ά
bye bestie π«Ά β source/version: ./fs, date: October 2026, page: clean_bdev_aliases(9). mwah π
π¦ 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