f2fs: enable tuning of boost_zoned_gc_percent via sysfs
PATCH v2 1/1 f2fs: enable tuning of boost_zoned_gc_percent via sysfs
to allow users to dynamically tune
the boost_zoned_gc_percent parameter
Signed-off-by yohan.joung <[email protected]>
--- fs/f2fs/gc.h | 3 ++- fs/f2fs/sysfs.c | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-)
fs/f2fs/gc.h +2 -1
@@ -194,6 +194,7 @@ static inline bool has_enough_invalid_blocks(struct f2fs_sb_info *sbi)static inline bool need_to_boost_gc (struct f2fs_sb_info *sbi) {if (f2fs_sb_has_blkzoned (sbi)) -return !has_enough_free_blocks (sbi,LIMIT_BOOST_ZONED_GC ); +return !has_enough_free_blocks (sbi, + sbi->gc_thread->boost_zoned_gc_percent);return has_enough_invalid_blocks (sbi); }
fs/f2fs/sysfs.c +5 -0
@@ -628,6 +628,11 @@ static ssize_t __sbi_store(struct f2fs_attr *a,return count; } +if (!strcmp (a->attr.name,"gc_boost_zoned_gc_percent" )) { +if (t >100 ) +return -EINVAL ; + } +#ifdef CONFIG_F2FS_IOSTAT if (!strcmp (a->attr.name,"iostat_enable" )) { sbi->iostat_enable = !!t;
Signature · 8 lines
2.33.0 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Chao Yu
maintainerQuoted 27 lines · yohan.joung
to allow users to dynamically tune
theboost_zoned_gc_percentparameterSigned-off-by yohan.joung <[email protected]>--- fs/f2fs/gc.h | 3 ++- fs/f2fs/sysfs.c | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-)fs/f2fs/gc.h +2
-1@@ -194,6 +194,7 @@ static inline bool has_enough_invalid_blocks(struct f2fs_sb_info *sbi)static inline bool need_to_boost_gc (struct f2fs_sb_info *sbi) {if (f2fs_sb_has_blkzoned (sbi)) -return !has_enough_free_blocks (sbi,LIMIT_BOOST_ZONED_GC ); +return !has_enough_free_blocks (sbi, + sbi->gc_thread->boost_zoned_gc_percent);return has_enough_invalid_blocks (sbi); }fs/f2fs/sysfs.c +0
-0
fs/f2fs/sysfs.c static ssize_t __sbi_store(struct f2fs_attr *a, · line 633
Quoted 6 lines
fs/f2fs/sysfs.c +3
-0@@ -628,6 +628,11 @@ static ssize_t __sbi_store(struct f2fs_attr *a,return count; } +if (!strcmp (a->attr.name,"gc_boost_zoned_gc_percent" )) { +if (t >100 ) +return -EINVAL ;
We'd better assign boost_zoned_gc_percent here and return directly to avoid all below unnecessary comparison between a->attr.name and entry names.
Thanks,
Quoted 5 lines
fs/f2fs/sysfs.c +2
-0+ } +#ifdef CONFIG_F2FS_IOSTAT if (!strcmp (a->attr.name,"iostat_enable" )) { sbi->iostat_enable = !!t;