f2fs: wrap all options with f2fs_sb_info.mount_opt
PATCH 1/1 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 Chao Yu <[email protected]>
--- fs/f2fs/data.c | 2 +- fs/f2fs/dir.c | 2 +- fs/f2fs/f2fs.h | 64 +++++++------- fs/f2fs/file.c | 4 +- fs/f2fs/namei.c | 6 +- fs/f2fs/segment.c | 8 +- fs/f2fs/super.c | 226 +++++++++++++++++++++++------------------------- fs/f2fs/sysfs.c | 4 +- include/linux/f2fs_fs.h | 8 +- 9 files changed, 154 insertions(+), 170 deletions(-)
fs/f2fs/data.c +1 -1
@@ -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)
fs/f2fs/dir.c +1 -1
@@ -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))
fs/f2fs/f2fs.h +29 -35
126 lines not on this page · raw message
fs/f2fs/file.c +2 -2
@@ -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 ;
fs/f2fs/namei.c +3 -3
@@ -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)) {
@@ -972,7 +972,7 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, }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);
@@ -1125,7 +1125,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 ); }
fs/f2fs/segment.c +4 -4
@@ -2171,7 +2171,7 @@ static unsigned int __get_next_segno(struct f2fs_sb_info *sbi, int type)return SIT_I (sbi)->last_victim[ALLOC_NEXT ];/* find segments from 0 to reuse freed segments */ -if (sbi->alloc_mode ==ALLOC_MODE_REUSE ) +if (F2FS_OPTION (sbi).alloc_mode ==ALLOC_MODE_REUSE )return 0 ;return CURSEG_I (sbi, type)->segno;
@@ -2524,7 +2524,7 @@ int rw_hint_to_seg_type(enum rw_hint hint)enum rw_hint io_type_to_rw_hint (struct f2fs_sb_info *sbi,enum page_type type,enum temp_type temp) { -if (sbi->whint_mode ==WHINT_MODE_USER ) { +if (F2FS_OPTION (sbi).whint_mode ==WHINT_MODE_USER ) {if (type ==DATA ) {if (temp ==WARM )return WRITE_LIFE_NOT_SET ;
@@ -2535,7 +2535,7 @@ enum rw_hint io_type_to_rw_hint(struct f2fs_sb_info *sbi, }else {return WRITE_LIFE_NOT_SET ; } - }else if (sbi->whint_mode ==WHINT_MODE_FS ) { + }else if (F2FS_OPTION (sbi).whint_mode ==WHINT_MODE_FS ) {if (type ==DATA ) {if (temp ==WARM )return WRITE_LIFE_LONG ;
@@ -2603,7 +2603,7 @@ static int __get_segment_type(struct f2fs_io_info *fio) {int type =0 ; -switch (fio->sbi->active_logs) { +switch (F2FS_OPTION (fio->sbi).active_logs) {case 2 : type =__get_segment_type_2 (fio);break ;
fs/f2fs/super.c +108 -118
525 lines not on this page · raw message
fs/f2fs/sysfs.c +2 -2
@@ -58,7 +58,7 @@ static unsigned char *__struct_ptr(struct f2fs_sb_info *sbi, int struct_type)#ifdef CONFIG_F2FS_FAULT_INJECTION else if (struct_type == FAULT_INFO_RATE || struct_type == FAULT_INFO_TYPE) - return (unsigned char *)&sbi->fault_info; + return (unsigned char *)&F2FS_OPTION(sbi).fault_info;#endif return NULL ; }
@@ -222,7 +222,7 @@ static ssize_t f2fs_sbi_store(struct f2fs_attr *a,if (a->struct_type ==RESERVED_BLOCKS ) {spin_lock (&sbi->stat_lock);if (t > (unsigned long )(sbi->user_block_count - - sbi->root_reserved_blocks)) { +F2FS_OPTION (sbi).root_reserved_blocks)) {spin_unlock (&sbi->stat_lock);return -EINVAL ; }
include/linux/f2fs_fs.h +4 -4
@@ -39,10 +39,10 @@#define F2FS_MAX_QUOTAS 3 -#define F2FS_IO_SIZE (sbi) (1 << (sbi)->write_io_size_bits)/* Blocks */ -#define F2FS_IO_SIZE_KB (sbi) (1 << ((sbi)->write_io_size_bits + 2))/* KB */ -#define F2FS_IO_SIZE_BYTES (sbi) (1 << ((sbi)->write_io_size_bits + 12))/* B */ -#define F2FS_IO_SIZE_BITS (sbi) ((sbi)->write_io_size_bits)/* power of 2 */ +#define F2FS_IO_SIZE (sbi) (1 << F2FS_OPTION(sbi).write_io_size_bits)/* Blocks */ +#define F2FS_IO_SIZE_KB (sbi) (1 << (F2FS_OPTION(sbi).write_io_size_bits + 2))/* KB */ +#define F2FS_IO_SIZE_BYTES (sbi) (1 << (F2FS_OPTION(sbi).write_io_size_bits + 12))/* B */ +#define F2FS_IO_SIZE_BITS (sbi) (F2FS_OPTION(sbi).write_io_size_bits)/* power of 2 */ #define F2FS_IO_SIZE_MASK (sbi) (F2FS_IO_SIZE(sbi) - 1)/* This flag is used by node and meta inodes, and by recovery */
Signature · 1 line
2.15.0.55.gc2ece9dc4de6