include/linux/fs/super_types.h

Source file repositories/reference/linux-study-clean/include/linux/fs/super_types.h

File Facts

System
Linux kernel
Corpus path
include/linux/fs/super_types.h
Extension
.h
Size
12678 bytes
Lines
353
Domain
Core OS
Bucket
Core Kernel Interface
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

struct sb_writers {
	unsigned short			frozen;		/* Is sb frozen? */
	int				freeze_kcount;	/* How many kernel freeze requests? */
	int				freeze_ucount;	/* How many userspace freeze requests? */
	const void			*freeze_owner;	/* Owner of the freeze */
	struct percpu_rw_semaphore	rw_sem[SB_FREEZE_LEVELS];
};

/**
 * enum freeze_holder - holder of the freeze
 * @FREEZE_HOLDER_KERNEL: kernel wants to freeze or thaw filesystem
 * @FREEZE_HOLDER_USERSPACE: userspace wants to freeze or thaw filesystem
 * @FREEZE_MAY_NEST: whether nesting freeze and thaw requests is allowed
 * @FREEZE_EXCL: a freeze that can only be undone by the owner
 *
 * Indicate who the owner of the freeze or thaw request is and whether
 * the freeze needs to be exclusive or can nest.
 * Without @FREEZE_MAY_NEST, multiple freeze and thaw requests from the
 * same holder aren't allowed. It is however allowed to hold a single
 * @FREEZE_HOLDER_USERSPACE and a single @FREEZE_HOLDER_KERNEL freeze at
 * the same time. This is relied upon by some filesystems during online
 * repair or similar.
 */
enum freeze_holder {
	FREEZE_HOLDER_KERNEL	= (1U << 0),
	FREEZE_HOLDER_USERSPACE	= (1U << 1),
	FREEZE_MAY_NEST		= (1U << 2),
	FREEZE_EXCL		= (1U << 3),
};

struct super_operations {
	struct inode *(*alloc_inode)(struct super_block *sb);
	void (*destroy_inode)(struct inode *inode);
	void (*free_inode)(struct inode *inode);
	void (*dirty_inode)(struct inode *inode, int flags);
	int (*write_inode)(struct inode *inode, struct writeback_control *wbc);
	int (*drop_inode)(struct inode *inode);
	void (*evict_inode)(struct inode *inode);
	void (*put_super)(struct super_block *sb);
	int (*sync_fs)(struct super_block *sb, int wait);
	int (*freeze_super)(struct super_block *sb, enum freeze_holder who,
			    const void *owner);
	int (*freeze_fs)(struct super_block *sb);
	int (*thaw_super)(struct super_block *sb, enum freeze_holder who,
			  const void *owner);
	int (*unfreeze_fs)(struct super_block *sb);
	int (*statfs)(struct dentry *dentry, struct kstatfs *kstatfs);
	void (*umount_begin)(struct super_block *sb);

	int (*show_options)(struct seq_file *seq, struct dentry *dentry);
	int (*show_devname)(struct seq_file *seq, struct dentry *dentry);
	int (*show_path)(struct seq_file *seq, struct dentry *dentry);
	int (*show_stats)(struct seq_file *seq, struct dentry *dentry);
#ifdef CONFIG_QUOTA
	ssize_t (*quota_read)(struct super_block *sb, int type, char *data,
			      size_t len, loff_t off);
	ssize_t (*quota_write)(struct super_block *sb, int type,
			       const char *data, size_t len, loff_t off);
	struct dquot __rcu **(*get_dquots)(struct inode *inode);
#endif
	long (*nr_cached_objects)(struct super_block *sb,
				  struct shrink_control *sc);
	long (*free_cached_objects)(struct super_block *sb,
				    struct shrink_control *sc);
	/*
	 * If a filesystem can support graceful removal of a device and
	 * continue read-write operations, implement this callback.
	 *
	 * Return 0 if the filesystem can continue read-write.
	 * Non-zero return value or no such callback means the fs will be shutdown
	 * as usual.
	 */
	int (*remove_bdev)(struct super_block *sb, struct block_device *bdev);
	void (*shutdown)(struct super_block *sb);

	/* Report a filesystem error */
	void (*report_error)(const struct fserror_event *event);
};

struct super_block {
	struct list_head			s_list;		/* Keep this first */
	dev_t					s_dev;		/* search index; _not_ kdev_t */
	unsigned char				s_blocksize_bits;
	unsigned long				s_blocksize;
	loff_t					s_maxbytes;	/* Max file size */
	struct file_system_type			*s_type;
	const struct super_operations		*s_op;
	const struct dquot_operations		*dq_op;
	const struct quotactl_ops		*s_qcop;
	const struct export_operations		*s_export_op;

Annotation

Implementation Notes