From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Subject: [PATCH 1/2] defrag.f2fs: fix missing SSA updates
Date: Mon, 21 Dec 2015 09:44:51 -0800 [thread overview]
Message-ID: <1450719892-10731-1-git-send-email-jaegeuk@kernel.org> (raw)
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.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fsck/mount.c | 9 ++++++---
1 file 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)
--
2.5.4 (Apple Git-61)
------------------------------------------------------------------------------
next reply other threads:[~2015-12-21 17:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-21 17:44 Jaegeuk Kim [this message]
2015-12-21 17:44 ` [PATCH 2/2] fsck.f2fs: fix losing journal entries Jaegeuk Kim
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=1450719892-10731-1-git-send-email-jaegeuk@kernel.org \
--to=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
/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).