linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk.kim@samsung.com>
To: Huajun Li <huajun.li.lee@gmail.com>
Cc: linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Huajun Li <huajun.li@intel.com>
Subject: Re: [PATCH 1/1] No need to do recovery if there is no available CP
Date: Mon, 11 Nov 2013 13:33:09 +0900	[thread overview]
Message-ID: <1384144389.14041.86.camel@kjgkr> (raw)
In-Reply-To: <CA+v9cxYvHAyfE32sHe2Q-kvP8R_L-aeOa8SFxy2UuuWPxeLy6w@mail.gmail.com>

Hi Huajun,

2013-11-05 (화), 21:28 +0800, Huajun Li:
> Hi Jaegeuk,
> 
> Got it, and nice to fix it in mkfs.f2fs.
> 
> Thanks,
> --Huajun
> On Tue, Nov 5, 2013 at 12:48 PM, Jaegeuk Kim <jaegeuk.kim@samsung.com> wrote:
> > Hi Huajun,
> >
> > 2013-11-04 (월), 23:40 +0800, Huajun Li:
> >> Hi Jaegeuk,
> >>
> >> On Mon, Nov 4, 2013 at 9:24 AM, Jaegeuk Kim <jaegeuk.kim@samsung.com> wrote:
> >> > 2013-11-03 (일), 23:08 +0800, Huajun Li:
> >> >> From: Huajun Li <huajun.li@intel.com>
> >> >>
> >> >> Normally we expect an empty partition after formatting by
> >> >> mkfs.f2fs. But in this case, when we format a dirty partition and mount
> >> >> it again. The former file will be recovered and available again! and
> >> >> kernel log shows a recovery procedure is evoked.
> >> >> This patch adds a new flag CP_EXIST_FLAG to indicate whether is a
> >> >> available CP, and do recovery only when this flag is set.
> >> >
> >> > IMO, mkfs.f2fs should do the right thing to avoid this.
> >> > If storage does not support discard, mkfs.f2fs can simply address the
> >> > problem by writing one node block with zeros to prevent this.
> >> >

WRT the below issue, I made a patch for mkfs.f2fs.
If possible, could you test and write a valid patch?
Thanks,

---
 mkfs/f2fs_format.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index 8234b00..18ded79 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -788,7 +788,12 @@ static int f2fs_write_root_inode(void)
 
 	memset(raw_node, 0xff, sizeof(struct f2fs_node));
 
-	main_area_node_seg_blk_offset += F2FS_BLKSIZE;
+	/* avoid power-off-recovery based on roll-forward policy */
+	main_area_node_seg_blk_offset = le32_to_cpu(super_block.main_blkaddr);
+	main_area_node_seg_blk_offset += config.cur_seg[CURSEG_WARM_NODE] *
+					config.blks_per_seg;
+        main_area_node_seg_blk_offset *= blk_size_bytes;
+
 	if (dev_write(raw_node, main_area_node_seg_blk_offset, F2FS_BLKSIZE))
{
 		MSG(1, "\tError: While writing the raw_node to disk!!!\n");
 		return -1;
-- 
1.8.4.474.g128a96c


-- 
Jaegeuk Kim
Samsung

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2013-11-11  4:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-03 15:08 [PATCH 1/1] No need to do recovery if there is no available CP Huajun Li
2013-11-04  1:24 ` Jaegeuk Kim
2013-11-04 15:40   ` Huajun Li
2013-11-05  4:48     ` Jaegeuk Kim
2013-11-05 13:28       ` Huajun Li
2013-11-11  4:33         ` Jaegeuk Kim [this message]
2013-11-11  6:06           ` Huajun Li

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=1384144389.14041.86.camel@kjgkr \
    --to=jaegeuk.kim@samsung.com \
    --cc=huajun.li.lee@gmail.com \
    --cc=huajun.li@intel.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    /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).