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.

Dependency Surface

Detected Declarations

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

Implementation Notes