gfs2_bitfit(9)
π 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
- 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