summaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorYangtao Li <frank.li@vivo.com>2023-02-16 15:09:35 +0100
committerJaegeuk Kim <jaegeuk@kernel.org>2023-03-30 00:17:37 +0200
commit960fa2c828a0af7a3b03b295e6aa17b2afeb5e07 (patch)
tree2264e6c12566db76d7f003cbdbb7fd4562a7688a /fs/f2fs
parentf2fs: make f2fs_sync_inode_meta() static (diff)
downloadlinux-960fa2c828a0af7a3b03b295e6aa17b2afeb5e07.tar.xz
linux-960fa2c828a0af7a3b03b295e6aa17b2afeb5e07.zip
f2fs: export compress_percent and compress_watermark entries
This patch export below sysfs entries for better control cached compress page count. /sys/fs/f2fs/<disk>/compress_watermark /sys/fs/f2fs/<disk>/compress_percent 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')
-rw-r--r--fs/f2fs/sysfs.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index 0b19163c90d4..5397bd8bfcf7 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -598,6 +598,20 @@ out:
sbi->compr_new_inode = 0;
return count;
}
+
+ if (!strcmp(a->attr.name, "compress_percent")) {
+ if (t == 0 || t > 100)
+ return -EINVAL;
+ *ui = t;
+ return count;
+ }
+
+ if (!strcmp(a->attr.name, "compress_watermark")) {
+ if (t == 0 || t > 100)
+ return -EINVAL;
+ *ui = t;
+ return count;
+ }
#endif
if (!strcmp(a->attr.name, "atgc_candidate_ratio")) {
@@ -950,6 +964,8 @@ F2FS_FEATURE_RO_ATTR(compression);
F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compr_written_block, compr_written_block);
F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compr_saved_block, compr_saved_block);
F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compr_new_inode, compr_new_inode);
+F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compress_percent, compress_percent);
+F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compress_watermark, compress_watermark);
#endif
F2FS_FEATURE_RO_ATTR(pin_file);
@@ -1057,6 +1073,8 @@ static struct attribute *f2fs_attrs[] = {
ATTR_LIST(compr_written_block),
ATTR_LIST(compr_saved_block),
ATTR_LIST(compr_new_inode),
+ ATTR_LIST(compress_percent),
+ ATTR_LIST(compress_watermark),
#endif
/* For ATGC */
ATTR_LIST(atgc_candidate_ratio),