aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2015-12-18 17:49:29 -0800
committerGreg Wallace <greg@gregtwallace.com>2016-01-19 22:02:21 -0500
commit0516d2ba48d29044bc5d5235cc9d98e77bcb2201 (patch)
tree621dad0c753f464f513f94081495f7a9bbb3ad0d
parentf00f43e3bf835aa56c51ed4b111a4750c9b912c9 (diff)
downloadandroid_external_f2fs-tools-0516d2ba48d29044bc5d5235cc9d98e77bcb2201.tar.gz
android_external_f2fs-tools-0516d2ba48d29044bc5d5235cc9d98e77bcb2201.tar.bz2
android_external_f2fs-tools-0516d2ba48d29044bc5d5235cc9d98e77bcb2201.zip
defrag.f2fs: fix missing SSA updates
Previously SSA is updated if it is not included in current segment info. But, defrag.f2fs doesn't handle current segment info during the process, and instead lastly update the whole current segment info at a time. So, we need to update summary entries all the time. Otherwise, we can lose the SSA entry. Change-Id: Ic94dc3b3b589620d30c7c442ec2b580ce4c76cad Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fsck/mount.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fsck/mount.c b/fsck/mount.c
index 79611e5..d2f1432 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -761,13 +761,16 @@ void update_sum_entry(struct f2fs_sb_info *sbi, block_t blk_addr,
sum_blk->footer.entry_type = IS_NODESEG(se->type) ? SUM_TYPE_NODE :
SUM_TYPE_DATA;
- if (type == SEG_TYPE_NODE || type == SEG_TYPE_DATA ||
- type == SEG_TYPE_MAX) {
+ /* write SSA all the time */
+ if (type < SEG_TYPE_MAX) {
u64 ssa_blk = GET_SUM_BLKADDR(sbi, segno);
ret = dev_write_block(sum_blk, ssa_blk);
ASSERT(ret >= 0);
- free(sum_blk);
}
+
+ if (type == SEG_TYPE_NODE || type == SEG_TYPE_DATA ||
+ type == SEG_TYPE_MAX)
+ free(sum_blk);
}
static void restore_curseg_summaries(struct f2fs_sb_info *sbi)