f2fs: simplify the calculation of fggc_threshold
PATCH 1/1 f2fs: simplify the calculation of fggc_threshold
From: Qiuyang Sun <[email protected]>
Do not need to convert segment counts to blocks for this calculation.
--- fs/f2fs/gc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/f2fs/gc.c +5 -5
@@ -1073,16 +1073,16 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync,void build_gc_manager (struct f2fs_sb_info *sbi) { -u64 main_count, resv_count, ovp_count; +unsigned int main_count, resv_count, ovp_count;DIRTY_I (sbi)->v_ops = &default_v_ops;/* threshold of # of valid blocks in a section for victims of FG_GC */ - main_count =SM_I (sbi)->main_segments << sbi->log_blocks_per_seg; - resv_count =SM_I (sbi)->reserved_segments << sbi->log_blocks_per_seg; - ovp_count =SM_I (sbi)->ovp_segments << sbi->log_blocks_per_seg; + main_count =SM_I (sbi)->main_segments; + resv_count =SM_I (sbi)->reserved_segments; + ovp_count =SM_I (sbi)->ovp_segments; - sbi->fggc_threshold =div64_u64 ((main_count - ovp_count) * + sbi->fggc_threshold =div_u64 ((u64)(main_count - ovp_count) *BLKS_PER_SEC (sbi), (main_count - resv_count));/* give warm/cold data area from slower device */
Signature · 6 lines
1.8.3.1 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Quoted 5 lines · sunqiuyang
From: Qiuyang Sun <[email protected]>
Do not need to convert segment counts to blocks for this calculation.
Signed-off-by Qiuyang Sun <[email protected]>
Thanks,
Quoted 21 lines
--- fs/f2fs/gc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)fs/f2fs/gc.c +1
-3@@ -1073,16 +1073,16 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync,void build_gc_manager (struct f2fs_sb_info *sbi) { -u64 main_count, resv_count, ovp_count; +unsigned int main_count, resv_count, ovp_count;DIRTY_I (sbi)->v_ops = &default_v_ops;/* threshold of # of valid blocks in a section for victims of FG_GC */ - main_count =SM_I (sbi)->main_segments << sbi->log_blocks_per_seg; - resv_count =SM_I (sbi)->reserved_segments << sbi->log_blocks_per_seg;
fs/f2fs/gc.c int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, · line 1088
Quoted 10 lines
fs/f2fs/gc.c +4
-2- ovp_count =SM_I (sbi)->ovp_segments << sbi->log_blocks_per_seg; + main_count =SM_I (sbi)->main_segments; + resv_count =SM_I (sbi)->reserved_segments; + ovp_count =SM_I (sbi)->ovp_segments; - sbi->fggc_threshold =div64_u64 ((main_count - ovp_count) * + sbi->fggc_threshold =div_u64 ((u64)(main_count - ovp_count) *BLKS_PER_SEC (sbi), (main_count - resv_count));/* give warm/cold data area from slower device */
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Hi Jaegeuk,
I noticed that the log of the commit:
used a new expression as follows:
sbi->fggc_threshold = div_u64((u64)(main_count - ovp_count) *
BLKS_PER_SEC(sbi), (main_count - resv_count));
This might originate from my patch below, which has been merged into the f2fs-dev branch of kernel/git/chao/linux.git, but not kernel/git/jaegeuk/f2fs.git yet.
So, would you like to consider merging my patch as well?
Thanks,
Quoted 36 lines · sunqiuyang
Quoted 5 lines
From: Qiuyang Sun <[email protected]>
Do not need to convert segment counts to blocks for this calculation.
Signed-off-by Qiuyang Sun <[email protected]>Reviewed-by Chao Yu <[email protected]>Thanks,
Quoted 25 lines
--- fs/f2fs/gc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)fs/f2fs/gc.c +4
-4@@ -1073,16 +1073,16 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync,void build_gc_manager (struct f2fs_sb_info *sbi) { -u64 main_count, resv_count, ovp_count; +unsigned int main_count, resv_count, ovp_count;DIRTY_I (sbi)->v_ops = &default_v_ops;/* threshold of # of valid blocks in a section for victims of FG_GC */ - main_count =SM_I (sbi)->main_segments << sbi->log_blocks_per_seg; - resv_count =SM_I (sbi)->reserved_segments << sbi->log_blocks_per_seg; - ovp_count =SM_I (sbi)->ovp_segments << sbi->log_blocks_per_seg; + main_count =SM_I (sbi)->main_segments; + resv_count =SM_I (sbi)->reserved_segments; + ovp_count =SM_I (sbi)->ovp_segments;
Quoted 9 lines
fs/f2fs/gc.c int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, · line 1088
Quoted 6 lines
fs/f2fs/gc.c +1
-1- sbi->fggc_threshold =div64_u64 ((main_count - ovp_count) * + sbi->fggc_threshold =div_u64 ((u64)(main_count - ovp_count) *BLKS_PER_SEC (sbi), (main_count - resv_count));/* give warm/cold data area from slower device */ .
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 9 lines · Sun Qiuyang
Hi Jaegeuk,
I noticed that the log of the commit:
used a new expression as follows:
Quoted 8 lines
sbi->fggc_threshold= div_u64((u64)(main_count -ovp_count) *BLKS_PER_SEC(sbi), (main_count - resv_count));This might originate from my patch below, which has been merged into the f2fs-dev branch of
kernel/git/chao/linux.git, but notkernel/git/jaegeuk/f2fs.gityet.So, would you like to consider merging my patch as well?
As you see, I have reviewed this patch, since it looks good to me. ;) But forgot to remind Jaegeuk to merge this, sorry.
Anyway, how do you think of this cleanup? Jaegeuk.
Thanks,
Quoted 44 lines
Thanks,
Quoted 40 lines · sunqiuyang
Quoted 5 lines
From: Qiuyang Sun <[email protected]>
Do not need to convert segment counts to blocks for this calculation.
Signed-off-by Qiuyang Sun <[email protected]>Reviewed-by Chao Yu <[email protected]>Thanks,
Quoted 29 lines
--- fs/f2fs/gc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)fs/f2fs/gc.c +5
-5@@ -1073,16 +1073,16 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync,void build_gc_manager (struct f2fs_sb_info *sbi) { -u64 main_count, resv_count, ovp_count; +unsigned int main_count, resv_count, ovp_count;DIRTY_I (sbi)->v_ops = &default_v_ops;/* threshold of # of valid blocks in a section for victims of FG_GC */ - main_count =SM_I (sbi)->main_segments << sbi->log_blocks_per_seg; - resv_count =SM_I (sbi)->reserved_segments << sbi->log_blocks_per_seg; - ovp_count =SM_I (sbi)->ovp_segments << sbi->log_blocks_per_seg; + main_count =SM_I (sbi)->main_segments; + resv_count =SM_I (sbi)->reserved_segments; + ovp_count =SM_I (sbi)->ovp_segments; - sbi->fggc_threshold =div64_u64 ((main_count - ovp_count) * + sbi->fggc_threshold =div_u64 ((u64)(main_count - ovp_count) *BLKS_PER_SEC (sbi), (main_count - resv_count));
Quoted 9 lines
Quoted 5 lines
fs/f2fs/gc.c int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, · line 1088
Quoted 2 lines
fs/f2fs/gc.c +0
-0/* give warm/cold data area from slower device */ .
.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Jaegeuk Kim
maintainerQuoted 13 lines · Chao Yu
Quoted 12 lines · Sun Qiuyang
Hi Jaegeuk,
I noticed that the log of the commit:
used a new expression as follows:
sbi->fggc_threshold= div_u64((u64)(main_count -ovp_count) *BLKS_PER_SEC(sbi), (main_count - resv_count));
Quoted 8 lines
Quoted 5 lines
This might originate from my patch below, which has been merged into the f2fs-dev branch of
kernel/git/chao/linux.git, but notkernel/git/jaegeuk/f2fs.gityet.So, would you like to consider merging my patch as well?
As you see, I have reviewed this patch, since it looks good to me. ;) But forgot to remind Jaegeuk to merge this, sorry.
So, why do we have to do this? We're calculating this based on # of blocks. If we don't use this patch, didn't we need the Chao's patch as well?
Thanks,
Quoted 58 lines
Anyway, how do you think of this cleanup? Jaegeuk.
Thanks,
Quoted 53 lines
Thanks,
Quoted 36 lines · sunqiuyang
Quoted 5 lines
From: Qiuyang Sun <[email protected]>
Do not need to convert segment counts to blocks for this calculation.
Signed-off-by Qiuyang Sun <[email protected]>Reviewed-by Chao Yu <[email protected]>Thanks,
Quoted 25 lines
--- fs/f2fs/gc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)fs/f2fs/gc.c +4
-4@@ -1073,16 +1073,16 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync,void build_gc_manager (struct f2fs_sb_info *sbi) { -u64 main_count, resv_count, ovp_count; +unsigned int main_count, resv_count, ovp_count;DIRTY_I (sbi)->v_ops = &default_v_ops;/* threshold of # of valid blocks in a section for victims of FG_GC */ - main_count =SM_I (sbi)->main_segments << sbi->log_blocks_per_seg; - resv_count =SM_I (sbi)->reserved_segments << sbi->log_blocks_per_seg; - ovp_count =SM_I (sbi)->ovp_segments << sbi->log_blocks_per_seg; + main_count =SM_I (sbi)->main_segments; + resv_count =SM_I (sbi)->reserved_segments; + ovp_count =SM_I (sbi)->ovp_segments;Quoted 9 lines
fs/f2fs/gc.c int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, · line 1088
Quoted 6 lines
fs/f2fs/gc.c +1
-1- sbi->fggc_threshold =div64_u64 ((main_count - ovp_count) * + sbi->fggc_threshold =div_u64 ((u64)(main_count - ovp_count) *BLKS_PER_SEC (sbi), (main_count - resv_count));/* give warm/cold data area from slower device */ .
.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Chao Yu
maintainerQuoted 18 lines · Jaegeuk Kim
Quoted 17 lines · Chao Yu
Quoted 16 lines · Sun Qiuyang
Hi Jaegeuk,
I noticed that the log of the commit:
used a new expression as follows:
sbi->fggc_threshold= div_u64((u64)(main_count -ovp_count) *BLKS_PER_SEC(sbi), (main_count - resv_count));This might originate from my patch below, which has been merged into the f2fs-dev branch of
kernel/git/chao/linux.git, but notkernel/git/jaegeuk/f2fs.gityet.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
So, would you like to consider merging my patch as well?
As you see, I have reviewed this patch, since it looks good to me. ;) But forgot to remind Jaegeuk to merge this, sorry.
So, why do we have to do this? We're calculating this based on # of blocks. If we don't use this patch, didn't we need the Chao's patch as well?
Only connection of these two patches is that comments in my patch referenced codes which Qiuyang's patch modified:
sbi->fggc_threshold = div_u64((u64)(main_count - ovp_count) *
BLKS_PER_SEC(sbi), (main_count - resv_count));
For content of two patches, they are irrelevant.
Thanks,
Quoted 61 lines
Thanks,
Quoted 58 lines
Anyway, how do you think of this cleanup? Jaegeuk.
Thanks,
Quoted 53 lines
Thanks,
Quoted 36 lines · sunqiuyang
Quoted 5 lines
From: Qiuyang Sun <[email protected]>
Do not need to convert segment counts to blocks for this calculation.
Signed-off-by Qiuyang Sun <[email protected]>Reviewed-by Chao Yu <[email protected]>Thanks,
Quoted 25 lines
--- fs/f2fs/gc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)fs/f2fs/gc.c +4
-4@@ -1073,16 +1073,16 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync,void build_gc_manager (struct f2fs_sb_info *sbi) { -u64 main_count, resv_count, ovp_count; +unsigned int main_count, resv_count, ovp_count;DIRTY_I (sbi)->v_ops = &default_v_ops;/* threshold of # of valid blocks in a section for victims of FG_GC */ - main_count =SM_I (sbi)->main_segments << sbi->log_blocks_per_seg; - resv_count =SM_I (sbi)->reserved_segments << sbi->log_blocks_per_seg; - ovp_count =SM_I (sbi)->ovp_segments << sbi->log_blocks_per_seg; + main_count =SM_I (sbi)->main_segments; + resv_count =SM_I (sbi)->reserved_segments; + ovp_count =SM_I (sbi)->ovp_segments;Quoted 9 lines
fs/f2fs/gc.c int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, · line 1088
Quoted 6 lines
fs/f2fs/gc.c +1
-1- sbi->fggc_threshold =div64_u64 ((main_count - ovp_count) * + sbi->fggc_threshold =div_u64 ((u64)(main_count - ovp_count) *BLKS_PER_SEC (sbi), (main_count - resv_count));/* give warm/cold data area from slower device */ .
.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot