f2fs: sysfs: support atgc_enabled
PATCH 1/1 f2fs: sysfs: support atgc_enabled
From: liujinbao1 <[email protected]>
When we add "atgc" to the fstab table, ATGC is not immediately enabled. There is a 7-day time threshold, and we can use "atgc_enabled" to show whether ATGC is enabled.
--- Documentation/ABI/testing/sysfs-fs-f2fs | 6 ++++++ fs/f2fs/sysfs.c | 8 ++++++++ 2 files changed, 14 insertions(+)
Documentation/ABI/testing/sysfs-fs-f2fs +6 -0
@@ -564,6 +564,12 @@ Description: When ATGC is on, it controls age threshold to bypass GCing young candidates whose age is not beyond the threshold, by default it was initialized as 604800 seconds (equals to 7 days). +What: /sys/fs/f2fs/<disk>/atgc_enabled +Date: Feb 2024 +Contact: "Jinbao Liu" <[email protected]> +Description: It represents whether ATGC is on or off. The value is 1 which + indicates that ATGC is on, and 0 indicates that it is off. + What: /sys/fs/f2fs/<disk>/gc_reclaimed_segments Date: July 2021 Contact: "Daeho Jeong" <[email protected]>
fs/f2fs/sysfs.c +8 -0
@@ -143,6 +143,12 @@ static ssize_t pending_discard_show(struct f2fs_attr *a, &SM_I(sbi)->dcc_info->discard_cmd_cnt)); } +static ssize_t atgc_enabled_show (struct f2fs_attr *a, +struct f2fs_sb_info *sbi,char *buf) +{ +return sysfs_emit (buf,"%d\n" , sbi->am.atgc_enabled ?1 :0 ); +} +static ssize_t gc_mode_show (struct f2fs_attr *a,struct f2fs_sb_info *sbi,char *buf) {
@@ -1017,6 +1023,7 @@ F2FS_GENERAL_RO_ATTR(encoding);F2FS_GENERAL_RO_ATTR (mounted_time_sec);F2FS_GENERAL_RO_ATTR (main_blkaddr);F2FS_GENERAL_RO_ATTR (pending_discard); +F2FS_GENERAL_RO_ATTR (atgc_enabled);F2FS_GENERAL_RO_ATTR (gc_mode);#ifdef CONFIG_F2FS_STAT_FS F2FS_GENERAL_RO_ATTR (moved_blocks_background);
@@ -1144,6 +1151,7 @@ static struct attribute *f2fs_attrs[] = {ATTR_LIST (atgc_candidate_count),ATTR_LIST (atgc_age_weight),ATTR_LIST (atgc_age_threshold), +ATTR_LIST (atgc_enabled),ATTR_LIST (seq_file_ra_mul),ATTR_LIST (gc_segment_mode), ATTR_LIST(gc_reclaimed_segments),
Signature · 1 line
2.25.1
Chao Yu
maintainerQuoted 5 lines · On 2024/2/21 15:32, liujinbao1 wrote:
From: liujinbao1 <[email protected]>
When we add "atgc" to the fstab table, ATGC is not immediately enabled. There is a 7-day time threshold, and we can use "
atgc_enabled" to show whether ATGC is enabled.
Oh, I missed to reply on this patch, what about adding this readonly atgc_enabled sysfs entry into /sys/fs/f2fs/<dev>/stat/ directory?
Thanks,
Quoted 57 lines
Signed-off-by liujinbao1 <[email protected]>--- Documentation/ABI/testing/sysfs-fs-f2fs | 6 ++++++ fs/f2fs/sysfs.c | 8 ++++++++ 2 files changed, 14 insertions(+)Documentation/ABI/testing/sysfs-fs-f2fs +6
-0@@ -564,6 +564,12 @@ Description: When ATGC is on, it controls age threshold to bypass GCing young candidates whose age is not beyond the threshold, by default it was initialized as 604800 seconds (equals to 7 days). +What: /sys/fs/f2fs/<disk>/atgc_enabled +Date: Feb 2024 +Contact: "Jinbao Liu" <[email protected]> +Description: It represents whether ATGC is on or off. The value is 1 which + indicates that ATGC is on, and 0 indicates that it is off. + What: /sys/fs/f2fs/<disk>/gc_reclaimed_segments Date: July 2021 Contact: "Daeho Jeong" <[email protected]>fs/f2fs/sysfs.c +8
-0@@ -143,6 +143,12 @@ static ssize_t pending_discard_show(struct f2fs_attr *a, &SM_I(sbi)->dcc_info->discard_cmd_cnt)); } +static ssize_t atgc_enabled_show (struct f2fs_attr *a, +struct f2fs_sb_info *sbi,char *buf) +{ +return sysfs_emit (buf,"%d\n" , sbi->am.atgc_enabled ?1 :0 ); +} +static ssize_t gc_mode_show (struct f2fs_attr *a,struct f2fs_sb_info *sbi,char *buf) {@@ -1017,6 +1023,7 @@ F2FS_GENERAL_RO_ATTR(encoding);F2FS_GENERAL_RO_ATTR (mounted_time_sec);F2FS_GENERAL_RO_ATTR (main_blkaddr);F2FS_GENERAL_RO_ATTR (pending_discard); +F2FS_GENERAL_RO_ATTR (atgc_enabled);F2FS_GENERAL_RO_ATTR (gc_mode);#ifdef CONFIG_F2FS_STAT_FS F2FS_GENERAL_RO_ATTR (moved_blocks_background);@@ -1144,6 +1151,7 @@ static struct attribute *f2fs_attrs[] = {ATTR_LIST (atgc_candidate_count),ATTR_LIST (atgc_age_weight),ATTR_LIST (atgc_age_threshold), +ATTR_LIST (atgc_enabled),ATTR_LIST (seq_file_ra_mul),ATTR_LIST (gc_segment_mode), ATTR_LIST(gc_reclaimed_segments),
Jaegeuk Kim
maintainerQuoted 9 lines · Chao Yu
Quoted 5 lines · On 2024/2/21 15:32, liujinbao1 wrote:
From: liujinbao1 <[email protected]>
When we add "atgc" to the fstab table, ATGC is not immediately enabled. There is a 7-day time threshold, and we can use "
atgc_enabled" to show whether ATGC is enabled.Oh, I missed to reply on this patch, what about adding this readonly
atgc_enabledsysfs entry into /sys/fs/f2fs/<dev>/stat/ directory?
It looks like not stat.
Quoted 58 lines
Thanks,
Quoted 55 lines
Signed-off-by liujinbao1 <[email protected]>--- Documentation/ABI/testing/sysfs-fs-f2fs | 6 ++++++ fs/f2fs/sysfs.c | 8 ++++++++ 2 files changed, 14 insertions(+)Documentation/ABI/testing/sysfs-fs-f2fs +6
-0@@ -564,6 +564,12 @@ Description: When ATGC is on, it controls age threshold to bypass GCing young candidates whose age is not beyond the threshold, by default it was initialized as 604800 seconds (equals to 7 days). +What: /sys/fs/f2fs/<disk>/atgc_enabled +Date: Feb 2024 +Contact: "Jinbao Liu" <[email protected]> +Description: It represents whether ATGC is on or off. The value is 1 which + indicates that ATGC is on, and 0 indicates that it is off. + What: /sys/fs/f2fs/<disk>/gc_reclaimed_segments Date: July 2021 Contact: "Daeho Jeong" <[email protected]>fs/f2fs/sysfs.c +8
-0@@ -143,6 +143,12 @@ static ssize_t pending_discard_show(struct f2fs_attr *a, &SM_I(sbi)->dcc_info->discard_cmd_cnt)); } +static ssize_t atgc_enabled_show (struct f2fs_attr *a, +struct f2fs_sb_info *sbi,char *buf) +{ +return sysfs_emit (buf,"%d\n" , sbi->am.atgc_enabled ?1 :0 ); +} +static ssize_t gc_mode_show (struct f2fs_attr *a,struct f2fs_sb_info *sbi,char *buf) {@@ -1017,6 +1023,7 @@ F2FS_GENERAL_RO_ATTR(encoding);F2FS_GENERAL_RO_ATTR (mounted_time_sec);F2FS_GENERAL_RO_ATTR (main_blkaddr);F2FS_GENERAL_RO_ATTR (pending_discard); +F2FS_GENERAL_RO_ATTR (atgc_enabled);F2FS_GENERAL_RO_ATTR (gc_mode);#ifdef CONFIG_F2FS_STAT_FS F2FS_GENERAL_RO_ATTR (moved_blocks_background);@@ -1144,6 +1151,7 @@ static struct attribute *f2fs_attrs[] = {ATTR_LIST (atgc_candidate_count),ATTR_LIST (atgc_age_weight),ATTR_LIST (atgc_age_threshold), +ATTR_LIST (atgc_enabled),ATTR_LIST (seq_file_ra_mul),ATTR_LIST (gc_segment_mode), ATTR_LIST(gc_reclaimed_segments),
Quoted 4 lines · Jaegeuk Kim
Quoted 3 lines · Chao Yu
Quoted 2 lines · On 2024/2/21 15:32, liujinbao1 wrote:
From: liujinbao1 <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
When we add "atgc" to the fstab table, ATGC is not immediately enabled. There is a 7-day time threshold, and we can use "
atgc_enabled" to show whether ATGC is enabled.Oh, I missed to reply on this patch, what about adding this readonly
atgc_enabledsysfs entry into /sys/fs/f2fs/<dev>/stat/ directory?It looks like not stat.
Okay,
Thanks,
Quoted 59 lines
Quoted 59 lines
Thanks,
Quoted 55 lines
Signed-off-by liujinbao1 <[email protected]>--- Documentation/ABI/testing/sysfs-fs-f2fs | 6 ++++++ fs/f2fs/sysfs.c | 8 ++++++++ 2 files changed, 14 insertions(+)Documentation/ABI/testing/sysfs-fs-f2fs +6
-0@@ -564,6 +564,12 @@ Description: When ATGC is on, it controls age threshold to bypass GCing young candidates whose age is not beyond the threshold, by default it was initialized as 604800 seconds (equals to 7 days). +What: /sys/fs/f2fs/<disk>/atgc_enabled +Date: Feb 2024 +Contact: "Jinbao Liu" <[email protected]> +Description: It represents whether ATGC is on or off. The value is 1 which + indicates that ATGC is on, and 0 indicates that it is off. + What: /sys/fs/f2fs/<disk>/gc_reclaimed_segments Date: July 2021 Contact: "Daeho Jeong" <[email protected]>fs/f2fs/sysfs.c +8
-0@@ -143,6 +143,12 @@ static ssize_t pending_discard_show(struct f2fs_attr *a, &SM_I(sbi)->dcc_info->discard_cmd_cnt)); } +static ssize_t atgc_enabled_show (struct f2fs_attr *a, +struct f2fs_sb_info *sbi,char *buf) +{ +return sysfs_emit (buf,"%d\n" , sbi->am.atgc_enabled ?1 :0 ); +} +static ssize_t gc_mode_show (struct f2fs_attr *a,struct f2fs_sb_info *sbi,char *buf) {@@ -1017,6 +1023,7 @@ F2FS_GENERAL_RO_ATTR(encoding);F2FS_GENERAL_RO_ATTR (mounted_time_sec);F2FS_GENERAL_RO_ATTR (main_blkaddr);F2FS_GENERAL_RO_ATTR (pending_discard); +F2FS_GENERAL_RO_ATTR (atgc_enabled);F2FS_GENERAL_RO_ATTR (gc_mode);#ifdef CONFIG_F2FS_STAT_FS F2FS_GENERAL_RO_ATTR (moved_blocks_background);@@ -1144,6 +1151,7 @@ static struct attribute *f2fs_attrs[] = {ATTR_LIST (atgc_candidate_count),ATTR_LIST (atgc_age_weight),ATTR_LIST (atgc_age_threshold), +ATTR_LIST (atgc_enabled),ATTR_LIST (seq_file_ra_mul),ATTR_LIST (gc_segment_mode), ATTR_LIST(gc_reclaimed_segments),