Commit 270b0931 authored by Zhiguo Niu's avatar Zhiguo Niu Committed by Jaegeuk Kim

f2fs: use new ioprio Macro to get ckpt thread ioprio level

IOPRIO_PRIO_DATA in the new kernel version includes level and hint,
So Macro IOPRIO_PRIO_LEVEL is more accurate to get ckpt thread
ioprio data/level, and it is also consisten with the way setting
ckpt thread ioprio by IOPRIO_PRIO_VALUE(class, data/level).

Besides, change variable name from "data" to "level" for more readable.
Signed-off-by: default avatarZhiguo Niu <zhiguo.niu@unisoc.com>
Reviewed-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 192b8fb8
...@@ -340,13 +340,13 @@ static ssize_t f2fs_sbi_show(struct f2fs_attr *a, ...@@ -340,13 +340,13 @@ static ssize_t f2fs_sbi_show(struct f2fs_attr *a,
if (!strcmp(a->attr.name, "ckpt_thread_ioprio")) { if (!strcmp(a->attr.name, "ckpt_thread_ioprio")) {
struct ckpt_req_control *cprc = &sbi->cprc_info; struct ckpt_req_control *cprc = &sbi->cprc_info;
int class = IOPRIO_PRIO_CLASS(cprc->ckpt_thread_ioprio); int class = IOPRIO_PRIO_CLASS(cprc->ckpt_thread_ioprio);
int data = IOPRIO_PRIO_DATA(cprc->ckpt_thread_ioprio); int level = IOPRIO_PRIO_LEVEL(cprc->ckpt_thread_ioprio);
if (class != IOPRIO_CLASS_RT && class != IOPRIO_CLASS_BE) if (class != IOPRIO_CLASS_RT && class != IOPRIO_CLASS_BE)
return -EINVAL; return -EINVAL;
return sysfs_emit(buf, "%s,%d\n", return sysfs_emit(buf, "%s,%d\n",
class == IOPRIO_CLASS_RT ? "rt" : "be", data); class == IOPRIO_CLASS_RT ? "rt" : "be", level);
} }
#ifdef CONFIG_F2FS_FS_COMPRESSION #ifdef CONFIG_F2FS_FS_COMPRESSION
...@@ -450,7 +450,7 @@ static ssize_t __sbi_store(struct f2fs_attr *a, ...@@ -450,7 +450,7 @@ static ssize_t __sbi_store(struct f2fs_attr *a,
const char *name = strim((char *)buf); const char *name = strim((char *)buf);
struct ckpt_req_control *cprc = &sbi->cprc_info; struct ckpt_req_control *cprc = &sbi->cprc_info;
int class; int class;
long data; long level;
int ret; int ret;
if (!strncmp(name, "rt,", 3)) if (!strncmp(name, "rt,", 3))
...@@ -461,13 +461,13 @@ static ssize_t __sbi_store(struct f2fs_attr *a, ...@@ -461,13 +461,13 @@ static ssize_t __sbi_store(struct f2fs_attr *a,
return -EINVAL; return -EINVAL;
name += 3; name += 3;
ret = kstrtol(name, 10, &data); ret = kstrtol(name, 10, &level);
if (ret) if (ret)
return ret; return ret;
if (data >= IOPRIO_NR_LEVELS || data < 0) if (level >= IOPRIO_NR_LEVELS || level < 0)
return -EINVAL; return -EINVAL;
cprc->ckpt_thread_ioprio = IOPRIO_PRIO_VALUE(class, data); cprc->ckpt_thread_ioprio = IOPRIO_PRIO_VALUE(class, level);
if (test_opt(sbi, MERGE_CHECKPOINT)) { if (test_opt(sbi, MERGE_CHECKPOINT)) {
ret = set_task_ioprio(cprc->f2fs_issue_ckpt, ret = set_task_ioprio(cprc->f2fs_issue_ckpt,
cprc->ckpt_thread_ioprio); cprc->ckpt_thread_ioprio);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment