__gfs2_iomap_alloc(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 __gfs2_iomap_alloc(9) β€” the Kernel API Manual, bestie edition 🌸

okay so this page lives in the Kernel API Manual and it's literally all about building a metadata tree of the requested height πŸ’… like, you know when you need a tree and it needs to be a specific height? yeah. that. let's get into it 🫢


✨ NAME ✨

__gfs2_iomap_alloc β€” build a metadata tree of the requested height πŸŽ€ lowkey the whole personality of this function ngl


πŸ¦‹ SYNOPSIS πŸ¦‹

int __gfs2_iomap_alloc (struct inode *inode , struct iomap *iomap ,
       struct metapath *mp );

three args, one int back, no cap πŸ’œ


🌸 ARGUMENTS 🌸

  • inode β€” the GFS2 inode πŸ’– like, the inode. the main character, fr.
  • iomap β€” the iomap structure ✨ your classic iomap situation.
  • mp β€” the metapath 🧚 and bestie, it needs to already have the proper height information calculated. don't come in here with a half-baked metapath, it's giving unprepared 😭

πŸ‘‘ DESCRIPTION πŸ‘‘

okay so in this routine we may have to alloc three whole vibes of thing, and yes you have to keep all three straight πŸ“:

  1. indirect blocks to grow the metadata tree height 🌱
  2. indirect blocks to fill in the lower part of the metadata tree 🧱
  3. data blocks πŸ’Ύ

this function is called after __gfs2_iomap_get, which is the one that actually works out the total number of blocks we need via gfs2_alloc_size πŸ”₯ so like, the math is already done by the time we show up. we're just here to execute.

then we do the actual allocation, asking for an extent at a time β€” and here's the slay part: if enough contiguous free blocks are available, there will only be one allocation request per call 😌✨ and then we use the state machine to initialise the blocks in order. state machine doing the heavy lifting, as always πŸ’…

right now? this function will allocate at most one indirect block worth of data β€” with a default block size of 4K, that's slightly less than 2M πŸ™ˆ that's the cap, that's the limit, that's the vibe check result.

and if this limitation is ever removed to allow huge allocations, we would probably still want to limit the iomap size we return, to avoid stalling other tasks during huge writes 🫢 the next iomap iteration would then find the blocks already allocated. so like β€” even in the glowing future where we're huge? still limiting. periodt. πŸ’€


πŸ”₯ RETURN πŸ”₯

errno on error 😭 (that's it, that's the return section, we keep it real)


🌈 SEE ALSO 🌈

kernel file ./fs/gfs2/bmap.c plus the whole friend group πŸ‘‘:


ok literally that's the whole page, go read bmap.c if you want the deep lore πŸ™ˆ

and that's a wrap bestie πŸ’– this came from the source tree at ./fs/gfs2, dated October 2026, and the page itself is __gfs2_iomap_alloc(9) β€” mwah, go build some trees πŸŒˆβ­πŸŽ€

πŸ“¦ where this page comes from