nfs_file_direct_read(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ nfs_file_direct_read(9) · Kernel API Manual ✨

okay bestie, buckle up β€” this is the direct-read situation for NFS files, and it's honestly kind of iconic once you get the vibe. πŸ’…


πŸŽ€ NAME πŸŽ€

nfs_file_direct_read β€” file direct read operation for NFS files πŸ¦‹


✨ SYNOPSIS ✨

ssize_t nfs_file_direct_read (struct kiocb *iocb , struct iov_iter *iter
, bool swap );

πŸ’– ARGUMENTS πŸ’–

  • iocb β€” the target I/O control block, aka the main character of this little operation πŸ‘‘
  • iter β€” vector of user buffers into which to read data, like the lil baskets the data goes into 🧺
  • swap β€” flag indicating this is swap IO, not O_DIRECT IO β€” important distinction, no cap πŸ’€

🌸 DESCRIPTION 🌸

We use this function for direct reads instead of calling generic_file_aio_read in order to avoid gfar's check to see if the request starts before the end of the file. For that check to work, we must generate a GETATTR before each direct read, and even then there is a window between the GETATTR and the subsequent READ where the file size could change. Our preference is simply to do all reads the application wants, and the server will take care of managing the end of file boundary. periodt. 🫢

This function also eliminates unnecessarily updating the file's atime locally, as the NFS server sets the file's atime, and this client must read the updated atime from the server back into its cache. it's giving efficient, honestly. ✨


πŸ‘€ SEE ALSO πŸ‘€

Kernel file ./fs/nfs/direct.c nfs_file_direct_write(9), nfs_init_directcache(9), nfs_destroy_directcache(9) β€” go read those too, iykyk πŸ’œ


lowkey love that this whole thing lives under ./fs/nfs and is dated October 2026 β€” future vibes fr fr 🌈⭐

that's the page, bestie β€” source ./fs/nfs, date October 2026, and yes the manual page name is still nfs_file_direct_read(9) because we keep the facts exactly where they belong πŸ’…πŸŽ€

πŸ“¦ where this page comes from