gfs2_trans_da_blks(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« gfs2_trans_da_blks β€” the Kernel API Manual page, bestie edition ✨

okay so you're here for gfs2_trans_da_blks(9) from the Kernel API Manual β€” that's the manpage name, hi, welcome, come sit with me πŸ’– This is the one that does the math on how many blocks you gotta reserve. Let's get into it.


🌸 NAME 🌸

gfs2_trans_da_blks β€” calculate number of blocks to link inode. that's it, that's the whole vibe πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

unsigned gfs2_trans_da_blks (const struct gfs2_inode *dip , const struct
       gfs2_diradd *da , unsigned nr_inodes );

it returns an unsigned, it takes three args, and yes you gotta write struct every time, that's just how C is, no cap ✨


πŸ’… ARGUMENTS πŸ’…

  • dip β€” the directory we are linking into 🏠 she's the destination, the main character of this operation, lowkey.
  • da β€” the dir add information πŸ“‹ that's the struct carrying the add details, k? k.
  • nr_inodes β€” the number of inodes involved πŸ‘― how many little guys are in the mix. iykyk.

🧚 DESCRIPTION 🧚

okay so the way that this works: this calculates the number of blocks we need to reserve in a transaction so we can link nr_inodes into a directory πŸ’« it's giving "do the accounting before you commit," which is honestly iconic of her.

in most cases nr_inodes will be 2 β€” that's the directory plus the inode being linked in, the classic pair, the duo, the bestie system 🫢 β€” but in case of rename, 4 may be required 😭 (yes, rename is highkey extra, it's got more moving parts, we still love her).


πŸ‘‘ RETURN πŸ‘‘

Number of blocks πŸ”₯ that's the return value. you asked how many blocks, she tells you how many blocks. periodt.


🌈 SEE ALSO 🌈

Kernel file ./fs/gfs2/inode.c β€” and like, all of these, go read them, they're all linked in the source:


ok that's the whole page bestie, no notes πŸ’œ go reserve your blocks responsibly.

and that's a wrap on gfs2_trans_da_blks(9) πŸŽ€ brought to you from ./fs/gfs2, dated October 2026 β€” mwah, love u, bye πŸ’‹βœ¨

πŸ“¦ where this page comes from