ext4_trim_all_free(9)
π ext4_trim_all_free(9) β like, the whole manual, but make it make sense
Okay bestie, so this is a page out of the Kernel API Manual (that's the manual name, mmkay, putting it right here so we don't lose it β¨). And the function? It's ext4_trim_all_free β literally the function that trims all the free space in an allocation group. That's what the name says. The name ate. π
β¨ NAME β¨
ext4_trim_all_free β function to trim all free space in alloc. group π
π¦ SYNOPSIS π¦
ext4_grpblk_t ext4_trim_all_free (struct super_block *sb , ext4_group_t
group , ext4_grpblk_t start , ext4_grpblk_t max , ext4_grpblk_t
minblocks );
Yeah it's a whole signature. Five args. We're gonna go through every single one, don't worry. π
πΈ ARGUMENTS πΈ
sbβ the super block for the file system. The main character of the whole fs, honestly. πgroupβ the group that's getting trimmed. This is the one getting the glow-up. β¨startβ the first group block to examine. Where we start looking, bestie. πmaxβ the last group block to examine. Where we stop. No going past this. πminblocksβ the minimum extent block count. Like, an extent has to be at least this big to count. π
π DESCRIPTION π
Okay so here's the vibe: ext4_trim_all_free walks through the group's block bitmap, searching for free extents. That's the whole job. It's a hunter, and free extents are the prey. πΉ
When it finds a free extent? It marks it as used in the group buddy bitmap. Then it issues a TRIM command on this extent, and then frees the extent in the group buddy bitmap. So it's like: found it β flag it β TRIM it β let it go. π¦ It's giving "borrowed, not owned." The way that it marks the extent used before trimming and then frees it right back β that's the whole little dance. Periodt. π
π₯ SEE ALSO π₯
Kernel file ./fs/ext4/mballoc.c β go read the source, iykyk:
ext4_mb_clear_bb(9)ext4_free_blocks(9)ext4_group_add_blocks(9)ext4_trim_extent(9)ext4_trim_fs(9)
And that's the whole page, bestie!! π«Ά This little gem lives in ./fs/ext4, it's dated October 2026, and it's filed under ext4_trim_all_free(9) in the Kernel API Manual. Go trim something. πβ¨
π¦ 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