diff mbox series

[f2fs-dev] f2fs: refactor struct f2fs_attr macro

Message ID 20230415132446.13063-1-frank.li@vivo.com (mailing list archive)
State Superseded
Headers show
Series [f2fs-dev] f2fs: refactor struct f2fs_attr macro | expand

Commit Message

Yangtao Li April 15, 2023, 1:24 p.m. UTC
This patch provides a large number of variants of F2FS_RW_ATTR
and F2FS_RO_ATTR macros, reducing the number of parameters required
to initialize the f2fs_attr structure.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/f2fs/sysfs.c | 237 +++++++++++++++++++++++++++++-------------------
 1 file changed, 146 insertions(+), 91 deletions(-)

Comments

kernel test robot April 15, 2023, 2:43 p.m. UTC | #1
Hi Yangtao,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jaegeuk-f2fs/dev-test]
[also build test WARNING on jaegeuk-f2fs/dev]
[cannot apply to linus/master v6.3-rc6]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Yangtao-Li/f2fs-refactor-struct-f2fs_attr-macro/20230415-212520
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
patch link:    https://lore.kernel.org/r/20230415132446.13063-1-frank.li%40vivo.com
patch subject: [PATCH] f2fs: refactor struct f2fs_attr macro
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230415/202304152234.wjaY3IYm-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/280d6a5b38dd6b5a5303f5426e9f71466a13f047
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Yangtao-Li/f2fs-refactor-struct-f2fs_attr-macro/20230415-212520
        git checkout 280d6a5b38dd6b5a5303f5426e9f71466a13f047
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash fs/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304152234.wjaY3IYm-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> fs/f2fs/sysfs.c:981:1: warning: data definition has no type or storage class
     981 | FAULT_INFO_TYPE_GENERAL_RW_ATTR(inject_type);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/f2fs/sysfs.c:981:1: error: type defaults to 'int' in declaration of 'FAULT_INFO_TYPE_GENERAL_RW_ATTR' [-Werror=implicit-int]
>> fs/f2fs/sysfs.c:981:1: warning: parameter names (without types) in function declaration
   fs/f2fs/sysfs.c:1045:27: error: 'f2fs_attr_inject_type' undeclared here (not in a function); did you mean 'f2fs_attr_inject_rate'?
    1045 | #define ATTR_LIST(name) (&f2fs_attr_##name.attr)
         |                           ^~~~~~~~~~
   fs/f2fs/sysfs.c:1094:9: note: in expansion of macro 'ATTR_LIST'
    1094 |         ATTR_LIST(inject_type),
         |         ^~~~~~~~~
   cc1: some warnings being treated as errors


vim +981 fs/f2fs/sysfs.c

   977	
   978	/* FAULT_INFO ATTR */
   979	#ifdef CONFIG_F2FS_FAULT_INJECTION
   980	FAULT_INFO_RATE_GENERAL_RW_ATTR(inject_rate);
 > 981	FAULT_INFO_TYPE_GENERAL_RW_ATTR(inject_type);
   982	#endif
   983
kernel test robot April 15, 2023, 4:28 p.m. UTC | #2
Hi Yangtao,

kernel test robot noticed the following build errors:

