All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fsck.f2fs: fix to set CP_LARGE_NAT_BITMAP_FLAG
@ 2019-04-18  7:49 Chao Yu
  2019-04-18 13:14 ` Ju Hyung Park
  0 siblings, 1 reply; 5+ messages in thread
From: Chao Yu @ 2019-04-18  7:49 UTC (permalink / raw)
  To: linux-f2fs-devel; +Cc: jaegeuk

During fixing checkpoint, if large_nat_bitmap feature is on, we need to
set CP_LARGE_NAT_BITMAP_FLAG flag in checkpoint.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fsck/fsck.c  | 2 ++
 fsck/mount.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/fsck/fsck.c b/fsck/fsck.c
index a17555c..88ed4d7 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -2038,6 +2038,8 @@ static void fix_checkpoint(struct f2fs_sb_info *sbi)
 		flags |= CP_TRIMMED_FLAG;
 	if (is_set_ckpt_flags(cp, CP_DISABLED_FLAG))
 		flags |= CP_DISABLED_FLAG;
+	if (is_set_ckpt_flags(cp, CP_LARGE_NAT_BITMAP_FLAG))
+		flags |= CP_LARGE_NAT_BITMAP_FLAG;
 
 	if (flags & CP_UMOUNT_FLAG)
 		cp_blocks = 8;
diff --git a/fsck/mount.c b/fsck/mount.c
index aa64e93..20ecf07 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -2365,6 +2365,8 @@ void write_checkpoint(struct f2fs_sb_info *sbi)
 		flags |= CP_TRIMMED_FLAG;
 	if (is_set_ckpt_flags(cp, CP_DISABLED_FLAG))
 		flags |= CP_DISABLED_FLAG;
+	if (is_set_ckpt_flags(cp, CP_LARGE_NAT_BITMAP_FLAG))
+		flags |= CP_LARGE_NAT_BITMAP_FLAG;
 
 	set_cp(free_segment_count, get_free_segments(sbi));
 	set_cp(valid_block_count, sbi->total_valid_block_count);
-- 
2.18.0.rc1

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

* Re: [PATCH] fsck.f2fs: fix to set CP_LARGE_NAT_BITMAP_FLAG
  2019-04-18  7:49 [PATCH] fsck.f2fs: fix to set CP_LARGE_NAT_BITMAP_FLAG Chao Yu
@ 2019-04-18 13:14 ` Ju Hyung Park
  2019-04-19  3:45   ` Chao Yu
  0 siblings, 1 reply; 5+ messages in thread
From: Ju Hyung Park @ 2019-04-18 13:14 UTC (permalink / raw)
  To: Chao Yu; +Cc: Jaegeuk Kim, linux-f2fs-devel

Hi Chao,

The output appears to be similar to the one without this patch,
however, it now actually mounts.

[ 2360.127787] F2FS-fs (loop1): Found nat_bits in checkpoint
[ 2360.189038] F2FS-fs (loop1): orphan cleanup on readonly fs
[ 2360.189284] F2FS-fs (loop1): recover fsync data on readonly fs
[ 2360.189297] F2FS-fs (loop1): Mounted with checkpoint version = 761bfa29

Go to here to look at the new fsck output:
http://arter97.com/f2fs/log_2.txt.xz
(previous one is now log_1.txt.xz)

However, something weird goes on.
Without even touching the image after first fsck run, the consecutive
2nd run prints out A LOT of messages:
http://arter97.com/f2fs/log_3.txt.xz

The image seems to mount normally after on both the 1st and the 2nd fsck run.

Thanks.

On Thu, Apr 18, 2019 at 4:49 PM Chao Yu <yuchao0@huawei.com> wrote:
>
> During fixing checkpoint, if large_nat_bitmap feature is on, we need to
> set CP_LARGE_NAT_BITMAP_FLAG flag in checkpoint.
>
> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> ---
>  fsck/fsck.c  | 2 ++
>  fsck/mount.c | 2 ++
>  2 files changed, 4 insertions(+)
>
> diff --git a/fsck/fsck.c b/fsck/fsck.c
> index a17555c..88ed4d7 100644
> --- a/fsck/fsck.c
> +++ b/fsck/fsck.c
> @@ -2038,6 +2038,8 @@ static void fix_checkpoint(struct f2fs_sb_info *sbi)
>                 flags |= CP_TRIMMED_FLAG;
>         if (is_set_ckpt_flags(cp, CP_DISABLED_FLAG))
>                 flags |= CP_DISABLED_FLAG;
> +       if (is_set_ckpt_flags(cp, CP_LARGE_NAT_BITMAP_FLAG))
> +               flags |= CP_LARGE_NAT_BITMAP_FLAG;
>
>         if (flags & CP_UMOUNT_FLAG)
>                 cp_blocks = 8;
> diff --git a/fsck/mount.c b/fsck/mount.c
> index aa64e93..20ecf07 100644
> --- a/fsck/mount.c
> +++ b/fsck/mount.c
> @@ -2365,6 +2365,8 @@ void write_checkpoint(struct f2fs_sb_info *sbi)
>                 flags |= CP_TRIMMED_FLAG;
>         if (is_set_ckpt_flags(cp, CP_DISABLED_FLAG))
>                 flags |= CP_DISABLED_FLAG;
> +       if (is_set_ckpt_flags(cp, CP_LARGE_NAT_BITMAP_FLAG))
> +               flags |= CP_LARGE_NAT_BITMAP_FLAG;
>
>         set_cp(free_segment_count, get_free_segments(sbi));
>         set_cp(valid_block_count, sbi->total_valid_block_count);
> --
> 2.18.0.rc1
>
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH] fsck.f2fs: fix to set CP_LARGE_NAT_BITMAP_FLAG
  2019-04-18 13:14 ` Ju Hyung Park
