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@xxxxxxxxxxx> 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@xxxxxxxxxxx> wrote: > >> > 2013-11-03 (일), 23:08 +0800, Huajun Li: > >> >> From: Huajun Li <huajun.li@xxxxxxxxx> > >> >> > >> >> 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@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html