[auto build test ERROR on jaegeuk-f2fs/dev-test]
[also build test ERROR on jaegeuk-f2fs/dev]
[cannot apply to linus/master v6.3-rc6]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Yangtao-Li/f2fs-refactor-struct-f2fs_attr-macro/20230415-212520
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
patch link:    https://lore.kernel.org/r/20230415132446.13063-1-frank.li%40vivo.com
patch subject: [PATCH] f2fs: refactor struct f2fs_attr macro
config: arm-randconfig-r046-20230410 (https://download.01.org/0day-ci/archive/20230416/202304160030.xKck82Nx-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 9638da200e00bd069e6dd63604e14cbafede9324)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/intel-lab-lkp/linux/commit/280d6a5b38dd6b5a5303f5426e9f71466a13f047
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Yangtao-Li/f2fs-refactor-struct-f2fs_attr-macro/20230415-212520
        git checkout 280d6a5b38dd6b5a5303f5426e9f71466a13f047
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash fs/f2fs/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304160030.xKck82Nx-lkp@intel.com/

All errors (new ones prefixed by >>):

>> fs/f2fs/sysfs.c:981:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
   FAULT_INFO_TYPE_GENERAL_RW_ATTR(inject_type);
   ^
   int
>> fs/f2fs/sysfs.c:981:33: error: a parameter list without types is only allowed in a function definition
   FAULT_INFO_TYPE_GENERAL_RW_ATTR(inject_type);
                                   ^
>> fs/f2fs/sysfs.c:1094:2: error: use of undeclared identifier 'f2fs_attr_inject_type'; did you mean 'f2fs_attr_inject_rate'?
           ATTR_LIST(inject_type),
           ^
   fs/f2fs/sysfs.c:1045:27: note: expanded from macro 'ATTR_LIST'
   #define ATTR_LIST(name) (&f2fs_attr_##name.attr)
                             ^
   <scratch space>:20:1: note: expanded from here
   f2fs_attr_inject_type
   ^
   fs/f2fs/sysfs.c:980:1: note: 'f2fs_attr_inject_rate' declared here
   FAULT_INFO_RATE_GENERAL_RW_ATTR(inject_rate);
   ^
   fs/f2fs/sysfs.c:879:2: note: expanded from macro 'FAULT_INFO_RATE_GENERAL_RW_ATTR'
           F2FS_RW_ATTR(FAULT_INFO_RATE, f2fs_fault_info, elname, elname)  \
           ^
   fs/f2fs/sysfs.c:838:2: note: expanded from macro 'F2FS_RW_ATTR'
           F2FS_ATTR_OFFSET(struct_type, name, 0644,               \
           ^
   fs/f2fs/sysfs.c:824:25: note: expanded from macro 'F2FS_ATTR_OFFSET'
   static struct f2fs_attr f2fs_attr_##_name = {                   \
                           ^
   <scratch space>:48:1: note: expanded from here
   f2fs_attr_inject_rate
   ^
   3 errors generated.


vim +/int +981 fs/f2fs/sysfs.c

   977	
   978	/* FAULT_INFO ATTR */
   979	#ifdef CONFIG_F2FS_FAULT_INJECTION
   980	FAULT_INFO_RATE_GENERAL_RW_ATTR(inject_rate);
 > 981	FAULT_INFO_TYPE_GENERAL_RW_ATTR(inject_type);
   982	#endif
   983	
   984	/* RESERVED_BLOCKS ATTR */
   985	RESERVED_BLOCKS_GENERAL_RW_ATTR(reserved_blocks);
   986	
   987	/* CPRC_INFO ATTR */
   988	CPRC_INFO_GENERAL_RW_ATTR(ckpt_thread_ioprio);
   989	
   990	/* ATGC_INFO ATTR */
   991	ATGC_INFO_RW_ATTR(atgc_candidate_ratio, candidate_ratio);
   992	ATGC_INFO_RW_ATTR(atgc_candidate_count, max_candidate_count);
   993	ATGC_INFO_RW_ATTR(atgc_age_weight, age_weight);
   994	ATGC_INFO_RW_ATTR(atgc_age_threshold, age_threshold);
   995	
   996	F2FS_GENERAL_RO_ATTR(dirty_segments);
   997	F2FS_GENERAL_RO_ATTR(free_segments);
   998	F2FS_GENERAL_RO_ATTR(ovp_segments);
   999	F2FS_GENERAL_RO_ATTR(lifetime_write_kbytes);
  1000	F2FS_GENERAL_RO_ATTR(features);
  1001	F2FS_GENERAL_RO_ATTR(current_reserved_blocks);
  1002	F2FS_GENERAL_RO_ATTR(unusable);
  1003	F2FS_GENERAL_RO_ATTR(encoding);
  1004	F2FS_GENERAL_RO_ATTR(mounted_time_sec);
  1005	F2FS_GENERAL_RO_ATTR(main_blkaddr);
  1006	F2FS_GENERAL_RO_ATTR(pending_discard);
  1007	F2FS_GENERAL_RO_ATTR(gc_mode);
  1008	#ifdef CONFIG_F2FS_STAT_FS
  1009	F2FS_GENERAL_RO_ATTR(moved_blocks_background);
  1010	F2FS_GENERAL_RO_ATTR(moved_blocks_foreground);
  1011	F2FS_GENERAL_RO_ATTR(avg_vblocks);
  1012	#endif
  1013	
  1014	#ifdef CONFIG_FS_ENCRYPTION
  1015	F2FS_FEATURE_RO_ATTR(encryption);
  1016	F2FS_FEATURE_RO_ATTR(test_dummy_encryption_v2);
  1017	#if IS_ENABLED(CONFIG_UNICODE)
  1018	F2FS_FEATURE_RO_ATTR(encrypted_casefold);
  1019	#endif
  1020	#endif /* CONFIG_FS_ENCRYPTION */
  1021	#ifdef CONFIG_BLK_DEV_ZONED
  1022	F2FS_FEATURE_RO_ATTR(block_zoned);
  1023	#endif
  1024	F2FS_FEATURE_RO_ATTR(atomic_write);
  1025	F2FS_FEATURE_RO_ATTR(extra_attr);
  1026	F2FS_FEATURE_RO_ATTR(project_quota);
  1027	F2FS_FEATURE_RO_ATTR(inode_checksum);
  1028	F2FS_FEATURE_RO_ATTR(flexible_inline_xattr);
  1029	F2FS_FEATURE_RO_ATTR(quota_ino);
  1030	F2FS_FEATURE_RO_ATTR(inode_crtime);
  1031	F2FS_FEATURE_RO_ATTR(lost_found);
  1032	#ifdef CONFIG_FS_VERITY
  1033	F2FS_FEATURE_RO_ATTR(verity);
  1034	#endif
  1035	F2FS_FEATURE_RO_ATTR(sb_checksum);
  1036	#if IS_ENABLED(CONFIG_UNICODE)
  1037	F2FS_FEATURE_RO_ATTR(casefold);
  1038	#endif
  1039	F2FS_FEATURE_RO_ATTR(readonly);
  1040	#ifdef CONFIG_F2FS_FS_COMPRESSION
  1041	F2FS_FEATURE_RO_ATTR(compression);
  1042	#endif
  1043	F2FS_FEATURE_RO_ATTR(pin_file);
  1044	
  1045	#define ATTR_LIST(name) (&f2fs_attr_##name.attr)
  1046	static struct attribute *f2fs_attrs[] = {
  1047		ATTR_LIST(gc_urgent_sleep_time),
  1048		ATTR_LIST(gc_min_sleep_time),
  1049		ATTR_LIST(gc_max_sleep_time),
  1050		ATTR_LIST(gc_no_gc_sleep_time),
  1051		ATTR_LIST(gc_idle),
  1052		ATTR_LIST(gc_urgent),
  1053		ATTR_LIST(reclaim_segments),
  1054		ATTR_LIST(main_blkaddr),
  1055		ATTR_LIST(max_small_discards),
  1056		ATTR_LIST(max_discard_request),
  1057		ATTR_LIST(min_discard_issue_time),
  1058		ATTR_LIST(mid_discard_issue_time),
  1059		ATTR_LIST(max_discard_issue_time),
  1060		ATTR_LIST(discard_io_aware_gran),
  1061		ATTR_LIST(discard_urgent_util),
  1062		ATTR_LIST(discard_granularity),
  1063		ATTR_LIST(max_ordered_discard),
  1064		ATTR_LIST(pending_discard),
  1065		ATTR_LIST(gc_mode),
  1066		ATTR_LIST(ipu_policy),
  1067		ATTR_LIST(min_ipu_util),
  1068		ATTR_LIST(min_fsync_blocks),
  1069		ATTR_LIST(min_seq_blocks),
  1070		ATTR_LIST(min_hot_blocks),
  1071		ATTR_LIST(min_ssr_sections),
  1072		ATTR_LIST(max_victim_search),
  1073		ATTR_LIST(migration_granularity),
  1074		ATTR_LIST(dir_level),
  1075		ATTR_LIST(ram_thresh),
  1076		ATTR_LIST(ra_nid_pages),
  1077		ATTR_LIST(dirty_nats_ratio),
  1078		ATTR_LIST(max_roll_forward_node_blocks),
  1079		ATTR_LIST(cp_interval),
  1080		ATTR_LIST(idle_interval),
  1081		ATTR_LIST(discard_idle_interval),
  1082		ATTR_LIST(gc_idle_interval),
  1083		ATTR_LIST(umount_discard_timeout),
  1084	#ifdef CONFIG_F2FS_IOSTAT
  1085		ATTR_LIST(iostat_enable),
  1086		ATTR_LIST(iostat_period_ms),
  1087	#endif
  1088		ATTR_LIST(readdir_ra),
  1089		ATTR_LIST(max_io_bytes),
  1090		ATTR_LIST(gc_pin_file_thresh),
  1091		ATTR_LIST(extension_list),
  1092	#ifdef CONFIG_F2FS_FAULT_INJECTION
  1093		ATTR_LIST(inject_rate),
> 1094		ATTR_LIST(inject_type),
  1095	#endif
  1096		ATTR_LIST(data_io_flag),
  1097		ATTR_LIST(node_io_flag),
  1098		ATTR_LIST(gc_remaining_trials),
  1099		ATTR_LIST(ckpt_thread_ioprio),
  1100		ATTR_LIST(dirty_segments),
  1101		ATTR_LIST(free_segments),
  1102		ATTR_LIST(ovp_segments),
  1103		ATTR_LIST(unusable),
  1104		ATTR_LIST(lifetime_write_kbytes),
  1105		ATTR_LIST(features),
  1106		ATTR_LIST(reserved_blocks),
  1107		ATTR_LIST(current_reserved_blocks),
  1108		ATTR_LIST(encoding),
  1109		ATTR_LIST(mounted_time_sec),
  1110	#ifdef CONFIG_F2FS_STAT_FS
  1111		ATTR_LIST(cp_foreground_calls),
  1112		ATTR_LIST(cp_background_calls),
  1113		ATTR_LIST(gc_foreground_calls),
  1114		ATTR_LIST(gc_background_calls),
  1115		ATTR_LIST(moved_blocks_foreground),
  1116		ATTR_LIST(moved_blocks_background),
  1117		ATTR_LIST(avg_vblocks),
  1118	#endif
  1119	#ifdef CONFIG_BLK_DEV_ZONED
  1120		ATTR_LIST(unusable_blocks_per_sec),
  1121	#endif
  1122	#ifdef CONFIG_F2FS_FS_COMPRESSION
  1123		ATTR_LIST(compr_written_block),
  1124		ATTR_LIST(compr_saved_block),
  1125		ATTR_LIST(compr_new_inode),
  1126		ATTR_LIST(compress_percent),
  1127		ATTR_LIST(compress_watermark),
  1128	#endif
  1129		/* For ATGC */
  1130		ATTR_LIST(atgc_candidate_ratio),
  1131		ATTR_LIST(atgc_candidate_count),
  1132		ATTR_LIST(atgc_age_weight),
  1133		ATTR_LIST(atgc_age_threshold),
  1134		ATTR_LIST(seq_file_ra_mul),
  1135		ATTR_LIST(gc_segment_mode),
  1136		ATTR_LIST(gc_reclaimed_segments),
  1137		ATTR_LIST(max_fragment_chunk),
  1138		ATTR_LIST(max_fragment_hole),
  1139		ATTR_LIST(current_atomic_write),
  1140		ATTR_LIST(peak_atomic_write),
  1141		ATTR_LIST(committed_atomic_block),
  1142		ATTR_LIST(revoked_atomic_block),
  1143		ATTR_LIST(hot_data_age_threshold),
  1144		ATTR_LIST(warm_data_age_threshold),
  1145		ATTR_LIST(last_age_weight),
  1146		NULL,
  1147	};
  1148	ATTRIBUTE_GROUPS(f2fs);
  1149
diff mbox series

Patch

diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index 8ea05340bad9..b9aa2f989387 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -842,68 +842,157 @@  static struct f2fs_attr f2fs_attr_##_name = {			\
 #define F2FS_GENERAL_RO_ATTR(name) \
 static struct f2fs_attr f2fs_attr_##name = __ATTR(name, 0444, name##_show, NULL)
 
-#define F2FS_STAT_ATTR(_struct_type, _struct_name, _name, _elname)	\
-static struct f2fs_attr f2fs_attr_##_name = {			\
-	.attr = {.name = __stringify(_name), .mode = 0444 },	\
-	.show = f2fs_sbi_show,					\
-	.struct_type = _struct_type,				\
-	.offset = offsetof(struct _struct_name, _elname),       \
-}
+#define STAT_INFO_RO_ATTR(name, elname)				\
+	F2FS_RO_ATTR(STAT_INFO, f2fs_stat_info, name, elname)	\
+
+#define GC_THREAD_RW_ATTR(name, elname)				\
+	F2FS_RW_ATTR(GC_THREAD, f2fs_gc_kthread, name, elname)	\
+
+#define SM_INFO_RW_ATTR(name, elname)				\
+	F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, name, elname)	\
+
+#define SM_INFO_GENERAL_RW_ATTR(elname)				\
+	SM_INFO_RW_ATTR(elname, elname)				\
+
+#define DCC_INFO_RW_ATTR(name, elname)					\
+	F2FS_RW_ATTR(DCC_INFO, discard_cmd_control, name, elname)	\
+
+#define DCC_INFO_GENERAL_RW_ATTR(elname)			\
+	DCC_INFO_RW_ATTR(elname, elname)			\
+
+#define NM_INFO_RW_ATTR(name, elname)				\
+	F2FS_RW_ATTR(NM_INFO, f2fs_nm_info, name, elname)	\
+
+#define NM_INFO_GENERAL_RW_ATTR(elname)				\
+	NM_INFO_RW_ATTR(elname, elname)				\
+
+#define F2FS_SBI_RW_ATTR(name, elname)				\
+	F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, name, elname)	\
+
+#define F2FS_SBI_GENERAL_RW_ATTR(elname)			\
+	F2FS_SBI_RW_ATTR(elname, elname)			\
+
+#define F2FS_SBI_GENERAL_RO_ATTR(elname)			\
+	F2FS_RO_ATTR(F2FS_SBI, f2fs_sb_info, elname, elname)	\
+
+#define FAULT_INFO_RATE_GENERAL_RW_ATTR(elname)				\
+	F2FS_RW_ATTR(FAULT_INFO_RATE, f2fs_fault_info, elname, elname)	\
+
+#define FAULT_INFO_TYPE_RATE_GENERAL_RW_ATTR(elname)			\
+	F2FS_RW_ATTR(FAULT_INFO_TYPE, f2fs_fault_info, elname, elname)	\
+
+#define RESERVED_BLOCKS_GENERAL_RW_ATTR(elname)				\
+	F2FS_RW_ATTR(RESERVED_BLOCKS, f2fs_sb_info, elname, elname)	\
+
+#define CPRC_INFO_GENERAL_RW_ATTR(elname)				\
+	F2FS_RW_ATTR(CPRC_INFO, ckpt_req_control, elname, elname)	\
+
+#define ATGC_INFO_RW_ATTR(name, elname)				\
+	F2FS_RW_ATTR(ATGC_INFO, atgc_management, name, elname)	\
 
