Message ID | 20230412165055.38461-1-frank.li@vivo.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [f2fs-dev] f2fs: export gc_mode in debugfs | expand |
On 2023/4/13 0:50, Yangtao Li wrote: > This patch exports gc_mode to debugfs. Since gc_urgent and gc_idle > nodes can get gc mode, so remove gc_mode node. What if some app/script is using gc_mode....it breaks its use. Thanks, > > Signed-off-by: Yangtao Li <frank.li@vivo.com> > --- > Documentation/ABI/testing/sysfs-fs-f2fs | 6 ------ > fs/f2fs/debug.c | 13 ++++++++++++- > fs/f2fs/sysfs.c | 18 ------------------ > 3 files changed, 12 insertions(+), 25 deletions(-) > > diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs > index 8140fc98f5ae..3b78b8324263 100644 > --- a/Documentation/ABI/testing/sysfs-fs-f2fs > +++ b/Documentation/ABI/testing/sysfs-fs-f2fs > @@ -643,12 +643,6 @@ Contact: "Daeho Jeong" <daehojeong@google.com> > Description: Show the accumulated total revoked atomic write block count after boot. > If you write "0" here, you can initialize to "0". > > -What: /sys/fs/f2fs/<disk>/gc_mode > -Date: October 2022 > -Contact: "Yangtao Li" <frank.li@vivo.com> > -Description: Show the current gc_mode as a string. > - This is a read-only entry. > - > What: /sys/fs/f2fs/<disk>/discard_urgent_util > Date: November 2022 > Contact: "Yangtao Li" <frank.li@vivo.com> > diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c > index 61c35b59126e..5172b2417c08 100644 > --- a/fs/f2fs/debug.c > +++ b/fs/f2fs/debug.c > @@ -366,6 +366,16 @@ static const char *ipu_mode_names[F2FS_IPU_MAX] = { > [F2FS_IPU_HONOR_OPU_WRITE] = "HONOR_OPU_WRITE", > }; > > +static const char *gc_mode_names[MAX_GC_MODE] = { > + [GC_NORMAL] = "GC_NORMAL", > + [GC_IDLE_CB] = "GC_IDLE_CB", > + [GC_IDLE_GREEDY] = "GC_IDLE_GREEDY", > + [GC_IDLE_AT] = "GC_IDLE_AT", > + [GC_URGENT_HIGH] = "GC_URGENT_HIGH", > + [GC_URGENT_LOW] = "GC_URGENT_LOW", > + [GC_URGENT_MID] = "GC_URGENT_MID", > +}; > + > static int stat_show(struct seq_file *s, void *v) > { > struct f2fs_stat_info *si; > @@ -409,7 +419,8 @@ static int stat_show(struct seq_file *s, void *v) > for_each_set_bit(j, &policy, F2FS_IPU_MAX) > seq_printf(s, " %s", ipu_mode_names[j]); > } > - seq_puts(s, " ]\n\n"); > + seq_puts(s, " ]\n"); > + seq_printf(s, " - GC: [ %s ]\n\n", gc_mode_names[sbi->gc_mode]); > > if (test_opt(sbi, DISCARD)) > seq_printf(s, "Utilization: %u%% (%u valid blocks, %u discard blocks)\n", > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c > index 4d6263e556fa..c2873a94f7b2 100644 > --- a/fs/f2fs/sysfs.c > +++ b/fs/f2fs/sysfs.c > @@ -41,16 +41,6 @@ enum { > ATGC_INFO, /* struct atgc_management */ > }; > > -static const char *gc_mode_names[MAX_GC_MODE] = { > - "GC_NORMAL", > - "GC_IDLE_CB", > - "GC_IDLE_GREEDY", > - "GC_IDLE_AT", > - "GC_URGENT_HIGH", > - "GC_URGENT_LOW", > - "GC_URGENT_MID" > -}; > - > struct f2fs_attr { > struct attribute attr; > ssize_t (*show)(struct f2fs_attr *a, struct f2fs_sb_info *sbi, char *buf); > @@ -143,12 +133,6 @@ static ssize_t pending_discard_show(struct f2fs_attr *a, > &SM_I(sbi)->dcc_info->discard_cmd_cnt)); > } > > -static ssize_t gc_mode_show(struct f2fs_attr *a, > - struct f2fs_sb_info *sbi, char *buf) > -{ > - return sysfs_emit(buf, "%s\n", gc_mode_names[sbi->gc_mode]); > -} > - > static ssize_t features_show(struct f2fs_attr *a, > struct f2fs_sb_info *sbi, char *buf) > { > @@ -916,7 +900,6 @@ 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(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); > @@ -1008,7 +991,6 @@ static struct attribute *f2fs_attrs[] = { > ATTR_LIST(discard_granularity), > ATTR_LIST(max_ordered_discard), > ATTR_LIST(pending_discard), > - ATTR_LIST(gc_mode), > ATTR_LIST(ipu_policy), > ATTR_LIST(min_ipu_util), > ATTR_LIST(min_fsync_blocks),
> What if some app/script is using gc_mode....it breaks its use.
Similar words, you said before.
https://lore.kernel.org/lkml/cd6d15e3-b692-d3c1-0f01-33e632f5f94c@kernel.org/
The instructions for these nodes are in the Documentation/ABI/testing/ directory,
not the Documentation/ABI/stable directory.
So, we can still remove unnecessary nodes, right?
Thx,
Yangtao
diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs index 8140fc98f5ae..3b78b8324263 100644 --- a/Documentation/ABI/testing/sysfs-fs-f2fs +++ b/Documentation/ABI/testing/sysfs-fs-f2fs @@ -643,12 +643,6 @@ Contact: "Daeho Jeong" <daehojeong@google.com> Description: Show the accumulated total revoked atomic write block count after boot. If you write "0" here, you can initialize to "0". -What: /sys/fs/f2fs/<disk>/gc_mode -Date: October 2022 -Contact: "Yangtao Li" <frank.li@vivo.com> -Description: Show the current gc_mode as a string. - This is a read-only entry. - What: /sys/fs/f2fs/<disk>/discard_urgent_util Date: November 2022 Contact: "Yangtao Li" <frank.li@vivo.com> diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c index 61c35b59126e..5172b2417c08 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c @@ -366,6 +366,16 @@ static const char *ipu_mode_names[F2FS_IPU_MAX] = { [F2FS_IPU_HONOR_OPU_WRITE] = "HONOR_OPU_WRITE", }; +static const char *gc_mode_names[MAX_GC_MODE] = { + [GC_NORMAL] = "GC_NORMAL", + [GC_IDLE_CB] = "GC_IDLE_CB", + [GC_IDLE_GREEDY] = "GC_IDLE_GREEDY", + [GC_IDLE_AT] = "GC_IDLE_AT", + [GC_URGENT_HIGH] = "GC_URGENT_HIGH", + [GC_URGENT_LOW] = "GC_URGENT_LOW", + [GC_URGENT_MID] = "GC_URGENT_MID", +}; + static int stat_show(struct seq_file *s, void *v) { struct f2fs_stat_info *si; @@ -409,7 +419,8 @@ static int stat_show(struct seq_file *s, void *v) for_each_set_bit(j, &policy, F2FS_IPU_MAX) seq_printf(s, " %s", ipu_mode_names[j]); } - seq_puts(s, " ]\n\n"); + seq_puts(s, " ]\n"); + seq_printf(s, " - GC: [ %s ]\n\n", gc_mode_names[sbi->gc_mode]); if (test_opt(sbi, DISCARD)) seq_printf(s, "Utilization: %u%% (%u valid blocks, %u discard blocks)\n", diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index 4d6263e556fa..c2873a94f7b2 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -41,16 +41,6 @@ enum { ATGC_INFO, /* struct atgc_management */ }; -static const char *gc_mode_names[MAX_GC_MODE] = { - "GC_NORMAL", - "GC_IDLE_CB", - "GC_IDLE_GREEDY", - "GC_IDLE_AT", - "GC_URGENT_HIGH", - "GC_URGENT_LOW", - "GC_URGENT_MID" -}; - struct f2fs_attr { struct attribute attr; ssize_t (*show)(struct f2fs_attr *a, struct f2fs_sb_info *sbi, char *buf); @@ -143,12 +133,6 @@ static ssize_t pending_discard_show(struct f2fs_attr *a, &SM_I(sbi)->dcc_info->discard_cmd_cnt)); } -static ssize_t gc_mode_show(struct f2fs_attr *a, - struct f2fs_sb_info *sbi, char *buf) -{ - return sysfs_emit(buf, "%s\n", gc_mode_names[sbi->gc_mode]); -} - static ssize_t features_show(struct f2fs_attr *a, struct f2fs_sb_info *sbi, char *buf) { @@ -916,7 +900,6 @@ 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(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); @@ -1008,7 +991,6 @@ static struct attribute *f2fs_attrs[] = { ATTR_LIST(discard_granularity), ATTR_LIST(max_ordered_discard), ATTR_LIST(pending_discard), - ATTR_LIST(gc_mode), ATTR_LIST(ipu_policy), ATTR_LIST(min_ipu_util), ATTR_LIST(min_fsync_blocks),
This patch exports gc_mode to debugfs. Since gc_urgent and gc_idle nodes can get gc mode, so remove gc_mode node. Signed-off-by: Yangtao Li <frank.li@vivo.com> --- Documentation/ABI/testing/sysfs-fs-f2fs | 6 ------ fs/f2fs/debug.c | 13 ++++++++++++- fs/f2fs/sysfs.c | 18 ------------------ 3 files changed, 12 insertions(+), 25 deletions(-)