Re: [PATCH] f2fs: Add ckpt_thread_task sysfs node
From: zhaoyuenan
Date: Fri May 22 2026 - 10:08:44 EST
Hi Chao,
On 5/22/26 10:50, Chao Yu wrote:
> Hi Yuenan,
>
> Thanks for your contribution!
>
> If there is a method to get pid via userspace, I prefer to do it in userspace,
> rather than implementing and maintaining an duplicated one in kernel.
>
> Or do you have a strong reason to do this in kernel?
The main reason is that retrieving this PID from userspace is currently
quite complex and fragile.
Previously, userspace tools had to rely on pipelines like:
pgrep f2fs_ckpt-$(ls -l /dev/block/by-name/userdata | awk '{print $5$6}' | tr ',' ':')
This approach has a few drawbacks:
1. It requires parsing major/minor numbers and executing multiple commands,
which is inefficient for simple monitoring tools.
2. On some older kernels, the thread name can be truncated due to TASK_COMM_LEN
limitations, causing 'pgrep' to fail to match the full 'f2fs_ckpt-X:Y' string.
Exposing the PID via a sysfs node provides a deterministic, lightweight,
and reliable way (just a simple 'cat') to fetch it without any userspace
guessing or complex parsing.
Does this address your concern?
Thanks,
Yuenan