-F2FS_RW_ATTR(GC_THREAD, f2fs_gc_kthread, gc_urgent_sleep_time,
-							urgent_sleep_time);
-F2FS_RW_ATTR(GC_THREAD, f2fs_gc_kthread, gc_min_sleep_time, min_sleep_time);
-F2FS_RW_ATTR(GC_THREAD, f2fs_gc_kthread, gc_max_sleep_time, max_sleep_time);
-F2FS_RW_ATTR(GC_THREAD, f2fs_gc_kthread, gc_no_gc_sleep_time, no_gc_sleep_time);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_idle, gc_mode);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_urgent, gc_mode);
-F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, reclaim_segments, rec_prefree_segments);
-F2FS_RW_ATTR(DCC_INFO, discard_cmd_control, max_small_discards, max_discards);
-F2FS_RW_ATTR(DCC_INFO, discard_cmd_control, max_discard_request, max_discard_request);
-F2FS_RW_ATTR(DCC_INFO, discard_cmd_control, min_discard_issue_time, min_discard_issue_time);
-F2FS_RW_ATTR(DCC_INFO, discard_cmd_control, mid_discard_issue_time, mid_discard_issue_time);
-F2FS_RW_ATTR(DCC_INFO, discard_cmd_control, max_discard_issue_time, max_discard_issue_time);
-F2FS_RW_ATTR(DCC_INFO, discard_cmd_control, discard_io_aware_gran, discard_io_aware_gran);
-F2FS_RW_ATTR(DCC_INFO, discard_cmd_control, discard_urgent_util, discard_urgent_util);
-F2FS_RW_ATTR(DCC_INFO, discard_cmd_control, discard_granularity, discard_granularity);
-F2FS_RW_ATTR(DCC_INFO, discard_cmd_control, max_ordered_discard, max_ordered_discard);
-F2FS_RW_ATTR(RESERVED_BLOCKS, f2fs_sb_info, reserved_blocks, reserved_blocks);
-F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, ipu_policy, ipu_policy);
-F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, min_ipu_util, min_ipu_util);
-F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, min_fsync_blocks, min_fsync_blocks);
-F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, min_seq_blocks, min_seq_blocks);
-F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, min_hot_blocks, min_hot_blocks);
-F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, min_ssr_sections, min_ssr_sections);
-F2FS_RW_ATTR(NM_INFO, f2fs_nm_info, ram_thresh, ram_thresh);
-F2FS_RW_ATTR(NM_INFO, f2fs_nm_info, ra_nid_pages, ra_nid_pages);
-F2FS_RW_ATTR(NM_INFO, f2fs_nm_info, dirty_nats_ratio, dirty_nats_ratio);
-F2FS_RW_ATTR(NM_INFO, f2fs_nm_info, max_roll_forward_node_blocks, max_rf_node_blocks);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, max_victim_search, max_victim_search);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, migration_granularity, migration_granularity);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, dir_level, dir_level);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, cp_interval, interval_time[CP_TIME]);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, idle_interval, interval_time[REQ_TIME]);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, discard_idle_interval,
-					interval_time[DISCARD_TIME]);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_idle_interval, interval_time[GC_TIME]);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info,
-		umount_discard_timeout, interval_time[UMOUNT_DISCARD_TIMEOUT]);
+/* GC_THREAD ATTR */
+GC_THREAD_RW_ATTR(gc_urgent_sleep_time, urgent_sleep_time);
+GC_THREAD_RW_ATTR(gc_min_sleep_time, min_sleep_time);
+GC_THREAD_RW_ATTR(gc_max_sleep_time, max_sleep_time);
+GC_THREAD_RW_ATTR(gc_no_gc_sleep_time, no_gc_sleep_time);
+
+/* SM_INFO ATTR */
+SM_INFO_RW_ATTR(reclaim_segments, rec_prefree_segments);
+SM_INFO_GENERAL_RW_ATTR(ipu_policy);
+SM_INFO_GENERAL_RW_ATTR(min_ipu_util);
+SM_INFO_GENERAL_RW_ATTR(min_fsync_blocks);
+SM_INFO_GENERAL_RW_ATTR(min_seq_blocks);
+SM_INFO_GENERAL_RW_ATTR(min_hot_blocks);
+SM_INFO_GENERAL_RW_ATTR(min_ssr_sections);
+
+/* DCC_INFO ATTR */
+DCC_INFO_RW_ATTR(max_small_discards, max_discards);
+DCC_INFO_GENERAL_RW_ATTR(max_discard_request);
+DCC_INFO_GENERAL_RW_ATTR(min_discard_issue_time);
+DCC_INFO_GENERAL_RW_ATTR(mid_discard_issue_time);
+DCC_INFO_GENERAL_RW_ATTR(max_discard_issue_time);
+DCC_INFO_GENERAL_RW_ATTR(discard_io_aware_gran);
+DCC_INFO_GENERAL_RW_ATTR(discard_urgent_util);
+DCC_INFO_GENERAL_RW_ATTR(discard_granularity);
+DCC_INFO_GENERAL_RW_ATTR(max_ordered_discard);
+
+/* NM_INFO ATTR */
+NM_INFO_RW_ATTR(max_roll_forward_node_blocks, max_rf_node_blocks);
+NM_INFO_GENERAL_RW_ATTR(ram_thresh);
+NM_INFO_GENERAL_RW_ATTR(ra_nid_pages);
+NM_INFO_GENERAL_RW_ATTR(dirty_nats_ratio);
+
+/* F2FS_SBI ATTR */
+F2FS_RW_ATTR(F2FS_SBI, f2fs_super_block, extension_list, extension_list);
+F2FS_SBI_RW_ATTR(gc_idle, gc_mode);
+F2FS_SBI_RW_ATTR(gc_urgent, gc_mode);
+F2FS_SBI_RW_ATTR(cp_interval, interval_time[CP_TIME]);
+F2FS_SBI_RW_ATTR(idle_interval, interval_time[REQ_TIME]);
+F2FS_SBI_RW_ATTR(discard_idle_interval, interval_time[DISCARD_TIME]);
+F2FS_SBI_RW_ATTR(gc_idle_interval, interval_time[GC_TIME]);
+F2FS_SBI_RW_ATTR(umount_discard_timeout, interval_time[UMOUNT_DISCARD_TIMEOUT]);
+F2FS_SBI_RW_ATTR(gc_pin_file_thresh, gc_pin_file_threshold);
+F2FS_SBI_RW_ATTR(gc_reclaimed_segments, gc_reclaimed_segs);
+F2FS_SBI_GENERAL_RW_ATTR(max_victim_search);
+F2FS_SBI_GENERAL_RW_ATTR(migration_granularity);
+F2FS_SBI_GENERAL_RW_ATTR(dir_level);
 #ifdef CONFIG_F2FS_IOSTAT
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, iostat_enable, iostat_enable);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, iostat_period_ms, iostat_period_ms);
+F2FS_SBI_GENERAL_RW_ATTR(iostat_enable);
+F2FS_SBI_GENERAL_RW_ATTR(iostat_period_ms);
 #endif
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, readdir_ra, readdir_ra);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, max_io_bytes, max_io_bytes);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_pin_file_thresh, gc_pin_file_threshold);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_super_block, extension_list, extension_list);
+F2FS_SBI_GENERAL_RW_ATTR(readdir_ra);
+F2FS_SBI_GENERAL_RW_ATTR(max_io_bytes);
+F2FS_SBI_GENERAL_RW_ATTR(data_io_flag);
+F2FS_SBI_GENERAL_RW_ATTR(node_io_flag);
+F2FS_SBI_GENERAL_RW_ATTR(gc_remaining_trials);
+F2FS_SBI_GENERAL_RW_ATTR(seq_file_ra_mul);
+F2FS_SBI_GENERAL_RW_ATTR(gc_segment_mode);
+F2FS_SBI_GENERAL_RW_ATTR(max_fragment_chunk);
+F2FS_SBI_GENERAL_RW_ATTR(max_fragment_hole);
+#ifdef CONFIG_F2FS_FS_COMPRESSION
+F2FS_SBI_GENERAL_RW_ATTR(compr_written_block);
+F2FS_SBI_GENERAL_RW_ATTR(compr_saved_block);
+F2FS_SBI_GENERAL_RW_ATTR(compr_new_inode);
+F2FS_SBI_GENERAL_RW_ATTR(compress_percent);
+F2FS_SBI_GENERAL_RW_ATTR(compress_watermark);
+#endif
+F2FS_SBI_GENERAL_RW_ATTR(peak_atomic_write);
+F2FS_SBI_GENERAL_RW_ATTR(committed_atomic_block);
+F2FS_SBI_GENERAL_RW_ATTR(revoked_atomic_block);
+F2FS_SBI_GENERAL_RW_ATTR(hot_data_age_threshold);
+F2FS_SBI_GENERAL_RW_ATTR(warm_data_age_threshold);
+F2FS_SBI_GENERAL_RW_ATTR(last_age_weight);
+F2FS_SBI_GENERAL_RO_ATTR(current_atomic_write);
+#ifdef CONFIG_BLK_DEV_ZONED
+F2FS_SBI_GENERAL_RO_ATTR(unusable_blocks_per_sec);
+#endif
+
+/* STAT_INFO ATTR */
+#ifdef CONFIG_F2FS_STAT_FS
+STAT_INFO_RO_ATTR(cp_foreground_calls, cp_count);
+STAT_INFO_RO_ATTR(cp_background_calls, bg_cp_count);
+STAT_INFO_RO_ATTR(gc_foreground_calls, call_count);
+STAT_INFO_RO_ATTR(gc_background_calls, bg_gc);
+#endif
+
+/* FAULT_INFO ATTR */
 #ifdef CONFIG_F2FS_FAULT_INJECTION
