Skip to content

Commit 084e15e

Browse files
bbkzzJaegeuk Kim
authored andcommitted
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>
1 parent c2c14ca commit 084e15e

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

fs/f2fs/sysfs.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -312,19 +312,14 @@ static ssize_t f2fs_sbi_show(struct f2fs_attr *a,
312312

313313
if (!strcmp(a->attr.name, "ckpt_thread_ioprio")) {
314314
struct ckpt_req_control *cprc = &sbi->cprc_info;
315-
int len = 0;
316315
int class = IOPRIO_PRIO_CLASS(cprc->ckpt_thread_ioprio);
317316
int data = IOPRIO_PRIO_DATA(cprc->ckpt_thread_ioprio);
318317

319-
if (class == IOPRIO_CLASS_RT)
320-
len += scnprintf(buf + len, PAGE_SIZE - len, "rt,");
321-
else if (class == IOPRIO_CLASS_BE)
322-
len += scnprintf(buf + len, PAGE_SIZE - len, "be,");
323-
else
318+
if (class != IOPRIO_CLASS_RT && class != IOPRIO_CLASS_BE)
324319
return -EINVAL;
325320

326-
len += scnprintf(buf + len, PAGE_SIZE - len, "%d\n", data);
327-
return len;
321+
return sysfs_emit(buf, "%s,%d\n",
322+
class == IOPRIO_CLASS_RT ? "rt" : "be", data);
328323
}
329324

330325
#ifdef CONFIG_F2FS_FS_COMPRESSION

0 commit comments

Comments
 (0)