netfs_start_io_direct(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME 🌸

okay so bestie, welcome to the Kernel API Manual page for netfs_start_io_direct β€” yes, netfs_start_io_direct(9) if we’re being formal β€” and it’s literally the function that declares the file is being used for direct i/o. πŸ’…

✨ SYNOPSIS ✨

int netfs_start_io_direct (struct inode *inode );

πŸŽ€ ARGUMENTS πŸŽ€

  • inode β€” file inode. that’s the whole argument, bestie. πŸ¦‹

πŸ’– DESCRIPTION πŸ’–

okay so netfs_start_io_direct declares that a direct I/O operation is about to start, and it makes sure we block all buffered I/O. no cap, that’s the vibe. πŸ›‘

On exit, the function makes sure the NETFS_ICTX_ODIRECT flag is set, and it holds a shared lock on inode->i_rwsem to ensure that the flag cannot be changed. periodt. πŸ”’

In practice, this means direct I/O operations are allowed to execute in parallel β€” thank you, shared lock β€” whereas buffered I/O operations need to wait to grab an exclusive lock in order to clear NETFS_ICTX_ODIRECT. the way that locking situation works is honestly iconic. ✨

also pls note: buffered writes and truncates both take a write lock on inode->i_rwsem, meaning that those are serialised w.r.t. O_DIRECT. so yeah, they are not out here running wild together. πŸ’€

🌈 SEE ALSO 🌈

Kernel file ./fs/netfs/locking.c β€” plus these besties, iykyk:


cute little sign-off: this page comes from ./fs/netfs, it’s dated October 2026, and it’s all about netfs_start_io_direct(9). mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from