-F2FS_RW_ATTR(FAULT_INFO_RATE, f2fs_fault_info, inject_rate, inject_rate);
-F2FS_RW_ATTR(FAULT_INFO_TYPE, f2fs_fault_info, inject_type, inject_type);
+FAULT_INFO_RATE_GENERAL_RW_ATTR(inject_rate);
+FAULT_INFO_TYPE_GENERAL_RW_ATTR(inject_type);
 #endif
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, data_io_flag, data_io_flag);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, node_io_flag, node_io_flag);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_remaining_trials, gc_remaining_trials);
-F2FS_RW_ATTR(CPRC_INFO, ckpt_req_control, ckpt_thread_ioprio, ckpt_thread_ioprio);
+
+/* RESERVED_BLOCKS ATTR */
+RESERVED_BLOCKS_GENERAL_RW_ATTR(reserved_blocks);
+
+/* CPRC_INFO ATTR */
+CPRC_INFO_GENERAL_RW_ATTR(ckpt_thread_ioprio);
+
+/* ATGC_INFO ATTR */
+ATGC_INFO_RW_ATTR(atgc_candidate_ratio, candidate_ratio);
+ATGC_INFO_RW_ATTR(atgc_candidate_count, max_candidate_count);
+ATGC_INFO_RW_ATTR(atgc_age_weight, age_weight);
+ATGC_INFO_RW_ATTR(atgc_age_threshold, age_threshold);
+
 F2FS_GENERAL_RO_ATTR(dirty_segments);
 F2FS_GENERAL_RO_ATTR(free_segments);
 F2FS_GENERAL_RO_ATTR(ovp_segments);
