f2fs: avoid mismatching block range for discard
PATCH 1/1 f2fs: avoid mismatching block range for discard
This patch skip discard block range smaller than trim_minlen, and can not be merged by neighbour
--- fs/f2fs/segment.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/f2fs/segment.c +4 -0
@@ -672,6 +672,10 @@ static void add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc)break ; end =__find_rev_next_zero_bit (dmap, max_blocks, start +1 ); +if (force && start && end != max_blocks + && (end - start) < cpc->trim_minlen) +continue ; +__add_discard_entry (sbi, cpc, se, start, end); } }
Signature · 9 lines
1.9.1 ------------------------------------------------------------------------------ Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape
Quoted 4 lines · Yunlei He
This patch skip discard block range smaller than
trim_minlen, and can not be merged by neighbourSigned-off-by Yunlei He <[email protected]>
Looks good to me, it reduces memory footprint during fstrim.
Quoted 10 lines
--- fs/f2fs/segment.c | 4 ++++ 1 file changed, 4 insertions(+)fs/f2fs/segment.c +0
-0
fs/f2fs/segment.c static void add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc) · line 681
Quoted 10 lines
fs/f2fs/segment.c +4
-0@@ -672,6 +672,10 @@ static void add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc)break ; end =__find_rev_next_zero_bit (dmap, max_blocks, start +1 ); +if (force && start && end != max_blocks + && (end - start) < cpc->trim_minlen) +continue ; +__add_discard_entry (sbi, cpc, se, start, end); } }
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today.
http://sdm.link/attshape