nfs_file_direct_read(9)
β¨ 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, notO_DIRECTIO β 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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms