f2fs: allocate new segment aligned with sections
authorJaegeuk Kim <jaegeuk.kim@samsung.com>
Sun, 31 Mar 2013 03:59:53 +0000 (12:59 +0900)
committerJaegeuk Kim <jaegeuk.kim@samsung.com>
Wed, 3 Apr 2013 08:27:49 +0000 (17:27 +0900)
When allocating a new segment under the LFS mode, we should keep the section
boundary.

Reviewed-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
fs/f2fs/segment.c

index 179a13e86f69ab51721b142fa28d0665a7564801..b3486f34af785d8eeb9ff2274117f0443bd2135e 100644 (file)
@@ -362,7 +362,8 @@ static void get_new_segment(struct f2fs_sb_info *sbi,
        if (!new_sec && ((*newseg + 1) % sbi->segs_per_sec)) {
                segno = find_next_zero_bit(free_i->free_segmap,
                                        TOTAL_SEGS(sbi), *newseg + 1);
-               if (segno < TOTAL_SEGS(sbi))
+               if (segno - *newseg < sbi->segs_per_sec -
+                                       (*newseg % sbi->segs_per_sec))
                        goto got_it;
        }
 find_other_zone: