From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Yangtao Li <frank.li@vivo.com>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 2/2] f2fs: introduce gc_mode sysfs node
Date: Fri, 28 Oct 2022 09:59:11 -0700 [thread overview]
Message-ID: <Y1wKXwLqse/kB6A9@google.com> (raw)
In-Reply-To: <20221025033217.14840-2-frank.li@vivo.com>
Hi,
I merged two patches and modified a bit. Please take a look.
https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/commit/?h=dev&id=28ea9479410bab555db26e8437ea61b180e768d6
On 10/25, Yangtao Li wrote:
> gc_mode sysfs node can show the current gc_mode as a string.
> Introducing it increases readability.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> Documentation/ABI/testing/sysfs-fs-f2fs | 6 ++++++
> fs/f2fs/f2fs.h | 1 +
> fs/f2fs/sysfs.c | 18 ++++++++++++++++++
> 3 files changed, 25 insertions(+)
>
> diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
> index 483639fb727b..6466f3b1f0a9 100644
> --- a/Documentation/ABI/testing/sysfs-fs-f2fs
> +++ b/Documentation/ABI/testing/sysfs-fs-f2fs
> @@ -634,3 +634,9 @@ Date: July 2022
> 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.
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index e6355a5683b7..80f23e44a442 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -1318,6 +1318,7 @@ enum {
> MAX_TIME,
> };
>
> +/* Note that you need to keep synchronization with this gc_mode_names array */
> enum {
> GC_NORMAL,
> GC_IDLE_CB,
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index 49898a7243ba..058857d8b3b9 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -41,6 +41,16 @@ 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 *, struct f2fs_sb_info *, char *);
> @@ -133,6 +143,12 @@ 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 sprintf(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)
> {
> @@ -823,6 +839,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(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);
> @@ -904,6 +921,7 @@ static struct attribute *f2fs_attrs[] = {
> ATTR_LIST(max_discard_issue_time),
> ATTR_LIST(discard_granularity),
> ATTR_LIST(pending_discard),
> + ATTR_LIST(gc_mode),
> ATTR_LIST(batched_trim_sections),
> ATTR_LIST(ipu_policy),
> ATTR_LIST(min_ipu_util),
> --
> 2.25.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
WARNING: multiple messages have this Message-ID (diff)
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Yangtao Li <frank.li@vivo.com>
Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] f2fs: introduce gc_mode sysfs node
Date: Fri, 28 Oct 2022 09:59:11 -0700 [thread overview]
Message-ID: <Y1wKXwLqse/kB6A9@google.com> (raw)
In-Reply-To: <20221025033217.14840-2-frank.li@vivo.com>
Hi,
I merged two patches and modified a bit. Please take a look.
https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/commit/?h=dev&id=28ea9479410bab555db26e8437ea61b180e768d6
On 10/25, Yangtao Li wrote:
> gc_mode sysfs node can show the current gc_mode as a string.
> Introducing it increases readability.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> Documentation/ABI/testing/sysfs-fs-f2fs | 6 ++++++
> fs/f2fs/f2fs.h | 1 +
> fs/f2fs/sysfs.c | 18 ++++++++++++++++++
> 3 files changed, 25 insertions(+)
>
> diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
> index 483639fb727b..6466f3b1f0a9 100644
> --- a/Documentation/ABI/testing/sysfs-fs-f2fs
> +++ b/Documentation/ABI/testing/sysfs-fs-f2fs
> @@ -634,3 +634,9 @@ Date: July 2022
> 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.
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index e6355a5683b7..80f23e44a442 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -1318,6 +1318,7 @@ enum {
> MAX_TIME,
> };
>
> +/* Note that you need to keep synchronization with this gc_mode_names array */
> enum {
> GC_NORMAL,
> GC_IDLE_CB,
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index 49898a7243ba..058857d8b3b9 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -41,6 +41,16 @@ 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 *, struct f2fs_sb_info *, char *);
> @@ -133,6 +143,12 @@ 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 sprintf(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)
> {
> @@ -823,6 +839,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(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);
> @@ -904,6 +921,7 @@ static struct attribute *f2fs_attrs[] = {
> ATTR_LIST(max_discard_issue_time),
> ATTR_LIST(discard_granularity),
> ATTR_LIST(pending_discard),
> + ATTR_LIST(gc_mode),
> ATTR_LIST(batched_trim_sections),
> ATTR_LIST(ipu_policy),
> ATTR_LIST(min_ipu_util),
> --
> 2.25.1
next prev parent reply other threads:[~2022-10-28 16:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-25 3:32 [f2fs-dev] [PATCH 1/2] f2fs: Revert "f2fs: make gc_urgent and gc_segment_mode sysfs node readable" Yangtao Li via Linux-f2fs-devel
2022-10-25 3:32 ` Yangtao Li
2022-10-25 3:32 ` [f2fs-dev] [PATCH 2/2] f2fs: introduce gc_mode sysfs node Yangtao Li via Linux-f2fs-devel
2022-10-25 3:32 ` Yangtao Li
2022-10-28 16:59 ` Jaegeuk Kim [this message]
2022-10-28 16:59 ` Jaegeuk Kim
2022-10-29 4:31 ` [f2fs-dev] " Chao Yu
2022-10-29 4:31 ` Chao Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y1wKXwLqse/kB6A9@google.com \
--to=jaegeuk@kernel.org \
--cc=frank.li@vivo.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.