ext4_trim_extent(9)
β¨ ext4_trim_extent β¨
okay so bestie, welcome to the ext4_trim_extent(9) page β this is the kernel API manual, and today's main character is a little function whose whole personality is: TRIM one single free extent in the group. just one. it's giving laser focus π
πΈ SYNOPSIS πΈ
int ext4_trim_extent (struct super_block *sb , int start , int count ,
struct ext4_buddy *e4b );
like, look at that signature. it ate. π
π¦ ARGUMENTS π¦
sbβ the super block for the file system, iykyk π«Άstartβ the starting block of the free extent inside the alloc. groupcountβ how many blocks we're gonna TRIMe4bβ the ext4 buddy for the group (yes, bestie, the buddy π§)
π DESCRIPTION π
so what it does: it trims "count" blocks starting at "start" in the "group". that's the whole vibe.
and to assure that no one will allocate those blocks, it marks them as used in the buddy bitmap. lowkey sneaky but it's for a good reason β no cap. π₯
β οΈ real talk: this must be called with under the group lock. not optional, not "if you feel like it". the group lock. periodt. π
π SEE ALSO π
kernel file ./fs/ext4/mballoc.c, plus these iconic siblings:
ext4_mb_clear_bb(9)ext4_free_blocks(9)ext4_group_add_blocks(9)ext4_trim_all_free(9)ext4_trim_fs(9)
go read them, they're all slaying in their own way π
and that's the whole page!! mwah π this cutie lives in ./fs/ext4 and the version vibes are dated October 2026, which is literally so soon. ok bye bestie, go TRIM responsibly βπ
π¦ 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