gfs2_bit_search(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ gfs2_bit_search(9) πŸ¦‹

okay so this page is from the Kernel API Manual, and it's literally about gfs2_bit_search β€” searching a bitmap for a state. bestie, it's giving lowkey kernel glamour, and we're gonna get through every single detail together. πŸ’…βœ¨


πŸ’– NAME πŸ’–

gfs2_bit_search β€” search bitmap for a state.


✨ SYNOPSIS ✨

u64 gfs2_bit_search (const __le64 *ptr , u64 mask , u8 state );

πŸŽ€ ARGUMENTS πŸŽ€

  • ptr β€” pointer to bitmap data. iconic.
  • mask β€” mask to use (normally 0x55555.... but adjusted for search start).
  • state β€” the state we are searching for.

🌸 DESCRIPTION 🌸

so here's the vibe: we xor the bitmap data with a pattern that is the bitwise opposite of what we're looking for. that gives rise to a pattern of ones wherever there is a match. since we have two bits per entry, we take this pattern, shift it down by one place and then and it with the original. all the even bit positions (0, 2, 4, etc.) then represent successful matches, so we mask with 0x55555..... to remove the unwanted odd bit positions. periodt. πŸ’…

this allows searching of a whole u64 at once (that's 32 blocks) with a single test (on 64 bit arches). no cap, that's the whole slay. πŸ”₯


πŸ”₯ SEE ALSO πŸ”₯

the whole friend group of related kernel functions, plus the source file, fr fr:


xoxo bestie πŸ’– β€” source ./fs/gfs2, date October 2026, page gfs2_bit_search(9) 🫢✨

πŸ“¦ where this page comes from