* [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
* [PATCH] f2fs: remove redundant value definition
2016-09-24 4:29 [PATCH] fsck: porting avoid unneeded loop in build_sit_entries to fsck Yunlei He
@ 2016-09-24 4:29 ` 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
1 sibling, 1 reply; 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 remove redundant value definition in build_sit_entries
Signed-off-by: Yunlei He <heyunlei@huawei.com>
---
fs/f2fs/segment.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index e78501c..fbcc172 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2305,6 +2305,8 @@ static 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->journal;
+ struct seg_entry *se;
+ struct f2fs_sit_entry sit;
int sit_blk_cnt = SIT_BLK_CNT(sbi);
unsigned int i, start, end;
unsigned int readed, start_blk = 0;
@@ -2317,11 +2319,10 @@ static void build_sit_entries(struct f2fs_sb_info *sbi)
end = (start_blk + readed) * sit_i->sents_per_block;
for (; start < end && start < MAIN_SEGS(sbi); start++) {
- struct seg_entry *se = &sit_i->sentries[start];
struct f2fs_sit_block *sit_blk;
- struct f2fs_sit_entry sit;
struct page *page;
+ se = &sit_i->sentries[start];
page = get_current_sit_page(sbi, start);
sit_blk = (struct f2fs_sit_block *)page_address(page);
sit = sit_blk->entries[SIT_ENTRY_OFFSET(sit_i, start)];
@@ -2347,8 +2348,6 @@ static void build_sit_entries(struct f2fs_sb_info *sbi)
down_read(&curseg->journal_rwsem);
for (i = 0; i < sits_in_cursum(journal); i++) {
- struct f2fs_sit_entry sit;
- struct seg_entry *se;
unsigned int old_valid_blocks;
start = le32_to_cpu(segno_in_journal(journal, i));
--
1.9.1
------------------------------------------------------------------------------
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] f2fs: remove redundant value definition
2016-09-24 4:29 ` [PATCH] f2fs: remove redundant value definition Yunlei He
@ 2016-09-24 10:45 ` Chao Yu
0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2016-09-24 10:45 UTC (permalink / raw)
To: Yunlei He, linux-f2fs-devel, jaegeuk; +Cc: heyunlei
On 2016/9/24 12:29, Yunlei He wrote:
> This patch remove redundant value definition in build_sit_entries
>
> Signed-off-by: Yunlei He <heyunlei@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fsck: porting avoid unneeded loop in build_sit_entries to fsck
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:48 ` Chao Yu
1 sibling, 0 replies; 4+ messages in thread
From: Chao Yu @ 2016-09-24 10:48 UTC (permalink / raw)
To: Yunlei He, linux-f2fs-devel, jaegeuk; +Cc: heyunlei
On 2016/9/24 12:29, Yunlei He wrote:
> 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>
------------------------------------------------------------------------------
^ permalink raw reply [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 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).