summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/sysfs.c
diff options
context:
space:
mode:
authorqixiaoyu1 <qxy65535@gmail.com>2023-02-04 17:43:45 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2023-02-07 10:39:19 -0800
commitd23be468eada21c828058e0e8d60409eaec373ab (patch)
tree6505bfba955c0b157c2f6d0fc476e6eebda22e2e /fs/f2fs/sysfs.c
parent04d7a7ae43fc4eed800efadbb4a18059172afb19 (diff)
downloadlinux-stable-d23be468eada21c828058e0e8d60409eaec373ab.tar.gz
linux-stable-d23be468eada21c828058e0e8d60409eaec373ab.tar.bz2
linux-stable-d23be468eada21c828058e0e8d60409eaec373ab.zip
f2fs: add sysfs nodes to set last_age_weight
Signed-off-by: qixiaoyu1 <qixiaoyu1@xiaomi.com> Signed-off-by: xiongping1 <xiongping1@xiaomi.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, 11 insertions, 0 deletions
diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index 3c6425f9ed0a..8789b3b53fb6 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -697,6 +697,15 @@ out:
return count;
}
+ if (!strcmp(a->attr.name, "last_age_weight")) {
+ if (t > 100)
+ return -EINVAL;
+ if (t == *ui)
+ return count;
+ *ui = (unsigned int)t;
+ return count;
+ }
+
*ui = (unsigned int)t;
return count;
@@ -956,6 +965,7 @@ F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, revoked_atomic_block, revoked_atomic_block)
/* For block age extent cache */
F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, hot_data_age_threshold, hot_data_age_threshold);
F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, warm_data_age_threshold, warm_data_age_threshold);
+F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, last_age_weight, last_age_weight);
#define ATTR_LIST(name) (&f2fs_attr_##name.attr)
static struct attribute *f2fs_attrs[] = {
@@ -1055,6 +1065,7 @@ static struct attribute *f2fs_attrs[] = {
ATTR_LIST(revoked_atomic_block),
ATTR_LIST(hot_data_age_threshold),
ATTR_LIST(warm_data_age_threshold),
+ ATTR_LIST(last_age_weight),
NULL,
};
ATTRIBUTE_GROUPS(f2fs);