sweep_bh_for_rgrps(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… sweep_bh_for_rgrps(9) β€” a Kernel API Manual moment

okay so bestie, this is from the Kernel API Manual, and honestly? it's giving "cleanup era" and i'm obsessed πŸ’–


✨ NAME ✨

sweep_bh_for_rgrps β€” find an rgrp in a meta buffer and free blocks therein 🧹


🌸 SYNOPSIS 🌸

int sweep_bh_for_rgrps (struct gfs2_inode *ip , struct gfs2_holder
*rd_gh , struct buffer_head *bh , __be64 *start , __be64 *end , bool
meta , u32 *btotal );

πŸŽ€ ARGUMENTS πŸŽ€

  • ip β€” the inode, bestie. that's the whole vibe.
  • rd_gh β€” holder of resource group glock πŸ”’
  • bh β€” buffer head to sweep (yes, we're sweeping it, periodt)
  • start β€” starting point in bh
  • end β€” end point in bh
  • meta β€” true if bh points to metadata (rather than data) 🫢
  • btotal β€” place to keep count of total blocks freed πŸ”₯

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea β˜• β€” we sweep a metadata buffer (the one provided by the metapath) for blocks we need to free, and we free them all. no cap.

but!! we do it one rgrp at a time. the way that works: if this block has references to multiple rgrps, we break it into individual transactions. this lets other processes use the rgrps while we're focused on a single one β€” better concurrency / performance, iykyk πŸ’…

and at every transaction boundary, we rewrite the inode into the journal ✍️. that way the bitmaps are kept consistent with the inode and we can recover if we're interrupted by power-outages 😭⚑ (yes, genuinely β€” that's the whole safety net, don't skip it).


🌈 RETURN 🌈

0, or return code if an error occurred. and *btotal has the total number of blocks freed πŸ“


πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./fs/gfs2/bmap.c β€” and the whole friend group:


πŸŽ€ that's the whole page, bestie β€” thanks for reading, mwah πŸ’–

sign-off time: this one lives at ./fs/gfs2, and the date on it is October 2026 ⭐ go forth and sweep responsibly, fr fr 🧚

πŸ“¦ where this page comes from