ext4_trim_all_free(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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:


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