@ 2019-04-19  3:45   ` Chao Yu
  2019-04-19  4:36     ` Ju Hyung Park
  0 siblings, 1 reply; 5+ messages in thread
From: Chao Yu @ 2019-04-19  3:45 UTC (permalink / raw)
  To: Ju Hyung Park; +Cc: Jaegeuk Kim, linux-f2fs-devel

Hi Ju Hyung,

On 2019/4/18 21:14, Ju Hyung Park wrote:
> Hi Chao,
> 
> The output appears to be similar to the one without this patch,
> however, it now actually mounts.
> 
> [ 2360.127787] F2FS-fs (loop1): Found nat_bits in checkpoint
> [ 2360.189038] F2FS-fs (loop1): orphan cleanup on readonly fs
> [ 2360.189284] F2FS-fs (loop1): recover fsync data on readonly fs
> [ 2360.189297] F2FS-fs (loop1): Mounted with checkpoint version = 761bfa29
> 
> Go to here to look at the new fsck output:
> http://arter97.com/f2fs/log_2.txt.xz
> (previous one is now log_1.txt.xz)
> 
> However, something weird goes on.
> Without even touching the image after first fsck run, the consecutive
> 2nd run prints out A LOT of messages:
> http://arter97.com/f2fs/log_3.txt.xz
> 
> The image seems to mount normally after on both the 1st and the 2nd fsck run.

Yes, this is because persistence of chksum in checkpoint will damage sit bitmap.

I've sent two patches, could you please try them?

Thanks

> 
> Thanks.
> 
> On Thu, Apr 18, 2019 at 4:49 PM Chao Yu <yuchao0@huawei.com> wrote:
>>
>> During fixing checkpoint, if large_nat_bitmap feature is on, we need to
>> set CP_LARGE_NAT_BITMAP_FLAG flag in checkpoint.
>>
>> Signed-off-by: Chao Yu <yuchao0@huawei.com>
>> ---
>>  fsck/fsck.c  | 2 ++
>>  fsck/mount.c | 2 ++
>>  2 files changed, 4 insertions(+)
>>
>> diff --git a/fsck/fsck.c b/fsck/fsck.c
>> index a17555c..88ed4d7 100644
>> --- a/fsck/fsck.c
>> +++ b/fsck/fsck.c
>> @@ -2038,6 +2038,8 @@ static void fix_checkpoint(struct f2fs_sb_info *sbi)
>>                 flags |= CP_TRIMMED_FLAG;
>>         if (is_set_ckpt_flags(cp, CP_DISABLED_FLAG))
>>                 flags |= CP_DISABLED_FLAG;
>> +       if (is_set_ckpt_flags(cp, CP_LARGE_NAT_BITMAP_FLAG))
>> +               flags |= CP_LARGE_NAT_BITMAP_FLAG;
>>
>>         if (flags & CP_UMOUNT_FLAG)
>>                 cp_blocks = 8;
>> diff --git a/fsck/mount.c b/fsck/mount.c
>> index aa64e93..20ecf07 100644
>> --- a/fsck/mount.c
>> +++ b/fsck/mount.c
>> @@ -2365,6 +2365,8 @@ void write_checkpoint(struct f2fs_sb_info *sbi)
>>                 flags |= CP_TRIMMED_FLAG;
>>         if (is_set_ckpt_flags(cp, CP_DISABLED_FLAG))
>>                 flags |= CP_DISABLED_FLAG;
>> +       if (is_set_ckpt_flags(cp, CP_LARGE_NAT_BITMAP_FLAG))
>> +               flags |= CP_LARGE_NAT_BITMAP_FLAG;
>>
>>         set_cp(free_segment_count, get_free_segments(sbi));
>>         set_cp(valid_block_count, sbi->total_valid_block_count);
>> --
>> 2.18.0.rc1
>>
>>
>>
>> _______________________________________________
>> Linux-f2fs-devel mailing list
>> Linux-f2fs-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> .
> 

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

* Re: [PATCH] fsck.f2fs: fix to set CP_LARGE_NAT_BITMAP_FLAG
  2019-04-19  3:45   ` Chao Yu
@ 2019-04-19  4:36     ` Ju Hyung Park
  2019-04-19  4:59       ` Chao Yu
  0 siblings, 1 reply; 5+ messages in thread
From: Ju Hyung Park @ 2019-04-19  4:36 UTC (permalink / raw)
  To: Chao Yu, Jaegeuk Kim; +Cc: linux-f2fs-devel

Hi Chao and Jaegeuk.

On Fri, Apr 19, 2019 at 12:46 PM Chao Yu <yuchao0@huawei.com> wrote:
> I've sent two patches, could you please try them?
>
> Thanks

Thanks for the patches.

So it seems like I need to reformat my f2fs partitions, please confirm
if that's the case.
Also, if these patches break backward-compatibility, wouldn't it be
better to rename the feature and mark the old one deprecated?

I would like to see Jaegeuk's review before mkfs'ing again.

Thanks.

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

* Re: [PATCH] fsck.f2fs: fix to set CP_LARGE_NAT_BITMAP_FLAG
  2019-04-19  4:36     ` Ju Hyung Park
@ 2019-04-19  4:59       ` Chao Yu
  0 siblings, 0 replies; 5+ messages in thread
From: Chao Yu @ 2019-04-19  4:59 UTC (permalink / raw)
  To: Ju Hyung Park, Jaegeuk Kim; +Cc: linux-f2fs-devel

On 2019/4/19 12:36, Ju Hyung Park wrote:
> Hi Chao and Jaegeuk.
> 
> On Fri, Apr 19, 2019 at 12:46 PM Chao Yu <yuchao0@huawei.com> wrote:
>> I've sent two patches, could you please try them?
>>
>> Thanks
> 
> Thanks for the patches.
> 
> So it seems like I need to reformat my f2fs partitions, please confirm
> if that's the case.

I think you can try new fsck to check whether it can fix the corrupted image first?

> Also, if these patches break backward-compatibility, wouldn't it be
> better to rename the feature and mark the old one deprecated?

Yeah, that would be one option, I agree and prefer to listen to Jaegeuk's point
of view.

> 
> I would like to see Jaegeuk's review before mkfs'ing again.
> 
> Thanks.
> .
> 

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

end of thread, other threads:[~2019-04-19  4:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-18  7:49 [PATCH] fsck.f2fs: fix to set CP_LARGE_NAT_BITMAP_FLAG Chao Yu
2019-04-18 13:14 ` Ju Hyung Park
2019-04-19  3:45   ` Chao Yu
2019-04-19  4:36     ` Ju Hyung Park
2019-04-19  4:59       ` Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.