fs/9p/cache.c
Source file repositories/reference/linux-study-clean/fs/9p/cache.c
File Facts
- System
- Linux kernel
- Corpus path
fs/9p/cache.c- Extension
.c- Size
- 1820 bytes
- Lines
- 77
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/jiffies.hlinux/file.hlinux/slab.hlinux/stat.hlinux/sched.hlinux/fs.hnet/9p/9p.hv9fs.hcache.h
Detected Declarations
function Copyrightfunction v9fs_cache_inode_get_cookie
Annotated Snippet
if (vcookie != ERR_PTR(-EBUSY)) {
kfree(name);
return PTR_ERR(vcookie);
}
pr_err("Cache volume key already in use (%s)\n", name);
vcookie = NULL;
}
v9ses->fscache = vcookie;
kfree(name);
return 0;
}
void v9fs_cache_inode_get_cookie(struct inode *inode)
{
struct v9fs_inode *v9inode = V9FS_I(inode);
struct v9fs_session_info *v9ses;
__le32 version;
__le64 path;
if (!S_ISREG(inode->i_mode))
return;
if (WARN_ON(v9fs_inode_cookie(v9inode)))
return;
version = cpu_to_le32(v9inode->qid.version);
path = cpu_to_le64(v9inode->qid.path);
v9ses = v9fs_inode2v9ses(inode);
v9inode->netfs.cache =
fscache_acquire_cookie(v9fs_session_cache(v9ses),
0,
&path, sizeof(path),
&version, sizeof(version),
i_size_read(&v9inode->netfs.inode));
if (v9inode->netfs.cache)
mapping_set_release_always(inode->i_mapping);
p9_debug(P9_DEBUG_FSC, "inode %p get cookie %p\n",
inode, v9fs_inode_cookie(v9inode));
}
Annotation
- Immediate include surface: `linux/jiffies.h`, `linux/file.h`, `linux/slab.h`, `linux/stat.h`, `linux/sched.h`, `linux/fs.h`, `net/9p/9p.h`, `v9fs.h`.
- Detected declarations: `function Copyright`, `function v9fs_cache_inode_get_cookie`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
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.