From: Yunlei He <heyunlei@huawei.com>
To: linux-f2fs-devel@lists.sourceforge.net, jaegeuk@kernel.org,
yuchao0@huawei.com
Cc: heyunlei@huwei.com
Subject: [PATCH] fsck: porting avoid unneeded loop in build_sit_entries to fsck
Date: Sat, 24 Sep 2016 12:29:17 +0800 [thread overview]
Message-ID: <1474691358-17191-1-git-send-email-heyunlei@huawei.com> (raw)
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
------------------------------------------------------------------------------
next reply other threads:[~2016-09-24 4:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-24 4:29 Yunlei He [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1474691358-17191-1-git-send-email-heyunlei@huawei.com \
--to=heyunlei@huawei.com \
--cc=heyunlei@huwei.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=yuchao0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).