linux/fs/f2fs/super.c

// SPDX-License-Identifier: GPL-2.0
/*
 * fs/f2fs/super.c
 *
 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
 *             http://www.samsung.com/
 */
#include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/fs_context.h>
#include <linux/sched/mm.h>
#include <linux/statfs.h>
#include <linux/buffer_head.h>
#include <linux/kthread.h>
#include <linux/parser.h>
#include <linux/mount.h>
#include <linux/seq_file.h>
#include <linux/proc_fs.h>
#include <linux/random.h>
#include <linux/exportfs.h>
#include <linux/blkdev.h>
#include <linux/quotaops.h>
#include <linux/f2fs_fs.h>
#include <linux/sysfs.h>
#include <linux/quota.h>
#include <linux/unicode.h>
#include <linux/part_stat.h>
#include <linux/zstd.h>
#include <linux/lz4.h>

#include "f2fs.h"
#include "node.h"
#include "segment.h"
#include "xattr.h"
#include "gc.h"
#include "iostat.h"

#define CREATE_TRACE_POINTS
#include <trace/events/f2fs.h>

static struct kmem_cache *f2fs_inode_cachep;

#ifdef CONFIG_F2FS_FAULT_INJECTION

const char *f2fs_fault_name[FAULT_MAX] =;

int f2fs_build_fault_attr(struct f2fs_sb_info *sbi, unsigned long rate,
							unsigned long type)
{}
#endif

/* f2fs-wide shrinker description */
static struct shrinker *f2fs_shrinker_info;

static int __init f2fs_init_shrinker(void)
{}

static void f2fs_exit_shrinker(void)
{}

enum {};

static match_table_t f2fs_tokens =;

void f2fs_printk(struct f2fs_sb_info *sbi, bool limit_rate,
						const char *fmt, ...)
{}

#if IS_ENABLED(CONFIG_UNICODE)
static const struct f2fs_sb_encodings {} f2fs_sb_encoding_map[] =;

static const struct f2fs_sb_encodings *
f2fs_sb_read_encoding(const struct f2fs_super_block *sb)
{}

struct kmem_cache *f2fs_cf_name_slab;
static int __init f2fs_create_casefold_cache(void)
{}

static void f2fs_destroy_casefold_cache(void)
{}
#else
static int __init f2fs_create_casefold_cache(void) { return 0; }
static void f2fs_destroy_casefold_cache(void) { }
#endif

static inline void limit_reserve_root(struct f2fs_sb_info *sbi)
{}

static inline void adjust_unusable_cap_perc(struct f2fs_sb_info *sbi)
{}

static void init_once(void *foo)
{}

#ifdef CONFIG_QUOTA
static const char * const quotatypes[] = INITQFNAMES;
#define QTYPE2NAME(t)
static int f2fs_set_qf_name(struct super_block *sb, int qtype,
							substring_t *args)
{}

static int f2fs_clear_qf_name(struct super_block *sb, int qtype)
{}

static int f2fs_check_quota_options(struct f2fs_sb_info *sbi)
{}
#endif

static int f2fs_set_test_dummy_encryption(struct super_block *sb,
					  const char *opt,
					  const substring_t *arg,
					  bool is_remount)
{}

#ifdef CONFIG_F2FS_FS_COMPRESSION
static bool is_compress_extension_exist(struct f2fs_sb_info *sbi,
					const char *new_ext, bool is_ext)
{}

/*
 * 1. The same extension name cannot not appear in both compress and non-compress extension
 * at the same time.
 * 2. If the compress extension specifies all files, the types specified by the non-compress
 * extension will be treated as special cases and will not be compressed.
 * 3. Don't allow the non-compress extension specifies all files.
 */
static int f2fs_test_compress_extension(struct f2fs_sb_info *sbi)
{}

#ifdef CONFIG_F2FS_FS_LZ4
static int f2fs_set_lz4hc_level(struct f2fs_sb_info *sbi, const char *str)
{}
#endif

#ifdef CONFIG_F2FS_FS_ZSTD
static int f2fs_set_zstd_level(struct f2fs_sb_info *sbi, const char *str)
{}
#endif
#endif

static int parse_options(struct super_block *sb, char *options, bool is_remount)
{}

