linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH] fsck.f2fs: write back last cp block in the end
@ 2017-08-23  4:13 Yunlei He
  2017-08-24 14:23 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Yunlei He @ 2017-08-23  4:13 UTC (permalink / raw)
  To: jaegeuk, yuchao0, linux-f2fs-devel; +Cc: heyunlei, morgan.wang

Write back last cp block in the end in case of sudden power off
during fsck process

Signed-off-by: Yunlei He <heyunlei@huawei.com>
---
 fsck/mount.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/fsck/mount.c b/fsck/mount.c
index a0b0bea..700a4ff 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -1918,13 +1918,16 @@ void write_checkpoint(struct f2fs_sb_info *sbi)
 		ASSERT(ret >= 0);
 	}
 
-	/* write the last cp */
-	ret = dev_write_block(cp, cp_blk_no++);
-	ASSERT(ret >= 0);
-
 	/* Write nat bits */
 	if (flags & CP_NAT_BITS_FLAG)
 		write_nat_bits(sbi, sb, cp, sbi->cur_cp);
+
+	/* in case of sudden power off */
+	f2fs_finalize_device();
+
+	/* write the last cp */
+	ret = dev_write_block(cp, cp_blk_no++);
+	ASSERT(ret >= 0);
 }
 
 void build_nat_area_bitmap(struct f2fs_sb_info *sbi)
-- 
1.9.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fsck.f2fs: write back last cp block in the end
  2017-08-23  4:13 [PATCH] fsck.f2fs: write back last cp block in the end Yunlei He
@ 2017-08-24 14:23 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2017-08-24 14:23 UTC (permalink / raw)
  To: Yunlei He, jaegeuk, yuchao0, linux-f2fs-devel; +Cc: morgan.wang

On 2017/8/23 12:13, Yunlei He wrote:
> Write back last cp block in the end in case of sudden power off
> during fsck process
> 
> Signed-off-by: Yunlei He <heyunlei@huawei.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

> ---
>  fsck/mount.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/fsck/mount.c b/fsck/mount.c
> index a0b0bea..700a4ff 100644
> --- a/fsck/mount.c
> +++ b/fsck/mount.c
> @@ -1918,13 +1918,16 @@ void write_checkpoint(struct f2fs_sb_info *sbi)
>  		ASSERT(ret >= 0);
>  	}
>  
> -	/* write the last cp */
> -	ret = dev_write_block(cp, cp_blk_no++);
> -	ASSERT(ret >= 0);
> -
>  	/* Write nat bits */
>  	if (flags & CP_NAT_BITS_FLAG)
>  		write_nat_bits(sbi, sb, cp, sbi->cur_cp);
> +
> +	/* in case of sudden power off */
> +	f2fs_finalize_device();
> +
> +	/* write the last cp */
> +	ret = dev_write_block(cp, cp_blk_no++);
> +	ASSERT(ret >= 0);
>  }
>  
>  void build_nat_area_bitmap(struct f2fs_sb_info *sbi)
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-24 14:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-23  4:13 [PATCH] fsck.f2fs: write back last cp block in the end Yunlei He
2017-08-24 14:23 ` Chao Yu

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).