linux/fs/ocfs2/super.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * super.c
 *
 * load/unload driver, mount/dismount volumes
 *
 * Copyright (C) 2002, 2004 Oracle.  All rights reserved.
 */

#include <linux/module.h>
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/highmem.h>
#include <linux/init.h>
#include <linux/random.h>
#include <linux/statfs.h>
#include <linux/moduleparam.h>
#include <linux/blkdev.h>
#include <linux/socket.h>
#include <linux/inet.h>
#include <linux/parser.h>
#include <linux/crc32.h>
#include <linux/debugfs.h>
#include <linux/mount.h>
#include <linux/seq_file.h>
#include <linux/quotaops.h>
#include <linux/signal.h>

#define CREATE_TRACE_POINTS
#include "ocfs2_trace.h"

#include <cluster/masklog.h>

#include "ocfs2.h"

/* this should be the only file to include a version 1 header */
#include "ocfs1_fs_compat.h"

#include "alloc.h"
#include "aops.h"
#include "blockcheck.h"
#include "dlmglue.h"
#include "export.h"
#include "extent_map.h"
#include "heartbeat.h"
#include "inode.h"
#include "journal.h"
#include "localalloc.h"
#include "namei.h"
#include "slot_map.h"
#include "super.h"
#include "sysfile.h"
#include "uptodate.h"
#include "xattr.h"
#include "quota.h"
#include "refcounttree.h"
#include "suballoc.h"

#include "buffer_head_io.h"
#include "filecheck.h"

static struct kmem_cache *ocfs2_inode_cachep;
struct kmem_cache *ocfs2_dquot_cachep;
struct kmem_cache *ocfs2_qf_chunk_cachep;

static struct dentry *ocfs2_debugfs_root;

MODULE_AUTHOR();
MODULE_LICENSE();
MODULE_DESCRIPTION();

struct mount_options
{};

static int ocfs2_parse_options(struct super_block *sb, char *options,
			       struct mount_options *mopt,
			       int is_remount);
static int ocfs2_check_set_options(struct super_block *sb,
				   struct mount_options *options);
static int ocfs2_show_options(struct seq_file *s, struct dentry *root);
static void ocfs2_put_super(struct super_block *sb);
static int ocfs2_mount_volume(struct super_block *sb);
static int ocfs2_remount(struct super_block *sb, int *flags, char *data);
static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err);
static int ocfs2_initialize_mem_caches(void);
static void ocfs2_free_mem_caches(void);
static void ocfs2_delete_osb(struct ocfs2_super *osb);

static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf);

static int ocfs2_sync_fs(struct super_block *sb, int wait);

static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb);
static int ocfs2_init_local_system_inodes(struct ocfs2_super *osb);
static void ocfs2_release_system_inodes(struct ocfs2_super *osb);
static int ocfs2_check_volume(struct ocfs2_super *osb);
static int ocfs2_verify_volume(struct ocfs2_dinode *di,
			       struct buffer_head *bh,
			       u32 sectsize,
			       struct ocfs2_blockcheck_stats *stats);
static int ocfs2_initialize_super(struct super_block *sb,
				  struct buffer_head *bh,
				  int sector_size,
				  struct ocfs2_blockcheck_stats *stats);
static int ocfs2_get_sector(struct super_block *sb,
			    struct buffer_head **bh,
			    int block,
			    int sect_size);
static struct inode *ocfs2_alloc_inode(struct super_block *sb);
static void ocfs2_free_inode(struct inode *inode);
static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend);
static int ocfs2_enable_quotas(struct ocfs2_super *osb);
static void ocfs2_disable_quotas(struct ocfs2_super *osb);

static struct dquot __rcu **ocfs2_get_dquots(struct inode *inode)
{}

static const struct super_operations ocfs2_sops =;

enum {};

static const match_table_t tokens =;

#ifdef CONFIG_DEBUG_FS
static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len)
{}

static int ocfs2_osb_debug_open(struct inode *inode, struct file *file)
{}

static int ocfs2_debug_release(struct inode *inode, struct file *file)
{}

static ssize_t ocfs2_debug_read(struct file *file, char __user *buf,
				size_t nbytes, loff_t *ppos)
{}
#else
static int ocfs2_osb_debug_open(struct inode *inode, struct file *file)
{
	return 0;
}
static int ocfs2_debug_release(struct inode *inode, struct file *file)
{
	return 0;
}
static ssize_t ocfs2_debug_read(struct file *file, char __user *buf,
				size_t nbytes, loff_t *ppos)
{
	return 0;
}
#endif	/* CONFIG_DEBUG_FS */

static const struct file_operations ocfs2_osb_debug_fops =;

static int ocfs2_sync_fs(struct super_block *sb, int wait)
{}

