Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63189b78 authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim
Browse files

f2fs: wrap all options with f2fs_sb_info.mount_opt



This patch merges miscellaneous mount options into struct f2fs_mount_info,
After this patch, once we add new mount option, we don't need to worry
about recovery of it in remount_fs(), since we will recover the
f2fs_sb_info.mount_opt including all options.

Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 5d7881ca
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2300,7 +2300,7 @@ static ssize_t f2fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
	int rw = iov_iter_rw(iter);
	int err;
	enum rw_hint hint = iocb->ki_hint;
	int whint_mode = sbi->whint_mode;
	int whint_mode = F2FS_OPTION(sbi).whint_mode;

	err = check_direct_IO(inode, iter, offset);
	if (err)
+1 −1
Original line number Diff line number Diff line
@@ -704,7 +704,7 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page,

	f2fs_update_time(F2FS_I_SB(dir), REQ_TIME);

	if (F2FS_I_SB(dir)->fsync_mode == FSYNC_MODE_STRICT)
	if (F2FS_OPTION(F2FS_I_SB(dir)).fsync_mode == FSYNC_MODE_STRICT)
		add_ino_entry(F2FS_I_SB(dir), dir->i_ino, TRANS_DIR_INO);

	if (f2fs_has_inline_dentry(dir))
+29 −35
Original line number Diff line number Diff line
@@ -98,9 +98,10 @@ extern char *fault_name[FAULT_MAX];
#define F2FS_MOUNT_INLINE_XATTR_SIZE	0x00800000
#define F2FS_MOUNT_RESERVE_ROOT		0x01000000

#define clear_opt(sbi, option)	((sbi)->mount_opt.opt &= ~F2FS_MOUNT_##option)
#define set_opt(sbi, option)	((sbi)->mount_opt.opt |= F2FS_MOUNT_##option)
#define test_opt(sbi, option)	((sbi)->mount_opt.opt & F2FS_MOUNT_##option)
#define F2FS_OPTION(sbi)	((sbi)->mount_opt)
#define clear_opt(sbi, option)	(F2FS_OPTION(sbi).opt &= ~F2FS_MOUNT_##option)
#define set_opt(sbi, option)	(F2FS_OPTION(sbi).opt |= F2FS_MOUNT_##option)
#define test_opt(sbi, option)	(F2FS_OPTION(sbi).opt & F2FS_MOUNT_##option)

#define ver_after(a, b)	(typecheck(unsigned long long, a) &&		\
		typecheck(unsigned long long, b) &&			\
@@ -114,6 +115,24 @@ typedef u32 nid_t;

struct f2fs_mount_info {
	unsigned int opt;
	int write_io_size_bits;		/* Write IO size bits */
	block_t root_reserved_blocks;	/* root reserved blocks */
	kuid_t s_resuid;		/* reserved blocks for uid */
	kgid_t s_resgid;		/* reserved blocks for gid */
	int active_logs;		/* # of active logs */
	int inline_xattr_size;		/* inline xattr size */
#ifdef CONFIG_F2FS_FAULT_INJECTION
	struct f2fs_fault_info fault_info;	/* For fault injection */
#endif
#ifdef CONFIG_QUOTA
	/* Names of quota files with journalled quota */
	char *s_qf_names[MAXQUOTAS];
	int s_jquota_fmt;			/* Format of quota to use */
#endif
	/* For which write hints are passed down to block layer */
	int whint_mode;
	int alloc_mode;			/* segment allocation policy */
	int fsync_mode;			/* fsync policy */
};

