gfs2_create_inode(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

gfs2_create_inode β€” bestie, this is the one that literally creates a brand-new inode ✨

It's a kernel API thing (so it lives in the gfs2_create_inode(9) manual, iykyk), and it's giving "main character energy" of the whole create-a-file pipeline 🌸


✨ SYNOPSIS ✨

int gfs2_create_inode (struct inode *dir , struct dentry *dentry ,
struct file *file , umode_t mode , dev_t dev , const char *symname ,
unsigned int size , int excl );

πŸŽ€ ARGUMENTS πŸŽ€

Okay so here's the whole cast of characters, no skips, we're not doing that πŸ™ˆ

  • dir β€” the parent directory 🫢 the one that's gonna host the new inode, like the group chat it gets added to
  • dentry β€” the new dentry πŸ¦‹ freshly minted, never been seen before
  • file β€” if it's non-NULL, this is the file that's being opened πŸ‘‘ (if it's NULL, it just isn't, periodt)
  • mode β€” the permissions on the new inode πŸ”
  • dev β€” for device nodes, this is the device number πŸ’€ (yes, only for device nodes, don't come for me)
  • symname β€” for symlinks, this is the link destination 🌈
  • size β€” the initial size of the inode ⭐ and heads up: it's ignored for directories, so don't even try it
  • excl β€” force fail if the inode exists 🚫 like a bouncer at the club, absolutely no duplicates allowed

πŸ’… DESCRIPTION πŸ’…

Okay, so the source itself literally has a FIXME in here, and honestly? Iconic of it to be that honest 😭 Here's what it says:

Change to allocate the disk blocks and write them out in the same transaction. That way, we can no longer end up in a situation in which an inode is allocated, the node crashes, and the block looks like a valid inode. (With atomic creates in place, we will also no longer need to zero the link count and dirty the inode here on failure.)

So basically the plan is: allocate the disk blocks and write them out in the same transaction β€” because right now the lowkey cursed scenario is that an inode gets allocated, the node crashes, and then the block is just out here looking like a valid inode 🧚 and once atomic creates are in place, we also won't need to zero the link count and dirty the inode here on failure anymore either. Slay, future improvement πŸ”₯


🌟 RETURN 🌟

0 on success, or an error code πŸ’– (that's it, that's the whole vibe check)


πŸ” SEE ALSO πŸ”

Kernel file ./fs/gfs2/inode.c, plus the whole friend group 🫢:


And that's the page, bestie!! πŸŽ€ This masterpiece comes to you from ./fs/gfs2, dated October 2026, and it's filed under gfs2_create_inode(9) β€” mwah, go create some inodes responsibly πŸ’œβœ¨

πŸ“¦ where this page comes from