From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Zhiguo Niu <zhiguo.niu@unisoc.com>
Cc: ke.wang@unisoc.com, niuzhiguo84@gmail.com,
linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH V3] f2fs: show more discard status by sysfs
Date: Mon, 18 Dec 2023 09:45:03 -0800 [thread overview]
Message-ID: <ZYCFH4cyjjCVbpDF@google.com> (raw)
In-Reply-To: <1702897676-12851-1-git-send-email-zhiguo.niu@unisoc.com>
On 12/18, Zhiguo Niu wrote:
> The current pending_discard attr just only shows the discard_cmd_cnt
> information. More discard status can be shown so that we can check
> them through sysfs when needed.
>
> Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
> ---
> changes of v2: Improve the patch according to Chao's suggestions.
> changes of v3: Add a blank line for easy reading.
> ---
> ---
> Documentation/ABI/testing/sysfs-fs-f2fs | 6 ++++++
> fs/f2fs/sysfs.c | 19 +++++++++++++++++++
> 2 files changed, 25 insertions(+)
>
> diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
> index 36c3cb5..c6970e5 100644
> --- a/Documentation/ABI/testing/sysfs-fs-f2fs
> +++ b/Documentation/ABI/testing/sysfs-fs-f2fs
> @@ -498,6 +498,12 @@ Description: Show status of f2fs checkpoint in real time.
> CP_RESIZEFS_FLAG 0x00004000
> =============================== ==============================
>
> +What: /sys/fs/f2fs/<disk>/stat/discard_status
> +Date: November 2023
> +Contact: "Zhiguo Niu" <zhiguo.niu@unisoc.com>
> +Description: Show status of f2fs discard in real time, including
> + "issued discard","queued discard" and "undiscard blocks".
> +
> What: /sys/fs/f2fs/<disk>/ckpt_thread_ioprio
> Date: January 2021
> Contact: "Daeho Jeong" <daehojeong@google.com>
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index 417fae96..312a4dc 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -134,6 +134,22 @@ static ssize_t cp_status_show(struct f2fs_attr *a,
> return sysfs_emit(buf, "%x\n", le32_to_cpu(F2FS_CKPT(sbi)->ckpt_flags));
> }
>
> +static ssize_t discard_status_show(struct f2fs_attr *a,
> + struct f2fs_sb_info *sbi, char *buf)
> +{
> + struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info;
> +
> + if (!dcc)
> + return -EINVAL;
> +
> + return sysfs_emit(buf, "%llu, %llu, %u\n",
> + (unsigned long long)atomic_read(
> + &dcc->issued_discard),
> + (unsigned long long)atomic_read(
> + &dcc->queued_discard),
> + dcc->undiscard_blks);
We cannot do this since it needs one value per one entry.
> +}
> +
> static ssize_t pending_discard_show(struct f2fs_attr *a,
> struct f2fs_sb_info *sbi, char *buf)
> {
> @@ -1197,9 +1213,12 @@ static ssize_t f2fs_sb_feature_show(struct f2fs_attr *a,
>
> F2FS_GENERAL_RO_ATTR(sb_status);
> F2FS_GENERAL_RO_ATTR(cp_status);
> +F2FS_GENERAL_RO_ATTR(discard_status);
> +
> static struct attribute *f2fs_stat_attrs[] = {
> ATTR_LIST(sb_status),
> ATTR_LIST(cp_status),
> + ATTR_LIST(discard_status),
> NULL,
> };
> ATTRIBUTE_GROUPS(f2fs_stat);
> --
> 1.9.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2023-12-18 17:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-18 11:07 [f2fs-dev] [PATCH V3] f2fs: show more discard status by sysfs Zhiguo Niu
2023-12-18 12:21 ` Chao Yu
2023-12-18 17:45 ` Jaegeuk Kim [this message]
2023-12-18 23:59 ` Zhiguo Niu
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=ZYCFH4cyjjCVbpDF@google.com \
--to=jaegeuk@kernel.org \
--cc=ke.wang@unisoc.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=niuzhiguo84@gmail.com \
--cc=zhiguo.niu@unisoc.com \
/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;
as well as URLs for NNTP newsgroup(s).