@@ -917,10 +1006,6 @@  F2FS_GENERAL_RO_ATTR(main_blkaddr);
 F2FS_GENERAL_RO_ATTR(pending_discard);
 F2FS_GENERAL_RO_ATTR(gc_mode);
 #ifdef CONFIG_F2FS_STAT_FS
-F2FS_STAT_ATTR(STAT_INFO, f2fs_stat_info, cp_foreground_calls, cp_count);
-F2FS_STAT_ATTR(STAT_INFO, f2fs_stat_info, cp_background_calls, bg_cp_count);
-F2FS_STAT_ATTR(STAT_INFO, f2fs_stat_info, gc_foreground_calls, call_count);
-F2FS_STAT_ATTR(STAT_INFO, f2fs_stat_info, gc_background_calls, bg_gc);
 F2FS_GENERAL_RO_ATTR(moved_blocks_background);
 F2FS_GENERAL_RO_ATTR(moved_blocks_foreground);
 F2FS_GENERAL_RO_ATTR(avg_vblocks);
@@ -935,8 +1020,6 @@  F2FS_FEATURE_RO_ATTR(encrypted_casefold);
 #endif /* CONFIG_FS_ENCRYPTION */
 #ifdef CONFIG_BLK_DEV_ZONED
 F2FS_FEATURE_RO_ATTR(block_zoned);
