[PATCH v3] f2fs: enable tuning of boost_zoned_gc_percent via sysfs

yohan.joung posted 1 patch 3 months, 3 weeks ago
There is a newer version of this series
fs/f2fs/gc.h    | 3 ++-
fs/f2fs/sysfs.c | 7 +++++++
2 files changed, 9 insertions(+), 1 deletion(-)
[PATCH v3] f2fs: enable tuning of boost_zoned_gc_percent via sysfs
Posted by yohan.joung 3 months, 3 weeks ago
to allow users to dynamically tune
the boost_zoned_gc_percent parameter

Signed-off-by: yohan.joung <yohan.joung@sk.com>
---
 fs/f2fs/gc.h    | 3 ++-
 fs/f2fs/sysfs.c | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h
index 5c1eaf55e127..11fba7636af7 100644
--- a/fs/f2fs/gc.h
+++ b/fs/f2fs/gc.h
@@ -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);
 }
diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index 75134d69a0bd..d0ec9963ff1b 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -628,6 +628,13 @@ 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;
+		*ui = (unsigned int)t;
+		return count;
+	}
+
 #ifdef CONFIG_F2FS_IOSTAT
 	if (!strcmp(a->attr.name, "iostat_enable")) {
 		sbi->iostat_enable = !!t;
-- 
2.33.0
Re: [PATCH v3] f2fs: enable tuning of boost_zoned_gc_percent via sysfs
Posted by Chao Yu 3 months, 2 weeks ago
On 2025/6/18 14:04, yohan.joung wrote:
> to allow users to dynamically tune
> the boost_zoned_gc_percent parameter

Well, it seem this patch did two things:

1. fix to check upper boundary for value of gc_boost_zoned_gc_percent.
2. allow need_to_boost_gc() to use last value of boost_zoned_gc_percent 
dynamically.

Can you please split this patch to two?

Thanks,

> 
> Signed-off-by: yohan.joung <yohan.joung@sk.com>
> ---
>   fs/f2fs/gc.h    | 3 ++-
>   fs/f2fs/sysfs.c | 7 +++++++
>   2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h
> index 5c1eaf55e127..11fba7636af7 100644
> --- a/fs/f2fs/gc.h
> +++ b/fs/f2fs/gc.h
> @@ -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);
>   }
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index 75134d69a0bd..d0ec9963ff1b 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -628,6 +628,13 @@ 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;
> +		*ui = (unsigned int)t;
> +		return count;
> +	}
> +
>   #ifdef CONFIG_F2FS_IOSTAT
>   	if (!strcmp(a->attr.name, "iostat_enable")) {
>   		sbi->iostat_enable = !!t;