f2fs fg_gc: node segment is prior to data segment selected victim
PATCH 1/2 f2fs fg_gc: node segment is prior to data segment selected victim
As data segment gc may lead dnode dirty, so the greedy cost for data segment should be valid blocks * 2, that is data segment is prior to node segment.
Team:OTHERS
Feature or Bugfix:Bugfix
Binary Source:No
--- fs/f2fs/gc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +8 -1
@@ -242,6 +242,13 @@ static unsigned int get_cb_cost(struct f2fs_sb_info *sbi, unsigned int segno)return UINT_MAX - ((100 * (100 - u) * age) / (100 + u)); } +static unsigned int get_greedy_cost (struct f2fs_sb_info *sbi,unsigned int segno) +{ +unsigned int valid_blocks =get_valid_blocks (sbi, segno, sbi->segs_per_sec); +return IS_DATASEG (get_seg_entry (sbi, segno)->type) ? + valid_blocks *2 : valid_blocks; +} +static inline unsigned int get_gc_cost (struct f2fs_sb_info *sbi,unsigned int segno,struct victim_sel_policy *p) {
@@ -250,7 +257,7 @@ static inline unsigned int get_gc_cost(struct f2fs_sb_info *sbi,/* alloc_mode == LFS */ if (p->gc_mode ==GC_GREEDY ) -return get_valid_blocks (sbi, segno, sbi->segs_per_sec); +return get_greedy_cost (sbi, segno);else return get_cb_cost (sbi, segno); }
Signature · 6 lines
2.10.1 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
PATCH 2/2 f2fs:use fggc_set_cold_data instead of set_cold_data in fggc
When no dirty colde segment for fggc ssr, we do NOT set_cold_data.
--- fs/f2fs/gc.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +20 -1
@@ -666,6 +666,25 @@ static void move_encrypted_block(struct inode *inode, block_t bidx,f2fs_put_page (page,1 ); } +/* +* If NOT enough dirty cold data segments for fggc, fggc would consume +* a valuable free segment, which would slow down the fggc procedure, +* If there are NO COLD dirty segment, we do not set_cold_page. +*/ +static void fggc_set_cold_data (struct page *page) +{ +struct f2fs_sb_info *sbi =F2FS_P_SB (page); +struct dirty_seglist_info *dirty_i =DIRTY_I (sbi); +int nr_cold_dirties; + +mutex_lock (&dirty_i->seglist_lock); + nr_cold_dirties = dirty_i->nr_dirty[DIRTY_COLD_DATA ]; +mutex_unlock (&dirty_i->seglist_lock); + +if (nr_cold_dirties) +set_cold_data (page); + +}static void move_data_page (struct inode *inode,block_t bidx,int gc_type,unsigned int segno,int off) {
@@ -706,7 +725,7 @@ static void move_data_page(struct inode *inode, block_t bidx, int gc_type,remove_dirty_inode (inode); } -set_cold_data (page); +fggc_set_cold_data (page); err =do_write_data_page (&fio);if (err == -ENOMEM && is_dirty) {
Signature · 6 lines
2.10.1 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Jaegeuk Kim
maintainerRe: [PATCH 2/2] f2fs:use fggc_set_cold_data instead of set_cold_data in fggc
Hi Pengyang,
Quoted 1 line · Hou Pengyang
When no dirty colde segment for fggc ssr, we do NOT
set_cold_data.
The get_ssr_segment() finds a victim segment across all the hot/warm/cold data logs. When does this happen?
Thanks,
Quoted 56 lines
Signed-off-by Hou Pengyang <[email protected]>--- fs/f2fs/gc.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)fs/f2fs/gc.c +20
-1@@ -666,6 +666,25 @@ static void move_encrypted_block(struct inode *inode, block_t bidx,f2fs_put_page (page,1 ); } +/* +* If NOT enough dirty cold data segments for fggc, fggc would consume +* a valuable free segment, which would slow down the fggc procedure, +* If there are NO COLD dirty segment, we do not set_cold_page. +*/ +static void fggc_set_cold_data (struct page *page) +{ +struct f2fs_sb_info *sbi =F2FS_P_SB (page); +struct dirty_seglist_info *dirty_i =DIRTY_I (sbi); +int nr_cold_dirties; + +mutex_lock (&dirty_i->seglist_lock); + nr_cold_dirties = dirty_i->nr_dirty[DIRTY_COLD_DATA ]; +mutex_unlock (&dirty_i->seglist_lock); + +if (nr_cold_dirties) +set_cold_data (page); + +}static void move_data_page (struct inode *inode,block_t bidx,int gc_type,unsigned int segno,int off) {@@ -706,7 +725,7 @@ static void move_data_page(struct inode *inode, block_t bidx, int gc_type,remove_dirty_inode (inode); } -set_cold_data (page); +fggc_set_cold_data (page); err =do_write_data_page (&fio);if (err == -ENOMEM && is_dirty) {Signature · 10 lines
2.10.1 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Re: [PATCH 2/2] f2fs:use fggc_set_cold_data instead of set_cold_data in fggc
Quoted 8 lines · Jaegeuk Kim
Hi Pengyang,
Quoted 1 line · Hou Pengyang
When no dirty colde segment for fggc ssr, we do NOT
set_cold_data.The
get_ssr_segment()finds a victim segment across all the hot/warm/cold data logs. When does this happen?
Oh, I miss the travel across hot/warm/cold, sorry.
how about the following filter in get_victim_segment, which can avoid unnecessary afterwards bitmap scanning.
Thanks,
fs/f2fs/gc.c +0 -0
@@ -290,9 +290,16 @@ static int get_victim_by_default(struct
f2fs_sb_info *sbi,
unsigned int secno, last_victim;
unsigned int last_segment = MAIN_SEGS(sbi);
unsigned int nsearched = 0;+ int nr_dirty;
mutex_lock(&dirty_i->seglist_lock);
+ if (alloc_mode == SSR) {
+ nr_dirty = dirty_i->nr_dirty[type];
+ if (!nr_dirty)
+ goto out;
+ }
+
p.alloc_mode = alloc_mode;
select_policy(sbi, gc_type, type, &p);Quoted 51 lines
Thanks,
Quoted 49 lines
Signed-off-by Hou Pengyang <[email protected]>--- fs/f2fs/gc.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)fs/f2fs/gc.c +20
-2@@ -666,6 +666,25 @@ static void move_encrypted_block(struct inode *inode, block_t bidx,f2fs_put_page (page,1 ); } +/* +* If NOT enough dirty cold data segments for fggc, fggc would consume +* a valuable free segment, which would slow down the fggc procedure, +* If there are NO COLD dirty segment, we do not set_cold_page. +*/ +static void fggc_set_cold_data (struct page *page) +{ +struct f2fs_sb_info *sbi =F2FS_P_SB (page); +struct dirty_seglist_info *dirty_i =DIRTY_I (sbi); +int nr_cold_dirties; + +mutex_lock (&dirty_i->seglist_lock); + nr_cold_dirties = dirty_i->nr_dirty[DIRTY_COLD_DATA ]; +mutex_unlock (&dirty_i->seglist_lock); + +if (nr_cold_dirties) +set_cold_data (page); + +}static void move_data_page (struct inode *inode,block_t bidx,int gc_type,unsigned int segno,int off) {@@ -706,7 +725,7 @@ static void move_data_page(struct inode *inode, block_t bidx, int gc_type,remove_dirty_inode (inode); } -set_cold_data (page); +fggc_set_cold_data (page); err =do_write_data_page (&fio);if (err == -ENOMEM && is_dirty) { --2.10.1
Quoted 10 lines
Quoted 7 lines
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Jaegeuk Kim
maintainerRe: [PATCH 2/2] f2fs:use fggc_set_cold_data instead of set_cold_data in fggc
Quoted 4 lines · Hou Pengyang
Quoted 3 lines · Jaegeuk Kim
Hi Pengyang,
On 02/22, Hou Pengyang wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
When no dirty colde segment for fggc ssr, we do NOT
set_cold_data.The
get_ssr_segment()finds a victim segment across all the hot/warm/cold data logs. When does this happen?Oh, I miss the travel across hot/warm/cold, sorry.
how about the following filter inget_victim_segment, which can avoid unnecessary afterwards bitmap scanning.
Yup, it makes sense.
Thanks,
Quoted 77 lines
Thanks,
fs/f2fs/gc.c +7
-0@@ -290,9 +290,16 @@ static int get_victim_by_default(struct f2fs_sb_info *sbi, unsigned int secno, last_victim;unsigned int last_segment =MAIN_SEGS (sbi);unsigned int nsearched =0 ; +int nr_dirty;mutex_lock (&dirty_i->seglist_lock); +if (alloc_mode ==SSR ) { + nr_dirty = dirty_i->nr_dirty[type]; +if (!nr_dirty) + goto out; + } + p.alloc_mode = alloc_mode;select_policy (sbi, gc_type, type, &p);Quoted 53 lines
Thanks,
Quoted 49 lines
Signed-off-by Hou Pengyang <[email protected]>--- fs/f2fs/gc.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)fs/f2fs/gc.c +20
-2@@ -666,6 +666,25 @@ static void move_encrypted_block(struct inode *inode, block_t bidx,f2fs_put_page (page,1 ); } +/* +* If NOT enough dirty cold data segments for fggc, fggc would consume +* a valuable free segment, which would slow down the fggc procedure, +* If there are NO COLD dirty segment, we do not set_cold_page. +*/ +static void fggc_set_cold_data (struct page *page) +{ +struct f2fs_sb_info *sbi =F2FS_P_SB (page); +struct dirty_seglist_info *dirty_i =DIRTY_I (sbi); +int nr_cold_dirties; + +mutex_lock (&dirty_i->seglist_lock); + nr_cold_dirties = dirty_i->nr_dirty[DIRTY_COLD_DATA ]; +mutex_unlock (&dirty_i->seglist_lock); + +if (nr_cold_dirties) +set_cold_data (page); + +}static void move_data_page (struct inode *inode,block_t bidx,int gc_type,unsigned int segno,int off) {@@ -706,7 +725,7 @@ static void move_data_page(struct inode *inode, block_t bidx, int gc_type,remove_dirty_inode (inode); } -set_cold_data (page); +fggc_set_cold_data (page); err =do_write_data_page (&fio);if (err == -ENOMEM && is_dirty) { --2.10.1
Quoted 11 lines
Quoted 10 lines
Quoted 7 lines
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Chao Yu
Reviewed-byRe: [PATCH 2/2] f2fs:use fggc_set_cold_data instead of set_cold_data in fggc
In reply to Hou PengyangQuoted 21 lines · Hou Pengyang
Quoted 8 lines · Jaegeuk Kim
Hi Pengyang,
Quoted 1 line · Hou Pengyang
When no dirty colde segment for fggc ssr, we do NOT
set_cold_data.The
get_ssr_segment()finds a victim segment across all the hot/warm/cold data logs. When does this happen?Oh, I miss the travel across hot/warm/cold, sorry.
how about the following filter inget_victim_segment, which can avoid unnecessary afterwards bitmap scanning.Thanks,
fs/f2fs/gc.c +0
-0@@ -290,9 +290,16 @@ static int get_victim_by_default(struct f2fs_sb_info *sbi,
fs/f2fs/gc.c static int get_victim_by_default(struct · line 300
Quoted 10 lines
fs/f2fs/gc.c +4
-0unsigned int secno, last_victim;unsigned int last_segment =MAIN_SEGS (sbi);unsigned int nsearched =0 ; +int nr_dirty;mutex_lock (&dirty_i->seglist_lock); +if (alloc_mode ==SSR ) { + nr_dirty = dirty_i->nr_dirty[type]; +if (!nr_dirty)
Needs to clean up.
if (!dirty_i->nr_dirty[type])
Thanks,
Quoted 71 lines
fs/f2fs/gc.c +3
-0+ goto out; + } + p.alloc_mode = alloc_mode;select_policy (sbi, gc_type, type, &p);Quoted 53 lines
Thanks,
Quoted 49 lines
Signed-off-by Hou Pengyang <[email protected]>--- fs/f2fs/gc.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)fs/f2fs/gc.c +20
-2@@ -666,6 +666,25 @@ static void move_encrypted_block(struct inode *inode, block_t bidx,f2fs_put_page (page,1 ); } +/* +* If NOT enough dirty cold data segments for fggc, fggc would consume +* a valuable free segment, which would slow down the fggc procedure, +* If there are NO COLD dirty segment, we do not set_cold_page. +*/ +static void fggc_set_cold_data (struct page *page) +{ +struct f2fs_sb_info *sbi =F2FS_P_SB (page); +struct dirty_seglist_info *dirty_i =DIRTY_I (sbi); +int nr_cold_dirties; + +mutex_lock (&dirty_i->seglist_lock); + nr_cold_dirties = dirty_i->nr_dirty[DIRTY_COLD_DATA ]; +mutex_unlock (&dirty_i->seglist_lock); + +if (nr_cold_dirties) +set_cold_data (page); + +}static void move_data_page (struct inode *inode,block_t bidx,int gc_type,unsigned int segno,int off) {@@ -706,7 +725,7 @@ static void move_data_page(struct inode *inode, block_t bidx, int gc_type,remove_dirty_inode (inode); } -set_cold_data (page); +fggc_set_cold_data (page); err =do_write_data_page (&fio);if (err == -ENOMEM && is_dirty) { --2.10.1
Quoted 10 lines
Quoted 7 lines
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel.
Quoted 2 lines
.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Re: [PATCH 2/2] f2fs:use fggc_set_cold_data instead of set_cold_data in fggc
Quoted 3 lines · Chao Yu
Quoted 2 lines · Hou Pengyang
Quoted 1 line · Jaegeuk Kim
Hi Pengyang,
Hi Chao,
Quoted 26 lines
Quoted 26 lines
Quoted 7 lines · Hou Pengyang
Quoted 1 line
When no dirty colde segment for fggc ssr, we do NOT
set_cold_data.The
get_ssr_segment()finds a victim segment across all the hot/warm/cold data logs. When does this happen?Oh, I miss the travel across hot/warm/cold, sorry.
how about the following filter inget_victim_segment, which can avoid unnecessary afterwards bitmap scanning.Thanks,
fs/f2fs/gc.c +1
-0@@ -290,9 +290,16 @@ static int get_victim_by_default(structf2fs_sb_info *sbi, unsigned int secno, last_victim;unsigned int last_segment =MAIN_SEGS (sbi);unsigned int nsearched =0 ; +int nr_dirty;mutex_lock (&dirty_i->seglist_lock);
Quoted 7 lines
fs/f2fs/gc.c static int get_victim_by_default(struct · line 300
Quoted 3 lines
fs/f2fs/gc.c +3
-0+if (alloc_mode ==SSR ) { + nr_dirty = dirty_i->nr_dirty[type]; +if (!nr_dirty)Needs to clean up.
if (!dirty_i->nr_dirty[type])
As Jaegeuk explained, p.max_search has skipped no # of victims scenario
if (p.max_search == 0) goto out;
Thanks,
Quoted 76 lines
Reviewed-by Chao Yu <[email protected]>Thanks,
Quoted 71 lines
fs/f2fs/gc.c +3
-0+ goto out; + } + p.alloc_mode = alloc_mode;select_policy (sbi, gc_type, type, &p);Quoted 63 lines
Thanks,
Quoted 49 lines
Signed-off-by Hou Pengyang <[email protected]>--- fs/f2fs/gc.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)fs/f2fs/gc.c +20
-2@@ -666,6 +666,25 @@ static void move_encrypted_block(struct inode *inode, block_t bidx,f2fs_put_page (page,1 ); } +/* +* If NOT enough dirty cold data segments for fggc, fggc would consume +* a valuable free segment, which would slow down the fggc procedure, +* If there are NO COLD dirty segment, we do not set_cold_page. +*/ +static void fggc_set_cold_data (struct page *page) +{ +struct f2fs_sb_info *sbi =F2FS_P_SB (page); +struct dirty_seglist_info *dirty_i =DIRTY_I (sbi); +int nr_cold_dirties; + +mutex_lock (&dirty_i->seglist_lock); + nr_cold_dirties = dirty_i->nr_dirty[DIRTY_COLD_DATA ]; +mutex_unlock (&dirty_i->seglist_lock); + +if (nr_cold_dirties) +set_cold_data (page); + +}static void move_data_page (struct inode *inode,block_t bidx,int gc_type,unsigned int segno,int off) {@@ -706,7 +725,7 @@ static void move_data_page(struct inode *inode, block_t bidx, int gc_type,remove_dirty_inode (inode); } -set_cold_data (page); +fggc_set_cold_data (page); err =do_write_data_page (&fio);if (err == -ENOMEM && is_dirty) { --2.10.1
Quoted 7 lines
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel.
Quoted 6 lines
Quoted 2 lines
.
.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Quoted 4 lines · Hou Pengyang
As data segment gc may lead dnode dirty, so the greedy cost for data segment should be valid blocks * 2, that is data segment is prior to node segment.
Signed-off-by Hou Pengyang <[email protected]>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot