From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Subject: [PATCH 1/4] mkfs.f2fs: make sure clean all reset dnodes
Date: Mon, 13 Feb 2017 18:05:17 -0800 [thread overview]
Message-ID: <20170214020520.18091-1-jaegeuk@kernel.org> (raw)
From: Kinglong Mee <kinglongmee@gmail.com>
memset(raw_node, 0, F2FS_BLKSIZE) sets the next_blkaddr to zero,
so that, only one reset dnode is cleaned always.
Fixes: ad042d9194f5 "mkfs.f2fs: reset dnode with zeros",
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
mkfs/f2fs_format.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index 2e0a4e5..e61adaa 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -775,6 +775,8 @@ static int f2fs_write_super_block(void)
#ifndef WITH_ANDROID
static int discard_obsolete_dnode(struct f2fs_node *raw_node, u_int64_t offset)
{
+ u_int64_t next_blkaddr = 0;
+
if (c.zoned_mode)
return 0;
do {
@@ -787,6 +789,7 @@ static int discard_obsolete_dnode(struct f2fs_node *raw_node, u_int64_t offset)
return -1;
}
+ next_blkaddr = le32_to_cpu(raw_node->footer.next_blkaddr);
memset(raw_node, 0, F2FS_BLKSIZE);
DBG(1, "\tDiscard dnode, at offset 0x%08"PRIx64"\n", offset);
@@ -794,7 +797,7 @@ static int discard_obsolete_dnode(struct f2fs_node *raw_node, u_int64_t offset)
MSG(1, "\tError: While discarding direct node!!!\n");
return -1;
}
- offset = le32_to_cpu(raw_node->footer.next_blkaddr);
+ offset = next_blkaddr;
} while (1);
return 0;
--
2.11.0
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
next reply other threads:[~2017-02-14 2:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-14 2:05 Jaegeuk Kim [this message]
2017-02-14 2:05 ` [PATCH 2/4] f2fs-tools: catch up up-to-date checkpoint flag Jaegeuk Kim
2017-02-14 2:05 ` [PATCH 3/4] fsck.f2fs: fix wrong usage out Jaegeuk Kim
2017-02-14 2:05 ` [PATCH 4/4] mkfs.f2fs: support nat_bits feature Jaegeuk Kim
2017-02-23 9:25 ` [PATCH 1/4] mkfs.f2fs: make sure clean all reset dnodes 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=20170214020520.18091-1-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).