static int ocfs2_need_system_inode(struct ocfs2_super *osb, int ino)
{}

static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb)
{}

static int ocfs2_init_local_system_inodes(struct ocfs2_super *osb)
{}

static void ocfs2_release_system_inodes(struct ocfs2_super *osb)
{}

/* We're allocating fs objects, use GFP_NOFS */
static struct inode *ocfs2_alloc_inode(struct super_block *sb)
{}

static void ocfs2_free_inode(struct inode *inode)
{}

static unsigned long long ocfs2_max_file_offset(unsigned int bbits,
						unsigned int cbits)
{}

static int ocfs2_remount(struct super_block *sb, int *flags, char *data)
{}

static int ocfs2_sb_probe(struct super_block *sb,
			  struct buffer_head **bh,
			  int *sector_size,
			  struct ocfs2_blockcheck_stats *stats)
{}

static int ocfs2_verify_heartbeat(struct ocfs2_super *osb)
{}

/*
 * If we're using a userspace stack, mount should have passed
 * a name that matches the disk.  If not, mount should not
 * have passed a stack.
 */
static int ocfs2_verify_userspace_stack(struct ocfs2_super *osb,
					struct mount_options *mopt)
{}

static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend)
{}

static int ocfs2_enable_quotas(struct ocfs2_super *osb)
{}

static void ocfs2_disable_quotas(struct ocfs2_super *osb)
{}

static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
{}

static struct dentry *ocfs2_mount(struct file_system_type *fs_type,
			int flags,
			const char *dev_name,
			void *data)
{}

static struct file_system_type ocfs2_fs_type =;
MODULE_ALIAS_FS();

static int ocfs2_check_set_options(struct super_block *sb,
				   struct mount_options *options)
{}

static int ocfs2_parse_options(struct super_block *sb,
			       char *options,
			       struct mount_options *mopt,
			       int is_remount)
{}

static int ocfs2_show_options(struct seq_file *s, struct dentry *root)
{}

static int __init ocfs2_init(void)
{}

static void __exit ocfs2_exit(void)
{}

static void ocfs2_put_super(struct super_block *sb)
{}

static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf)
{}

static void ocfs2_inode_init_once(void *data)
{}

static int ocfs2_initialize_mem_caches(void)
{}

static void ocfs2_free_mem_caches(void)
{}

static int ocfs2_get_sector(struct super_block *sb,
			    struct buffer_head **bh,
			    int block,
			    int sect_size)
{}

static int ocfs2_mount_volume(struct super_block *sb)
{}

static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err)
{}

static int ocfs2_setup_osb_uuid(struct ocfs2_super *osb, const unsigned char *uuid,
				unsigned uuid_bytes)
{}

/* Make sure entire volume is addressable by our journal.  Requires
   osb_clusters_at_boot to be valid and for the journal to have been
   initialized by ocfs2_journal_init(). */
static int ocfs2_journal_addressable(struct ocfs2_super *osb)
{}

static int ocfs2_initialize_super(struct super_block *sb,
				  struct buffer_head *bh,
				  int sector_size,
				  struct ocfs2_blockcheck_stats *stats)
{}

/*
 * will return: -EAGAIN if it is ok to keep searching for superblocks
 *              -EINVAL if there is a bad superblock
 *              0 on success
 */
static int ocfs2_verify_volume(struct ocfs2_dinode *di,
			       struct buffer_head *bh,
			       u32 blksz,
			       struct ocfs2_blockcheck_stats *stats)
{}

static int ocfs2_check_volume(struct ocfs2_super *osb)
{}

/*
 * The routine gets called from dismount or close whenever a dismount on
 * volume is requested and the osb open count becomes 1.
 * It will remove the osb from the global list and also free up all the
 * initialized resources and fileobject.
 */
static void ocfs2_delete_osb(struct ocfs2_super *osb)
{}

/* Depending on the mount option passed, perform one of the following:
 * Put OCFS2 into a readonly state (default)
 * Return EIO so that only the process errs
 * Fix the error as if fsck.ocfs2 -y
 * panic
 */
static int ocfs2_handle_error(struct super_block *sb)
{}

int __ocfs2_error(struct super_block *sb, const char *function,
		  const char *fmt, ...)
{}

/* Handle critical errors. This is intentionally more drastic than
 * ocfs2_handle_error, so we only use for things like journal errors,
 * etc. */
void __ocfs2_abort(struct super_block *sb, const char *function,
		   const char *fmt, ...)
{}

/*
 * Void signal blockers, because in-kernel sigprocmask() only fails
 * when SIG_* is wrong.
 */
void ocfs2_block_signals(sigset_t *oldset)
{}

void ocfs2_unblock_signals(sigset_t *oldset)
{}

module_init();
module_exit(ocfs2_exit);