f2fs: reduce searching region of segmap when free section
authorChao Yu <chao2.yu@samsung.com>
Mon, 14 Jul 2014 08:45:15 +0000 (16:45 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 15 Jul 2014 20:56:49 +0000 (13:56 -0700)
In __set_test_and_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 f2fs,
it's not necessary. So let's just only check all segment bitmap of target
section.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/segment.h

index 7091204680f49383ff269f0b8c35834e2c5297d8..ee5c75e08d9cc24b917356f01e1933717400f232 100644 (file)
@@ -347,8 +347,8 @@ static inline void __set_test_and_free(struct f2fs_sb_info *sbi,
        if (test_and_clear_bit(segno, free_i->free_segmap)) {
                free_i->free_segments++;
 
-               next = find_next_bit(free_i->free_segmap, TOTAL_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) {
                        if (test_and_clear_bit(secno, free_i->free_secmap))
                                free_i->free_sections++;