Documentation/filesystems/netfs_library.rst
Source file repositories/reference/linux-study-clean/Documentation/filesystems/netfs_library.rst
File Facts
- System
- Linux kernel
- Corpus path
Documentation/filesystems/netfs_library.rst- Extension
.rst- Size
- 39571 bytes
- Lines
- 1052
- Domain
- Support Tooling And Documentation
- Bucket
- Documentation
- Inferred role
- Support Tooling And Documentation: documentation
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
struct netfs_inodestruct my_inodestruct netfs_io_requeststruct netfs_io_streamstruct netfs_io_subrequeststruct netfs_request_opsstruct netfs_cache_resourcesstruct netfs_cache_ops
Annotated Snippet
struct netfs_inode {
struct inode inode;
const struct netfs_request_ops *ops;
struct fscache_cookie * cache;
loff_t remote_i_size;
unsigned long flags;
...
};
A network filesystem that wants to use netfslib must place one of these in its
inode wrapper struct instead of the VFS ``struct inode``. This can be done in
a way similar to the following::
struct my_inode {
struct netfs_inode netfs; /* Netfslib context and vfs inode */
...
};
This allows netfslib to find its state by using ``container_of()`` from the
inode pointer, thereby allowing the netfslib helper functions to be pointed to
directly by the VFS/VM operation tables.
The structure contains the following fields that are of interest to the
filesystem:
* ``inode``
The VFS inode structure.
* ``ops``
The set of operations provided by the network filesystem to netfslib.
* ``cache``
Local caching cookie, or NULL if no caching is enabled. This field does not
exist if fscache is disabled.
* ``remote_i_size``
The size of the file on the server. This differs from inode->i_size if
local modifications have been made but not yet written back.
* ``flags``
A set of flags, some of which the filesystem might be interested in:
* ``NETFS_ICTX_MODIFIED_ATTR``
Set if netfslib modifies mtime/ctime. The filesystem is free to ignore
this or clear it.
* ``NETFS_ICTX_UNBUFFERED``
Do unbuffered I/O upon the file. Like direct I/O but without the
alignment limitations. RMW will be performed if necessary. The pagecache
will not be used unless mmap() is also used.
* ``NETFS_ICTX_WRITETHROUGH``
Do writethrough caching upon the file. I/O will be set up and dispatched
as buffered writes are made to the page cache. mmap() does the normal
writeback thing.
* ``NETFS_ICTX_SINGLE_NO_UPLOAD``
Set if the file has a monolithic content that must be read entirely in a
single go and must not be written back to the server, though it can be
cached (e.g. AFS directories).
Annotation
- Detected declarations: `struct netfs_inode`, `struct my_inode`, `struct netfs_io_request`, `struct netfs_io_stream`, `struct netfs_io_subrequest`, `struct netfs_request_ops`, `struct netfs_cache_resources`, `struct netfs_cache_ops`.
- Atlas domain: Support Tooling And Documentation / Documentation.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.