diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2014-09-02 19:24:11 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2014-09-09 16:15:03 -0400 |
commit | ec325b5270cd3ba01bce299d1ede1616f31813ea (patch) | |
tree | 253a5185bbb02c5fe0b8d114dd54896a6989905c | |
parent | 05796763b8d19b48bb4149bfb1aa1a91dd9faee6 (diff) |
f2fs: handle bug cases by letting fsck.f2fs initiate
This patch adds to handle corner buggy cases for fsck.f2fs.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | fs/f2fs/segment.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 46586d3d3904..853c8f5445fd 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c | |||
@@ -317,6 +317,10 @@ static void __locate_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno, | |||
317 | struct seg_entry *sentry = get_seg_entry(sbi, segno); | 317 | struct seg_entry *sentry = get_seg_entry(sbi, segno); |
318 | enum dirty_type t = sentry->type; | 318 | enum dirty_type t = sentry->type; |
319 | 319 | ||
320 | if (unlikely(t >= DIRTY)) { | ||
321 | f2fs_bug_on(sbi, 1); | ||
322 | return; | ||
323 | } | ||
320 | if (!test_and_set_bit(segno, dirty_i->dirty_segmap[t])) | 324 | if (!test_and_set_bit(segno, dirty_i->dirty_segmap[t])) |
321 | dirty_i->nr_dirty[t]++; | 325 | dirty_i->nr_dirty[t]++; |
322 | } | 326 | } |
@@ -1745,8 +1749,12 @@ static void init_dirty_segmap(struct f2fs_sb_info *sbi) | |||
1745 | break; | 1749 | break; |
1746 | offset = segno + 1; | 1750 | offset = segno + 1; |
1747 | valid_blocks = get_valid_blocks(sbi, segno, 0); | 1751 | valid_blocks = get_valid_blocks(sbi, segno, 0); |
1748 | if (valid_blocks >= sbi->blocks_per_seg || !valid_blocks) | 1752 | if (valid_blocks == sbi->blocks_per_seg || !valid_blocks) |
1749 | continue; | 1753 | continue; |
1754 | if (valid_blocks > sbi->blocks_per_seg) { | ||
1755 | f2fs_bug_on(sbi, 1); | ||
1756 | continue; | ||
1757 | } | ||
1750 | mutex_lock(&dirty_i->seglist_lock); | 1758 | mutex_lock(&dirty_i->seglist_lock); |
1751 | __locate_dirty_segment(sbi, segno, DIRTY); | 1759 | __locate_dirty_segment(sbi, segno, DIRTY); |
1752 | mutex_unlock(&dirty_i->seglist_lock); | 1760 | mutex_unlock(&dirty_i->seglist_lock); |