From: Yangtao Li <frank.li@vivo.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <chao@kernel.org>
Cc: Yangtao Li <frank.li@vivo.com>,
linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: [PATCH] f2fs: export gc_mode in debugfs
Date: Thu, 13 Apr 2023 00:50:54 +0800 [thread overview]
Message-ID: <20230412165055.38461-1-frank.li@vivo.com> (raw)
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(-)
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),
--
2.35.1
next reply other threads:[~2023-04-12 16:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-12 16:50 Yangtao Li [this message]
2023-04-13 15:34 ` Chao Yu
2023-04-13 16:14 ` Yangtao Li
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=20230412165055.38461-1-frank.li@vivo.com \
--to=frank.li@vivo.com \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®