ext4_trim_extent(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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. group
  • count β€” how many blocks we're gonna TRIM
  • e4b β€” 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:

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