All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fsck: porting avoid unneeded loop in build_sit_entries to fsck
@ 2016-09-24  4:29 Yunlei He
  2016-09-24  4:29 ` [PATCH] f2fs: remove redundant value definition Yunlei He
  2016-09-24 10:48 ` [PATCH] fsck: porting avoid unneeded loop in build_sit_entries to fsck Chao Yu
  0 siblings, 2 replies; 4+ messages in thread
From: Yunlei He @ 2016-09-24  4:29 UTC (permalink / raw)
  To: linux-f2fs-devel, jaegeuk, yuchao0; +Cc: heyunlei

This patch porting avoid unneeded loop in build_sit_entries to fsck

Signed-off-by: Yunlei He <heyunlei@huawei.com>
---
 fsck/mount.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/fsck/mount.c b/fsck/mount.c
index 3be60bb..f69a7af 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);
 	}
-- 
1.9.1


------------------------------------------------------------------------------

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-09-24 10:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-24  4:29 [PATCH] fsck: porting avoid unneeded loop in build_sit_entries to fsck Yunlei He
2016-09-24  4:29 ` [PATCH] f2fs: remove redundant value definition Yunlei He
2016-09-24 10:45   ` Chao Yu
2016-09-24 10:48 ` [PATCH] fsck: porting avoid unneeded loop in build_sit_entries to fsck Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.