diff options
author | Yunlei He <heyunlei@huawei.com> | 2016-09-24 12:29:17 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-09-24 11:22:05 -0700 |
commit | f1ee35104dbc6279e52c9cf389acaeb12ac0c126 (patch) | |
tree | c3f9dbb6cae2273abeac18951c5840a9269099a7 | |
parent | 3ffc5a8f3ea0a70e247d1b1b222ad27f20716bdd (diff) | |
download | f2fs-tools-f1ee35104dbc6279e52c9cf389acaeb12ac0c126.tar.gz |
fsck: porting avoid unneeded loop in build_sit_entries to fsck
This patch porting avoid unneeded loop in build_sit_entries to fsck
Signed-off-by: Yunlei He <heyunlei@huawei.com>
Acked-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | fsck/mount.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/fsck/mount.c b/fsck/mount.c index 798825b..901ee21 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -1277,24 +1277,27 @@ void build_sit_entries(struct f2fs_sb_info *sbi) struct sit_info *sit_i = SIT_I(sbi); struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_COLD_DATA); struct f2fs_journal *journal = &curseg->sum_blk->journal; - unsigned int segno; + struct seg_entry *se; + struct f2fs_sit_entry sit; + unsigned int i, segno; for (segno = 0; segno < TOTAL_SEGS(sbi); segno++) { - struct seg_entry *se = &sit_i->sentries[segno]; + se = &sit_i->sentries[segno]; struct f2fs_sit_block *sit_blk; - struct f2fs_sit_entry sit; - int i; - for (i = 0; i < sits_in_cursum(journal); i++) { - if (le32_to_cpu(segno_in_journal(journal, i)) == segno) { - sit = sit_in_journal(journal, i); - goto got_it; - } - } sit_blk = get_current_sit_page(sbi, segno); sit = sit_blk->entries[SIT_ENTRY_OFFSET(sit_i, segno)]; free(sit_blk); -got_it: + + check_block_count(sbi, segno, &sit); + seg_info_from_raw_sit(se, &sit); + } + + for (i = 0; i < sits_in_cursum(journal); i++) { + segno = le32_to_cpu(segno_in_journal(journal, i)); + se = &sit_i->sentries[segno]; + sit = sit_in_journal(journal, i); + check_block_count(sbi, segno, &sit); seg_info_from_raw_sit(se, &sit); } |