fs/9p/vfs_super.c

Source file repositories/reference/linux-study-clean/fs/9p/vfs_super.c

File Facts

System
Linux kernel
Corpus path
fs/9p/vfs_super.c
Extension
.c
Size
8364 bytes
Lines
367
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 (res == 0) {
			buf->f_type = rs.type;
			buf->f_bsize = rs.bsize;
			buf->f_blocks = rs.blocks;
			buf->f_bfree = rs.bfree;
			buf->f_bavail = rs.bavail;
			buf->f_files = rs.files;
			buf->f_ffree = rs.ffree;
			buf->f_fsid = u64_to_fsid(rs.fsid);
			buf->f_namelen = rs.namelen;
		}
		if (res != -ENOSYS)
			goto done;
	}
	res = simple_statfs(dentry, buf);
done:
	p9_fid_put(fid);
	return res;
}

static int v9fs_drop_inode(struct inode *inode)
{
	struct v9fs_session_info *v9ses;

	v9ses = v9fs_inode2v9ses(inode);
	if (v9ses->cache & (CACHE_META|CACHE_LOOSE))
		return inode_generic_drop(inode);
	/*
	 * in case of non cached mode always drop the
	 * inode because we want the inode attribute
	 * to always match that on the server.
	 */
	return 1;
}

static int v9fs_write_inode(struct inode *inode,
			    struct writeback_control *wbc)
{
	/*
	 * send an fsync request to server irrespective of
	 * wbc->sync_mode.
	 */
	p9_debug(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode);
	return netfs_unpin_writeback(inode, wbc);
}

static int v9fs_write_inode_dotl(struct inode *inode,
				 struct writeback_control *wbc)
{

	p9_debug(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode);

	return netfs_unpin_writeback(inode, wbc);
}

static const struct super_operations v9fs_super_ops = {
	.alloc_inode = v9fs_alloc_inode,
	.free_inode = v9fs_free_inode,
	.statfs = simple_statfs,
	.drop_inode = v9fs_drop_inode,
	.evict_inode = v9fs_evict_inode,
	.show_options = v9fs_show_options,
	.umount_begin = v9fs_umount_begin,
	.write_inode = v9fs_write_inode,
};

static const struct super_operations v9fs_super_ops_dotl = {
	.alloc_inode = v9fs_alloc_inode,
	.free_inode = v9fs_free_inode,
	.statfs = v9fs_statfs,
	.drop_inode = v9fs_drop_inode,
	.evict_inode = v9fs_evict_inode,
	.show_options = v9fs_show_options,
	.umount_begin = v9fs_umount_begin,
	.write_inode = v9fs_write_inode_dotl,
};

static void v9fs_free_fc(struct fs_context *fc)
{
	struct v9fs_context *ctx = fc->fs_private;

	if (!ctx)
		return;

	/* These should be NULL by now but guard against leaks */
	kfree(ctx->session_opts.uname);
	kfree(ctx->session_opts.aname);
#ifdef CONFIG_9P_FSCACHE
	kfree(ctx->session_opts.cachetag);
#endif

Annotation

Implementation Notes