* [PATCH] f2fs: define DEFAULT_SMALL_VOLUME_DISCARD_GRANULARITY macro
@ 2022-11-18 18:02 Yangtao Li
2022-11-23 15:46 ` Chao Yu
0 siblings, 1 reply; 2+ messages in thread
From: Yangtao Li @ 2022-11-18 18:02 UTC (permalink / raw)
To: jaegeuk, chao; +Cc: linux-f2fs-devel, linux-kernel, Yangtao Li
Do cleanup in f2fs_tuning_parameters(), let's use macro
instead of number.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
fs/f2fs/f2fs.h | 2 ++
fs/f2fs/super.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index f0833638f59e..86c651884d26 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -329,6 +329,8 @@ struct discard_entry {
unsigned char discard_map[SIT_VBLOCK_MAP_SIZE]; /* segment discard bitmap */
};
+/* default discard granularity for small device, unit: block count */
+#define DEFAULT_SMALL_VOLUME_DISCARD_GRANULARITY 1
/* default discard granularity of inner discard thread, unit: block count */
#define DEFAULT_DISCARD_GRANULARITY 16
/* default maximum discard granularity of ordered discard, unit: block count */
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 31435c8645c8..7c32eabcf50c 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -4080,7 +4080,7 @@ static void f2fs_tuning_parameters(struct f2fs_sb_info *sbi)
/* adjust parameters according to the volume size */
if (MAIN_SEGS(sbi) <= SMALL_VOLUME_SEGMENTS) {
if (f2fs_block_unit_discard(sbi))
- SM_I(sbi)->dcc_info->discard_granularity = 1;
+ SM_I(sbi)->dcc_info->discard_granularity = DEFAULT_SMALL_VOLUME_DISCARD_GRANULARITY;
SM_I(sbi)->ipu_policy = 1 << F2FS_IPU_FORCE |
1 << F2FS_IPU_HONOR_OPU_WRITE;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] f2fs: define DEFAULT_SMALL_VOLUME_DISCARD_GRANULARITY macro
2022-11-18 18:02 [PATCH] f2fs: define DEFAULT_SMALL_VOLUME_DISCARD_GRANULARITY macro Yangtao Li
@ 2022-11-23 15:46 ` Chao Yu
0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2022-11-23 15:46 UTC (permalink / raw)
To: Yangtao Li, jaegeuk; +Cc: linux-f2fs-devel, linux-kernel
On 2022/11/19 2:02, Yangtao Li wrote:
> Do cleanup in f2fs_tuning_parameters(), let's use macro
> instead of number.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> fs/f2fs/f2fs.h | 2 ++
> fs/f2fs/super.c | 2 +-
> 2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index f0833638f59e..86c651884d26 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -329,6 +329,8 @@ struct discard_entry {
> unsigned char discard_map[SIT_VBLOCK_MAP_SIZE]; /* segment discard bitmap */
> };
>
> +/* default discard granularity for small device, unit: block count */
> +#define DEFAULT_SMALL_VOLUME_DISCARD_GRANULARITY 1
/* minimum discard granularity, unit: block count */
#define MIN_DISCARD_GRANULARITY 1
> /* default discard granularity of inner discard thread, unit: block count */
> #define DEFAULT_DISCARD_GRANULARITY 16
> /* default maximum discard granularity of ordered discard, unit: block count */
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 31435c8645c8..7c32eabcf50c 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -4080,7 +4080,7 @@ static void f2fs_tuning_parameters(struct f2fs_sb_info *sbi)
> /* adjust parameters according to the volume size */
> if (MAIN_SEGS(sbi) <= SMALL_VOLUME_SEGMENTS) {
> if (f2fs_block_unit_discard(sbi))
> - SM_I(sbi)->dcc_info->discard_granularity = 1;
> + SM_I(sbi)->dcc_info->discard_granularity = DEFAULT_SMALL_VOLUME_DISCARD_GRANULARITY;
SM_I(sbi)->dcc_info->discard_granularity =
MIN_DISCARD_GRANULARITY;
Thanks,
> SM_I(sbi)->ipu_policy = 1 << F2FS_IPU_FORCE |
> 1 << F2FS_IPU_HONOR_OPU_WRITE;
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-23 15:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-18 18:02 [PATCH] f2fs: define DEFAULT_SMALL_VOLUME_DISCARD_GRANULARITY macro Yangtao Li
2022-11-23 15:46 ` Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox