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 <[email protected]>

Reviewed-by: Chao Yu <[email protected]>

> ---
>  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
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to