static struct inode *f2fs_alloc_inode(struct super_block *sb)
{}

static int f2fs_drop_inode(struct inode *inode)
{}

int f2fs_inode_dirtied(struct inode *inode, bool sync)
{}

void f2fs_inode_synced(struct inode *inode)
{}

/*
 * f2fs_dirty_inode() is called from __mark_inode_dirty()
 *
 * We should call set_dirty_inode to write the dirty inode through write_inode.
 */
static void f2fs_dirty_inode(struct inode *inode, int flags)
{}

static void f2fs_free_inode(struct inode *inode)
{}

static void destroy_percpu_info(struct f2fs_sb_info *sbi)
{}

static void destroy_device_list(struct f2fs_sb_info *sbi)
{}

static void f2fs_put_super(struct super_block *sb)
{}

int f2fs_sync_fs(struct super_block *sb, int sync)
{}

static int f2fs_freeze(struct super_block *sb)
{}

static int f2fs_unfreeze(struct super_block *sb)
{}

#ifdef CONFIG_QUOTA
static int f2fs_statfs_project(struct super_block *sb,
				kprojid_t projid, struct kstatfs *buf)
{}
#endif

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

static inline void f2fs_show_quota_options(struct seq_file *seq,
					   struct super_block *sb)
{}

#ifdef CONFIG_F2FS_FS_COMPRESSION
static inline void f2fs_show_compress_options(struct seq_file *seq,
							struct super_block *sb)
{}
#endif

static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
{}

static void default_options(struct f2fs_sb_info *sbi, bool remount)
{}

#ifdef CONFIG_QUOTA
static int f2fs_enable_quotas(struct super_block *sb);
#endif

static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi)
{}

static void f2fs_enable_checkpoint(struct f2fs_sb_info *sbi)
{}

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

static void f2fs_shutdown(struct super_block *sb)
{}

#ifdef CONFIG_QUOTA
static bool f2fs_need_recovery(struct f2fs_sb_info *sbi)
{}

static bool f2fs_recover_quota_begin(struct f2fs_sb_info *sbi)
{}

static void f2fs_recover_quota_end(struct f2fs_sb_info *sbi,
						bool quota_enabled)
{}

/* Read data from quotafile */
static ssize_t f2fs_quota_read(struct super_block *sb, int type, char *data,
			       size_t len, loff_t off)
{}

/* Write to quotafile */
static ssize_t f2fs_quota_write(struct super_block *sb, int type,
				const char *data, size_t len, loff_t off)
{}

int f2fs_dquot_initialize(struct inode *inode)
{}

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

static qsize_t *f2fs_get_reserved_space(struct inode *inode)
{}

static int f2fs_quota_on_mount(struct f2fs_sb_info *sbi, int type)
{}

int f2fs_enable_quota_files(struct f2fs_sb_info *sbi, bool rdonly)
{}

static int f2fs_quota_enable(struct super_block *sb, int type, int format_id,
			     unsigned int flags)
{}

static int f2fs_enable_quotas(struct super_block *sb)
{}

static int f2fs_quota_sync_file(struct f2fs_sb_info *sbi, int type)
{}

int f2fs_quota_sync(struct super_block *sb, int type)
{}

static int f2fs_quota_on(struct super_block *sb, int type, int format_id,
							const struct path *path)
{}

static int __f2fs_quota_off(struct super_block *sb, int type)
{}

static int f2fs_quota_off(struct super_block *sb, int type)
{}

void f2fs_quota_off_umount(struct super_block *sb)
{}

static void f2fs_truncate_quota_inode_pages(struct super_block *sb)
{}

static int f2fs_dquot_commit(struct dquot *dquot)
{}

static int f2fs_dquot_acquire(struct dquot *dquot)
{}

static int f2fs_dquot_release(struct dquot *dquot)
{}

static int f2fs_dquot_mark_dquot_dirty(struct dquot *dquot)
{}

static int f2fs_dquot_commit_info(struct super_block *sb, int type)
{}

static int f2fs_get_projid(struct inode *inode, kprojid_t *projid)
{}

static const struct dquot_operations f2fs_quota_operations =;

