public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] f2fs: sysfs: support atgc_enabled
@ 2024-02-21  7:32 liujinbao1
  2024-07-26  1:20 ` Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: liujinbao1 @ 2024-02-21  7:32 UTC (permalink / raw)
  To: chao, jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, liujinbao1

From: liujinbao1 <liujinbao1@xiaomi.com>

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.

Signed-off-by: liujinbao1 <liujinbao1@xiaomi.com>
---
 Documentation/ABI/testing/sysfs-fs-f2fs | 6 ++++++
 fs/f2fs/sysfs.c                         | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
index 36c3cb547901..8597dfaef700 100644
--- a/Documentation/ABI/testing/sysfs-fs-f2fs
+++ b/Documentation/ABI/testing/sysfs-fs-f2fs
@@ -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" <liujinbao1@xiaomi.com>
+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" <daehojeong@google.com>
diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index 417fae96890f..0915872abd97 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -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),
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] f2fs: sysfs: support atgc_enabled
  2024-02-21  7:32 [PATCH] f2fs: sysfs: support atgc_enabled liujinbao1
@ 2024-07-26  1:20 ` Chao Yu
  2024-07-27  3:25   ` Jaegeuk Kim
  0 siblings, 1 reply; 4+ messages in thread
From: Chao Yu @ 2024-07-26  1:20 UTC (permalink / raw)
  To: liujinbao1, jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, liujinbao1

On 2024/2/21 15:32, liujinbao1 wrote:
> From: liujinbao1 <liujinbao1@xiaomi.com>
> 
> 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,

> 
> Signed-off-by: liujinbao1 <liujinbao1@xiaomi.com>
> ---
>   Documentation/ABI/testing/sysfs-fs-f2fs | 6 ++++++
>   fs/f2fs/sysfs.c                         | 8 ++++++++
>   2 files changed, 14 insertions(+)
> 
> diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
> index 36c3cb547901..8597dfaef700 100644
> --- a/Documentation/ABI/testing/sysfs-fs-f2fs
> +++ b/Documentation/ABI/testing/sysfs-fs-f2fs
> @@ -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" <liujinbao1@xiaomi.com>
> +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" <daehojeong@google.com>
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index 417fae96890f..0915872abd97 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -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),

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] f2fs: sysfs: support atgc_enabled
  2024-07-26  1:20 ` Chao Yu
@ 2024-07-27  3:25   ` Jaegeuk Kim
  2024-07-29  2:55     ` Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: Jaegeuk Kim @ 2024-07-27  3:25 UTC (permalink / raw)
  To: Chao Yu; +Cc: liujinbao1, linux-f2fs-devel, linux-kernel, liujinbao1

On 07/26, Chao Yu wrote:
> On 2024/2/21 15:32, liujinbao1 wrote:
> > From: liujinbao1 <liujinbao1@xiaomi.com>
> > 
> > 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?

It looks like not stat.

> 
> Thanks,
> 
> > 
> > Signed-off-by: liujinbao1 <liujinbao1@xiaomi.com>
> > ---
> >   Documentation/ABI/testing/sysfs-fs-f2fs | 6 ++++++
> >   fs/f2fs/sysfs.c                         | 8 ++++++++
> >   2 files changed, 14 insertions(+)
> > 
> > diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
> > index 36c3cb547901..8597dfaef700 100644
> > --- a/Documentation/ABI/testing/sysfs-fs-f2fs
> > +++ b/Documentation/ABI/testing/sysfs-fs-f2fs
> > @@ -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" <liujinbao1@xiaomi.com>
> > +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" <daehojeong@google.com>
> > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> > index 417fae96890f..0915872abd97 100644
> > --- a/fs/f2fs/sysfs.c
> > +++ b/fs/f2fs/sysfs.c
> > @@ -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),

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] f2fs: sysfs: support atgc_enabled
  2024-07-27  3:25   ` Jaegeuk Kim
@ 2024-07-29  2:55     ` Chao Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2024-07-29  2:55 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: liujinbao1, linux-f2fs-devel, linux-kernel, liujinbao1

On 2024/7/27 11:25, Jaegeuk Kim wrote:
> On 07/26, Chao Yu wrote:
>> On 2024/2/21 15:32, liujinbao1 wrote:
>>> From: liujinbao1 <liujinbao1@xiaomi.com>
>>>
>>> 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?
> 
> It looks like not stat.

Okay,

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,

> 
>>
>> Thanks,
>>
>>>
>>> Signed-off-by: liujinbao1 <liujinbao1@xiaomi.com>
>>> ---
>>>    Documentation/ABI/testing/sysfs-fs-f2fs | 6 ++++++
>>>    fs/f2fs/sysfs.c                         | 8 ++++++++
>>>    2 files changed, 14 insertions(+)
>>>
>>> diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
>>> index 36c3cb547901..8597dfaef700 100644
>>> --- a/Documentation/ABI/testing/sysfs-fs-f2fs
>>> +++ b/Documentation/ABI/testing/sysfs-fs-f2fs
>>> @@ -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" <liujinbao1@xiaomi.com>
>>> +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" <daehojeong@google.com>
>>> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
>>> index 417fae96890f..0915872abd97 100644
>>> --- a/fs/f2fs/sysfs.c
>>> +++ b/fs/f2fs/sysfs.c
>>> @@ -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),

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-07-29  2:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-21  7:32 [PATCH] f2fs: sysfs: support atgc_enabled liujinbao1
2024-07-26  1:20 ` Chao Yu
2024-07-27  3:25   ` Jaegeuk Kim
2024-07-29  2:55     ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox