Skip to content

Commit

Permalink
f2fs: reduce searching region of segmap when set free section
Browse files Browse the repository at this point in the history
In __set_free we will check whether all segment are free in one section
when free one segment, in order to set section to free status. But the
searching region of segmap is from start segno to last segno of main
area, it's not necessary. So let's just only check all segment bitmap
of target section.

Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
  • Loading branch information
Wanpeng Li authored and Jaegeuk Kim committed Apr 10, 2015
1 parent fdf6c8b commit 7fd9701
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/f2fs/segment.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,8 @@ static inline void __set_free(struct f2fs_sb_info *sbi, unsigned int segno)
clear_bit(segno, free_i->free_segmap);
free_i->free_segments++;

next = find_next_bit(free_i->free_segmap, MAIN_SEGS(sbi), start_segno);
next = find_next_bit(free_i->free_segmap,
start_segno + sbi->segs_per_sec, start_segno);
if (next >= start_segno + sbi->segs_per_sec) {
clear_bit(secno, free_i->free_secmap);
free_i->free_sections++;
Expand Down

0 comments on commit 7fd9701

Please sign in to comment.