#define F2FS_FEATURE_ENCRYPT		0x0001
@@ -1081,7 +1100,6 @@ struct f2fs_sb_info {
	struct f2fs_bio_info *write_io[NR_PAGE_TYPE];	/* for write bios */
	struct mutex wio_mutex[NR_PAGE_TYPE - 1][NR_TEMP_TYPE];
						/* bio ordering for NODE/DATA */
	int write_io_size_bits;			/* Write IO size bits */
	mempool_t *write_io_dummy;		/* Dummy pages */

	/* for checkpoint */
@@ -1131,9 +1149,7 @@ struct f2fs_sb_info {
	unsigned int total_node_count;		/* total node block count */
	unsigned int total_valid_node_count;	/* valid node block count */
	loff_t max_file_blocks;			/* max block index of file */
	int active_logs;			/* # of active logs */
	int dir_level;				/* directory level */
	int inline_xattr_size;			/* inline xattr size */
	unsigned int trigger_ssr_threshold;	/* threshold to trigger ssr */
	int readdir_ra;				/* readahead inode in readdir */

@@ -1143,9 +1159,6 @@ struct f2fs_sb_info {
	block_t last_valid_block_count;		/* for recovery */
	block_t reserved_blocks;		/* configurable reserved blocks */
	block_t current_reserved_blocks;	/* current reserved blocks */
	block_t root_reserved_blocks;		/* root reserved blocks */
	kuid_t s_resuid;			/* reserved blocks for uid */
	kgid_t s_resgid;			/* reserved blocks for gid */

	unsigned int nquota_files;		/* # of quota sysfile */

@@ -1230,25 +1243,6 @@ struct f2fs_sb_info {

	/* Precomputed FS UUID checksum for seeding other checksums */
	__u32 s_chksum_seed;

	/* For fault injection */
#ifdef CONFIG_F2FS_FAULT_INJECTION
	struct f2fs_fault_info fault_info;
#endif

#ifdef CONFIG_QUOTA
	/* Names of quota files with journalled quota */
	char *s_qf_names[MAXQUOTAS];
	int s_jquota_fmt;			/* Format of quota to use */
#endif
	/* For which write hints are passed down to block layer */
	int whint_mode;

	/* segment allocation policy */
	int alloc_mode;

	/* fsync policy */
	int fsync_mode;
};

#ifdef CONFIG_F2FS_FAULT_INJECTION
@@ -1258,7 +1252,7 @@ struct f2fs_sb_info {
		__func__, __builtin_return_address(0))
static inline bool time_to_inject(struct f2fs_sb_info *sbi, int type)
{
	struct f2fs_fault_info *ffi = &sbi->fault_info;
	struct f2fs_fault_info *ffi = &F2FS_OPTION(sbi).fault_info;

	if (!ffi->inject_rate)
		return false;
@@ -1615,10 +1609,10 @@ static inline bool __allow_reserved_blocks(struct f2fs_sb_info *sbi,
		return false;
	if (IS_NOQUOTA(inode))
		return true;
	if (uid_eq(sbi->s_resuid, current_fsuid()))
	if (uid_eq(F2FS_OPTION(sbi).s_resuid, current_fsuid()))
		return true;
	if (!gid_eq(sbi->s_resgid, GLOBAL_ROOT_GID) &&
					in_group_p(sbi->s_resgid))
	if (!gid_eq(F2FS_OPTION(sbi).s_resgid, GLOBAL_ROOT_GID) &&
					in_group_p(F2FS_OPTION(sbi).s_resgid))
		return true;
	if (capable(CAP_SYS_RESOURCE))
		return true;
@@ -1656,7 +1650,7 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi,
					sbi->current_reserved_blocks;

	if (!__allow_reserved_blocks(sbi, inode))
		avail_user_block_count -= sbi->root_reserved_blocks;
		avail_user_block_count -= F2FS_OPTION(sbi).root_reserved_blocks;

	if (unlikely(sbi->total_valid_block_count > avail_user_block_count)) {
		diff = sbi->total_valid_block_count - avail_user_block_count;
@@ -1863,7 +1857,7 @@ static inline int inc_valid_node_count(struct f2fs_sb_info *sbi,
					sbi->current_reserved_blocks + 1;

	if (!__allow_reserved_blocks(sbi, inode))
		valid_block_count += sbi->root_reserved_blocks;
		valid_block_count += F2FS_OPTION(sbi).root_reserved_blocks;

	if (unlikely(valid_block_count > sbi->user_block_count)) {
		spin_unlock(&sbi->stat_lock);
+2 −2
Original line number Diff line number Diff line
@@ -163,9 +163,9 @@ static inline enum cp_reason_type need_do_checkpoint(struct inode *inode)
		cp_reason = CP_NODE_NEED_CP;
	else if (test_opt(sbi, FASTBOOT))
		cp_reason = CP_FASTBOOT_MODE;
	else if (sbi->active_logs == 2)
	else if (F2FS_OPTION(sbi).active_logs == 2)
		cp_reason = CP_SPEC_LOG_NUM;
	else if (sbi->fsync_mode == FSYNC_MODE_STRICT &&
	else if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_STRICT &&
		need_dentry_mark(sbi, inode->i_ino) &&
		exist_written_data(sbi, F2FS_I(inode)->i_pino, TRANS_DIR_INO))
		cp_reason = CP_RECOVER_DIR;
+3 −3
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode)
	if (f2fs_sb_has_flexible_inline_xattr(sbi->sb)) {
		f2fs_bug_on(sbi, !f2fs_has_extra_attr(inode));
		if (f2fs_has_inline_xattr(inode))
			xattr_size = sbi->inline_xattr_size;
			xattr_size = F2FS_OPTION(sbi).inline_xattr_size;
		/* Otherwise, will be 0 */
	} else if (f2fs_has_inline_xattr(inode) ||
				f2fs_has_inline_dentry(inode)) {
@@ -970,7 +970,7 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
			f2fs_put_page(old_dir_page, 0);
		f2fs_i_links_write(old_dir, false);
	}
	if (sbi->fsync_mode == FSYNC_MODE_STRICT)
	if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_STRICT)
		add_ino_entry(sbi, new_dir->i_ino, TRANS_DIR_INO);

	f2fs_unlock_op(sbi);
@@ -1121,7 +1121,7 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
	}
	f2fs_mark_inode_dirty_sync(new_dir, false);

	if (sbi->fsync_mode == FSYNC_MODE_STRICT) {
	if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_STRICT) {
		add_ino_entry(sbi, old_dir->i_ino, TRANS_DIR_INO);
		add_ino_entry(sbi, new_dir->i_ino, TRANS_DIR_INO);
	}
Loading