-F2FS_RO_ATTR(F2FS_SBI, f2fs_sb_info, unusable_blocks_per_sec,
-					unusable_blocks_per_sec);
 #endif
 F2FS_FEATURE_RO_ATTR(atomic_write);
 F2FS_FEATURE_RO_ATTR(extra_attr);
@@ -956,37 +1039,9 @@  F2FS_FEATURE_RO_ATTR(casefold);
 F2FS_FEATURE_RO_ATTR(readonly);
 #ifdef CONFIG_F2FS_FS_COMPRESSION
 F2FS_FEATURE_RO_ATTR(compression);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compr_written_block, compr_written_block);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compr_saved_block, compr_saved_block);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compr_new_inode, compr_new_inode);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compress_percent, compress_percent);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compress_watermark, compress_watermark);
 #endif
 F2FS_FEATURE_RO_ATTR(pin_file);
 
-/* For ATGC */
-F2FS_RW_ATTR(ATGC_INFO, atgc_management, atgc_candidate_ratio, candidate_ratio);
-F2FS_RW_ATTR(ATGC_INFO, atgc_management, atgc_candidate_count, max_candidate_count);
-F2FS_RW_ATTR(ATGC_INFO, atgc_management, atgc_age_weight, age_weight);
-F2FS_RW_ATTR(ATGC_INFO, atgc_management, atgc_age_threshold, age_threshold);
-
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, seq_file_ra_mul, seq_file_ra_mul);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_segment_mode, gc_segment_mode);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_reclaimed_segments, gc_reclaimed_segs);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, max_fragment_chunk, max_fragment_chunk);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, max_fragment_hole, max_fragment_hole);
-
-/* For atomic write */
-F2FS_RO_ATTR(F2FS_SBI, f2fs_sb_info, current_atomic_write, current_atomic_write);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, peak_atomic_write, peak_atomic_write);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, committed_atomic_block, committed_atomic_block);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, revoked_atomic_block, revoked_atomic_block);
-
-/* For block age extent cache */
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, hot_data_age_threshold, hot_data_age_threshold);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, warm_data_age_threshold, warm_data_age_threshold);
-F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, last_age_weight, last_age_weight);
-
 #define ATTR_LIST(name) (&f2fs_attr_##name.attr)
 static struct attribute *f2fs_attrs[] = {
 	ATTR_LIST(gc_urgent_sleep_time),