fs/orangefs/super.c

Source file repositories/reference/linux-study-clean/fs/orangefs/super.c

File Facts

System
Linux kernel
Corpus path
fs/orangefs/super.c
Extension
.c
Size
17571 bytes
Lines
665
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

// SPDX-License-Identifier: GPL-2.0
/*
 * (C) 2001 Clemson University and The University of Chicago
 *
 * See COPYING in top-level directory.
 */

#include "protocol.h"
#include "orangefs-kernel.h"
#include "orangefs-bufmap.h"

#include <linux/hashtable.h>
#include <linux/seq_file.h>

/* a cache for orangefs-inode objects (i.e. orangefs inode private data) */
static struct kmem_cache *orangefs_inode_cache;

/* list for storing orangefs specific superblocks in use */
LIST_HEAD(orangefs_superblocks);

DEFINE_SPINLOCK(orangefs_superblocks_lock);

enum {
	Opt_acl,
	Opt_intr,
	Opt_local_lock,
};

const struct fs_parameter_spec orangefs_fs_param_spec[] = {
	fsparam_flag	("acl",			Opt_acl),
	fsparam_flag	("intr",		Opt_intr),
	fsparam_flag	("local_lock",		Opt_local_lock),
	{}
};

uint64_t orangefs_features;

static int orangefs_show_options(struct seq_file *m, struct dentry *root)
{
	struct orangefs_sb_info_s *orangefs_sb = ORANGEFS_SB(root->d_sb);

	if (root->d_sb->s_flags & SB_POSIXACL)
		seq_puts(m, ",acl");
	if (orangefs_sb->flags & ORANGEFS_OPT_INTR)
		seq_puts(m, ",intr");
	if (orangefs_sb->flags & ORANGEFS_OPT_LOCAL_LOCK)
		seq_puts(m, ",local_lock");
	return 0;
}

static int orangefs_parse_param(struct fs_context *fc,
		struct fs_parameter *param)
{
	struct orangefs_sb_info_s *orangefs_sb = fc->s_fs_info;
	struct fs_parse_result result;
	int opt;

	opt = fs_parse(fc, orangefs_fs_param_spec, param, &result);
	if (opt < 0)
		return opt;

	switch (opt) {
	case Opt_acl:
		fc->sb_flags |= SB_POSIXACL;
		break;
	case Opt_intr:
		orangefs_sb->flags |= ORANGEFS_OPT_INTR;
		break;
	case Opt_local_lock:
		orangefs_sb->flags |= ORANGEFS_OPT_LOCAL_LOCK;
		break;
	}

	return 0;
}

static void orangefs_inode_cache_ctor(void *req)
{
	struct orangefs_inode_s *orangefs_inode = req;

	inode_init_once(&orangefs_inode->vfs_inode);
	init_rwsem(&orangefs_inode->xattr_sem);
}

static struct inode *orangefs_alloc_inode(struct super_block *sb)
{
	struct orangefs_inode_s *orangefs_inode;

	orangefs_inode = alloc_inode_sb(sb, orangefs_inode_cache, GFP_KERNEL);
	if (!orangefs_inode)

Annotation

Implementation Notes