summaryrefslogtreecommitdiff
path: root/fs/f2fs/sysfs.c
diff options
context:
space:
mode:
authorYangtao Li <frank.li@vivo.com>2023-03-31 19:33:05 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2023-04-10 10:58:45 -0700
commit084e15ea14bbb1ad40163438cfa74a76a1521c16 (patch)
treea8281eb0fec9e0d36c6eb962466a539a31e8e83d /fs/f2fs/sysfs.c
parentc2c14ca5b1f3591ebf7f75e374ddd65c574c9d42 (diff)
f2fs: convert to use sysfs_emit
Let's use sysfs_emit. Signed-off-by: Yangtao Li <frank.li@vivo.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/sysfs.c')
-rw-r--r--fs/f2fs/sysfs.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index fefc6b728590..aa77dd7c4555 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -312,19 +312,14 @@ static ssize_t f2fs_sbi_show(struct f2fs_attr *a,
if (!strcmp(a->attr.name, "ckpt_thread_ioprio")) {
struct ckpt_req_control *cprc = &sbi->cprc_info;
- int len = 0;
int class = IOPRIO_PRIO_CLASS(cprc->ckpt_thread_ioprio);
int data = IOPRIO_PRIO_DATA(cprc->ckpt_thread_ioprio);
- if (class == IOPRIO_CLASS_RT)
- len += scnprintf(buf + len, PAGE_SIZE - len, "rt,");
- else if (class == IOPRIO_CLASS_BE)
- len += scnprintf(buf + len, PAGE_SIZE - len, "be,");
- else
+ if (class != IOPRIO_CLASS_RT && class != IOPRIO_CLASS_BE)
return -EINVAL;
- len += scnprintf(buf + len, PAGE_SIZE - len, "%d\n", data);
- return len;
+ return sysfs_emit(buf, "%s,%d\n",
+ class == IOPRIO_CLASS_RT ? "rt" : "be", data);
}
#ifdef CONFIG_F2FS_FS_COMPRESSION