gfs2_bitfit(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– gfs2_bitfit(9) πŸ’–

okay so this is a page from the Kernel API Manual, and bestie, it's literally about gfs2_bitfit β€” the function whose whole vibe is searching an rgrp's bitmap buffer to find a bit-pair that represents a block in a given allocation state. slay. πŸŽ€


✨ NAME ✨

gfs2_bitfit β€” Search an rgrp's bitmap buffer to find a bit-pair representing a block in a given allocation state. that's it, that's the whole job, and honestly? iconic. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

u32 gfs2_bitfit (const u8 *buf , const unsigned int len , u32 goal , u8
state );

like, copy it exactly, no edits, I'm watching πŸ‘€


🌸 ARGUMENTS 🌸

  • buf β€” the buffer that holds the bitmaps. the main character, fr fr 🫢
  • len β€” the length (in bytes) of the buffer. yes bestie, bytes, remember that, it matters later 😭
  • goal β€” start the search at this block's bit-pair (within the buffer). it's giving "we begin here and we do not ask questions" ✨
  • state β€” GFS2_BLKST_XXX, the state of the block we're looking for. you tell it what you want, it goes and finds it. king behavior πŸ‘‘

πŸ’€ DESCRIPTION πŸ’€

Okay so scope check, because this is the part people get wrong: the goal and the returned block number only mean something within this bitmap buffer β€” not the entire rgrp, and definitely not the entire filesystem. keep that straight, iykyk. 🧚

The buffer will be offset from the actual beginning of a bitmap block buffer, skipping any header structures β€” but lowkey it's fine, because headers are always a multiple of 64 bits long, so the buffer is always aligned to a 64 bit boundary. the universe simply kind of works out 🌈

Here's the slightly unhinged part: the size of the buffer is in bytes, but it is assumed that it's always ok to read a complete multiple of 64 bits at the end of the block, in case the end is no aligned to a natural boundary. πŸ”₯ so yeah, that's a thing that's assumed. noted. don't be weird about it.


πŸ‘‘ RETURN πŸ‘‘

the block number (bitmap buffer scope) that was found. that's the answer, that's the gift, go off πŸ’–

reminder bestie: bitmap buffer scope. not rgrp scope, not filesystem scope. the scope thing is real and it will bite you πŸ™ˆ

⭐ SEE ALSO ⭐

Kernel file ./fs/gfs2/rgrp.c, plus the whole extended friend group β€” every single one of these, no skips:

gfs2_setbit(9), gfs2_testbit(9), gfs2_bit_search(9), rs_cmp(9), gfs2_rbm_from_block(9), gfs2_rbm_add(9), gfs2_unaligned_extlen(9), gfs2_free_extlen(9), gfs2_bitcount(9), gfs2_rgrp_verify(9), gfs2_blk2rgrpd(9), gfs2_rgrpd_get_first(9), gfs2_rgrpd_get_next(9), __rs_deltree(9), gfs2_rs_deltree(9), gfs2_rs_delete(9), return_all_reservations(9), compute_bitstructs(9), gfs2_ri_total(9), read_rindex_entry(9), set_rgrp_preferences(9), gfs2_ri_update(9), gfs2_rindex_update(9), gfs2_rgrp_go_instantiate(9), gfs2_rgrp_brelse(9), gfs2_fitrim(9), rs_insert(9), rgd_free(9), rg_mblk_search(9), gfs2_next_unreserved_block(9), gfs2_reservation_check_and_update(9), gfs2_rbm_find(9), try_rgrp_unlink(9), gfs2_rgrp_congested(9), gfs2_rgrp_used_recently(9), fast_to_acquire(9), gfs2_inplace_reserve(9), gfs2_inplace_release(9), gfs2_alloc_extent(9), rgblk_free(9), gfs2_rgrp_dump(9), gfs2_adjust_reservation(9), gfs2_set_alloc_start(9), gfs2_alloc_blocks(9), __gfs2_free_blocks(9), gfs2_free_meta(9), gfs2_check_blk_type(9), gfs2_rlist_add(9), gfs2_rlist_alloc(9), gfs2_rlist_free(9)

like, that's a whole party πŸŽ‰


and that's the page!! mwah πŸ’‹ this all came from the ./fs/gfs2 source, dated October 2026 β€” so, you know, shoutout to the future and to whoever wrote this. stan. bye bestie, go read gfs2_setbit(9) next, I believe in you 🌸🫢

πŸ“¦ where this page comes from