static const struct quotactl_ops f2fs_quotactl_ops =;
#else
int f2fs_dquot_initialize(struct inode *inode)
{
	return 0;
}

int f2fs_quota_sync(struct super_block *sb, int type)
{
	return 0;
}

void f2fs_quota_off_umount(struct super_block *sb)
{
}
#endif

static const struct super_operations f2fs_sops =;

#ifdef CONFIG_FS_ENCRYPTION
static int f2fs_get_context(struct inode *inode, void *ctx, size_t len)
{}

static int f2fs_set_context(struct inode *inode, const void *ctx, size_t len,
							void *fs_data)
{}

static const union fscrypt_policy *f2fs_get_dummy_policy(struct super_block *sb)
{}

static bool f2fs_has_stable_inodes(struct super_block *sb)
{}

static struct block_device **f2fs_get_devices(struct super_block *sb,
					      unsigned int *num_devs)
{}

static const struct fscrypt_operations f2fs_cryptops =;
#endif

static struct inode *f2fs_nfs_get_inode(struct super_block *sb,
		u64 ino, u32 generation)
{}

static struct dentry *f2fs_fh_to_dentry(struct super_block *sb, struct fid *fid,
		int fh_len, int fh_type)
{}

static struct dentry *f2fs_fh_to_parent(struct super_block *sb, struct fid *fid,
		int fh_len, int fh_type)
{}

static const struct export_operations f2fs_export_ops =;

loff_t max_file_blocks(struct inode *inode)
{}

static int __f2fs_commit_super(struct buffer_head *bh,
			struct f2fs_super_block *super)
{}

static inline bool sanity_check_area_boundary(struct f2fs_sb_info *sbi,
					struct buffer_head *bh)
{}

static int sanity_check_raw_super(struct f2fs_sb_info *sbi,
				struct buffer_head *bh)
{}

int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi)
{}

static void init_sb_info(struct f2fs_sb_info *sbi)
{}

static int init_percpu_info(struct f2fs_sb_info *sbi)
{}

#ifdef CONFIG_BLK_DEV_ZONED

struct f2fs_report_zones_args {};

static int f2fs_report_zone_cb(struct blk_zone *zone, unsigned int idx,
			      void *data)
{}

static int init_blkz_info(struct f2fs_sb_info *sbi, int devi)
{}
#endif

/*
 * Read f2fs raw super block.
 * Because we have two copies of super block, so read both of them
 * to get the first valid one. If any one of them is broken, we pass
 * them recovery flag back to the caller.
 */
static int read_raw_super_block(struct f2fs_sb_info *sbi,
			struct f2fs_super_block **raw_super,
			int *valid_super_block, int *recovery)
{}

int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover)
{}

static void save_stop_reason(struct f2fs_sb_info *sbi, unsigned char reason)
{}

static void f2fs_record_stop_reason(struct f2fs_sb_info *sbi)
{}

void f2fs_save_errors(struct f2fs_sb_info *sbi, unsigned char flag)
{}

static bool f2fs_update_errors(struct f2fs_sb_info *sbi)
{}

static void f2fs_record_errors(struct f2fs_sb_info *sbi, unsigned char error)
{}

void f2fs_handle_error(struct f2fs_sb_info *sbi, unsigned char error)
{}

void f2fs_handle_error_async(struct f2fs_sb_info *sbi, unsigned char error)
{}

static bool system_going_down(void)
{}

void f2fs_handle_critical_error(struct f2fs_sb_info *sbi, unsigned char reason,
							bool irq_context)
{}

static void f2fs_record_error_work(struct work_struct *work)
{}

static int f2fs_scan_devices(struct f2fs_sb_info *sbi)
{}

static int f2fs_setup_casefold(struct f2fs_sb_info *sbi)
{}

static void f2fs_tuning_parameters(struct f2fs_sb_info *sbi)
{}

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

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

static void kill_f2fs_super(struct super_block *sb)
{}

static struct file_system_type f2fs_fs_type =;
MODULE_ALIAS_FS();

static int __init init_inodecache(void)
{}

static void destroy_inodecache(void)
{}

static int __init init_f2fs_fs(void)
{}

static void __exit exit_f2fs_fs(void)
{}

module_init()
module_exit()

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