Skip to contentSkip to conversation

resize.f2fs: add option for large_nat_bitmap feature

PATCH Chao Yu 2 participants 4 messages Jan 9, 2020 – Jan 13, 2020 1 message not in the archive

lore
Share & tools
lore

Chao Yu

author
#1 lore raw
In reply to a message not in the archive
Quoted 5 lines · On 2020/1/8 19:20, Ping1 Xiong 熊平 wrote:

​From d5b8411dbae37180c37d96bf164fab16138fc21a Mon Sep 17 00:00:00 2001

From: xiongping1 <[email protected]>
Date: Wed, 8 Jan 2020 17:20:55 +0800
Subject: [PATCH] resize.f2fs: add option for large_nat_bitmap feature

Thanks for your contribution.

The patch format is incorrect, I guess it was changed by email client or when you paste patch's content, could you check it?

Quoted 5 lines

resize.f2fs has already supported large_nat_bitmap feature, but has no option to turn on it.

This change add a new '-i' option to control turning on/off it.

We only add a option to turn on this feature, right? rather than turning on or off it?

Thanks,

Quoted 61 lines

---
 fsck/main.c   | 6 +++++-
 fsck/resize.c | 5 +++++

 2 files changed, 10 insertions(+), 1 deletion(-)
fsck/main.c +2 -1
index 9a7d499..e7e3dfc 100644
@@ -104,6 +104,7 @@ void resize_usage()
          MSG(0, "\nUsage: resize.f2fs [options] device\n");
          MSG(0, "[options]:\n");
          MSG(0, "  -d debug level [default:0]\n");
+       MSG(0, "  -i extended node bitmap, node ratio is 20%% by default\n");
          MSG(0, "  -s safe resize (Does not resize metadata)");
          MSG(0, "  -t target sectors [default: device size]\n");
          MSG(0, "  -V print the version number and exit\n");
@@ -449,7 +450,7 @@ void f2fs_parse_options(int argc, char *argv[])
                                  break;
                  }
          } else if (!strcmp("resize.f2fs", prog)) {
-               const char *option_string = "d:st:V";
+               const char *option_string = "d:st:iV";


                 c.func = RESIZE;
                 while ((option = getopt(argc, argv, option_string)) != EOF) {

fsck/main.c +3 -0
@@ -476,6 +477,9 @@ void f2fs_parse_options(int argc, char *argv[])
                                          ret = sscanf(optarg, "%"PRIx64"",
                                                          &c.target_sectors);
                                  break;
+                       case 'i':
+                               c.large_nat_bitmap = 1;
+                               break;

                         case 'V':
                                 show_version(prog); exit(0);

fsck/resize.c +0 -0
index fc563f2..88e063e 100644
@@ -519,6 +519,11 @@ static void rebuild_checkpoint(struct f2fs_sb_info *sbi,

         else
                 set_cp(checksum_offset, CP_CHKSUM_OFFSET);

+       if (c.large_nat_bitmap) {
+               set_cp(checksum_offset, CP_MIN_CHKSUM_OFFSET); +               flags |= CP_LARGE_NAT_BITMAP_FLAG;
+       }
+
         set_cp(ckpt_flags, flags);

         memcpy(new_cp, cp, (unsigned char *)cp->sit_nat_version_bitmap - --
2.7.4

​

#/******本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件! This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!******/#

#2 lore raw
Quoted 4 lines · Chao Yu <[email protected]> 于2020年1月9日周四 下午3:16写道:
Quoted 2 lines · On 2020/1/8 19:20, Ping1 Xiong 熊平 wrote:

From d5b8411dbae37180c37d96bf164fab16138fc21a Mon Sep 17 00:00:00 2001

Quoted 9 lines
Quoted 3 lines

From: xiongping1 <[email protected]>
Date: Wed, 8 Jan 2020 17:20:55 +0800
Subject: [PATCH] resize.f2fs: add option for large_nat_bitmap feature

Thanks for your contribution.

The patch format is incorrect, I guess it was changed by email client or when you paste patch's content, could you check it?

I have resend the patch with this email account yesterday, can you check it?

Quoted 9 lines
Quoted 5 lines

resize.f2fs has already supported large_nat_bitmap feature, but has no option to turn on it.

This change add a new '-i' option to control turning on/off it.

We only add a option to turn on this feature, right? rather than turning on or off it?

yes, the feature is off by default, so we need an option to enable it.

Quoted 69 lines

Thanks,

Quoted 60 lines
---
 fsck/main.c   | 6 +++++-
 fsck/resize.c | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)
fsck/main.c +5 -1
index 9a7d499..e7e3dfc 100644
@@ -104,6 +104,7 @@ void resize_usage()
         MSG(0, "\nUsage: resize.f2fs [options] device\n");
         MSG(0, "[options]:\n");
         MSG(0, "  -d debug level [default:0]\n");
+       MSG(0, "  -i extended node bitmap, node ratio is 20%% by default\n");
         MSG(0, "  -s safe resize (Does not resize metadata)");
         MSG(0, "  -t target sectors [default: device size]\n");
         MSG(0, "  -V print the version number and exit\n");
@@ -449,7 +450,7 @@ void f2fs_parse_options(int argc, char *argv[])
                                 break;
                 }
         } else if (!strcmp("resize.f2fs", prog)) {
-               const char *option_string = "d:st:V";
+               const char *option_string = "d:st:iV";
 
                 c.func = RESIZE;
                 while ((option = getopt(argc, argv, option_string)) != EOF) {
@@ -476,6 +477,9 @@ void f2fs_parse_options(int argc, char *argv[])
                                         ret = sscanf(optarg, "%"PRIx64"",
                                                         &c.target_sectors);
                                 break;
+                       case 'i':
+                               c.large_nat_bitmap = 1;
+                               break;
                         case 'V':
                                 show_version(prog);
                                 exit(0);
fsck/resize.c +5 -1
index fc563f2..88e063e 100644
@@ -519,6 +519,11 @@ static void rebuild_checkpoint(struct f2fs_sb_info *sbi,
         else
                 set_cp(checksum_offset, CP_CHKSUM_OFFSET);
 
+       if (c.large_nat_bitmap) {
+               set_cp(checksum_offset, CP_MIN_CHKSUM_OFFSET);
+               flags |= CP_LARGE_NAT_BITMAP_FLAG;
+       }
+
         set_cp(ckpt_flags, flags);
 
         memcpy(new_cp, cp, (unsigned char *)cp->sit_nat_version_bitmap -
--

2.7.4

Quoted 1 line

#/******本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件! This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!******/#

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

author
#3 lore raw
Quoted 19 lines · xiong ping
Quoted 4 lines · Chao Yu <[email protected]> 于2020年1月9日周四 下午3:16写道:
Quoted 2 lines · On 2020/1/8 19:20, Ping1 Xiong 熊平 wrote:

From d5b8411dbae37180c37d96bf164fab16138fc21a Mon Sep 17 00:00:00 2001

Quoted 9 lines
Quoted 3 lines

From: xiongping1 <[email protected]>
Date: Wed, 8 Jan 2020 17:20:55 +0800
Subject: [PATCH] resize.f2fs: add option for large_nat_bitmap feature

Thanks for your contribution.

The patch format is incorrect, I guess it was changed by email client or when you paste patch's content, could you check it?

I have resend the patch with this email account yesterday, can you check it?

Quoted 4 lines
Quoted 4 lines

resize.f2fs has already supported large_nat_bitmap feature, but has no option to turn on it.

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

This change add a new '-i' option to control turning on/off it.

We only add a option to turn on this feature, right? rather than turning on or off it?

yes, the feature is off by default, so we need an option to enable it.

So, I meant it needs to adjust commit message from "turning on/off it" to "turning on it".

Quoted 48 lines
Quoted 48 lines

Thanks,

Quoted 46 lines
---
 fsck/main.c   | 6 +++++-
 fsck/resize.c | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)
fsck/main.c +5 -1
index 9a7d499..e7e3dfc 100644
@@ -104,6 +104,7 @@ void resize_usage()
         MSG(0, "\nUsage: resize.f2fs [options] device\n");
         MSG(0, "[options]:\n");
         MSG(0, "  -d debug level [default:0]\n");
+       MSG(0, "  -i extended node bitmap, node ratio is 20%% by default\n");
         MSG(0, "  -s safe resize (Does not resize metadata)");
         MSG(0, "  -t target sectors [default: device size]\n");
         MSG(0, "  -V print the version number and exit\n");
@@ -449,7 +450,7 @@ void f2fs_parse_options(int argc, char *argv[])
                                 break;
                 }
         } else if (!strcmp("resize.f2fs", prog)) {
-               const char *option_string = "d:st:V";
+               const char *option_string = "d:st:iV";
 
                 c.func = RESIZE;
                 while ((option = getopt(argc, argv, option_string)) != EOF) {
@@ -476,6 +477,9 @@ void f2fs_parse_options(int argc, char *argv[])
                                         ret = sscanf(optarg, "%"PRIx64"",
                                                         &c.target_sectors);
                                 break;
+                       case 'i':
+                               c.large_nat_bitmap = 1;
+                               break;
                         case 'V':
                                 show_version(prog);
                                 exit(0);
fsck/resize.c +0 -0
index fc563f2..88e063e 100644
@@ -519,6 +519,11 @@ static void rebuild_checkpoint(struct f2fs_sb_info *sbi,
         else
                 set_cp(checksum_offset, CP_CHKSUM_OFFSET);
 
Quoted 4 lines
Quoted 4 lines

fsck/resize.c static void rebuild_checkpoint(struct f2fs_sb_info *sbi, · line 525

Quoted 4 lines
fsck/resize.c +4 -0
+       if (c.large_nat_bitmap) {
+               set_cp(checksum_offset, CP_MIN_CHKSUM_OFFSET);
+               flags |= CP_LARGE_NAT_BITMAP_FLAG;
+       }

How about relocating above codes to below position:

	flags = update_nat_bits_flags(new_sb, cp, get_cp(ckpt_flags));

+ if (c.large_nat_bitmap)
+ flags |= CP_LARGE_NAT_BITMAP_FLAG;

	if (flags & CP_COMPACT_SUM_FLAG)
		flags &= ~CP_COMPACT_SUM_FLAG;

Thanks,

Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
fsck/resize.c +1 -1
+
         set_cp(ckpt_flags, flags);
 
         memcpy(new_cp, cp, (unsigned char *)cp->sit_nat_version_bitmap -
--

2.7.4

Quoted 7 lines
Quoted 1 line

#/******本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件! This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!******/#

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

.

#4 lore raw
Quoted 23 lines · Chao Yu <[email protected]> 于2020年1月11日周六 下午5:43写道:
Quoted 21 lines · xiong ping
Quoted 4 lines · Chao Yu <[email protected]> 于2020年1月9日周四 下午3:16写道:
Quoted 2 lines · On 2020/1/8 19:20, Ping1 Xiong 熊平 wrote:

From d5b8411dbae37180c37d96bf164fab16138fc21a Mon Sep 17 00:00:00 2001

Quoted 9 lines
Quoted 3 lines

From: xiongping1 <[email protected]>
Date: Wed, 8 Jan 2020 17:20:55 +0800
Subject: [PATCH] resize.f2fs: add option for large_nat_bitmap feature

Thanks for your contribution.

The patch format is incorrect, I guess it was changed by email client or when you paste patch's content, could you check it?

I have resend the patch with this email account yesterday, can you check it?

Quoted 6 lines
Quoted 5 lines

resize.f2fs has already supported large_nat_bitmap feature, but has no option to turn on it.

This change add a new '-i' option to control turning on/off it.

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

We only add a option to turn on this feature, right? rather than turning on or off it?

yes, the feature is off by default, so we need an option to enable it.

So, I meant it needs to adjust commit message from "turning on/off it" to "turning on it".

ok, will fix it in patch v2.

Quoted 58 lines
Quoted 48 lines
Quoted 48 lines

Thanks,

Quoted 46 lines
---
 fsck/main.c   | 6 +++++-
 fsck/resize.c | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)
fsck/main.c +5 -1
index 9a7d499..e7e3dfc 100644
@@ -104,6 +104,7 @@ void resize_usage()
         MSG(0, "\nUsage: resize.f2fs [options] device\n");
         MSG(0, "[options]:\n");
         MSG(0, "  -d debug level [default:0]\n");
+       MSG(0, "  -i extended node bitmap, node ratio is 20%% by default\n");
         MSG(0, "  -s safe resize (Does not resize metadata)");
         MSG(0, "  -t target sectors [default: device size]\n");
         MSG(0, "  -V print the version number and exit\n");
@@ -449,7 +450,7 @@ void f2fs_parse_options(int argc, char *argv[])
                                 break;
                 }
         } else if (!strcmp("resize.f2fs", prog)) {
-               const char *option_string = "d:st:V";
+               const char *option_string = "d:st:iV";
 
                 c.func = RESIZE;
                 while ((option = getopt(argc, argv, option_string)) != EOF) {
@@ -476,6 +477,9 @@ void f2fs_parse_options(int argc, char *argv[])
                                         ret = sscanf(optarg, "%"PRIx64"",
                                                         &c.target_sectors);
                                 break;
+                       case 'i':
+                               c.large_nat_bitmap = 1;
+                               break;
                         case 'V':
                                 show_version(prog);
                                 exit(0);
fsck/resize.c +0 -0
index fc563f2..88e063e 100644
@@ -519,6 +519,11 @@ static void rebuild_checkpoint(struct f2fs_sb_info *sbi,
         else
                 set_cp(checksum_offset, CP_CHKSUM_OFFSET);
 
Quoted 4 lines
Quoted 4 lines

fsck/resize.c static void rebuild_checkpoint(struct f2fs_sb_info *sbi, · line 525

Quoted 4 lines
fsck/resize.c +4 -0
+       if (c.large_nat_bitmap) {
+               set_cp(checksum_offset, CP_MIN_CHKSUM_OFFSET);
+               flags |= CP_LARGE_NAT_BITMAP_FLAG;
+       }

How about relocating above codes to below position:

        flags = update_nat_bits_flags(new_sb, cp, get_cp(ckpt_flags));

Review

Quoted 2 lines
(quoted diff) +2 -0
+       if (c.large_nat_bitmap)
+               flags |= CP_LARGE_NAT_BITMAP_FLAG;

ok, will fix it in patch v2.

Quoted 24 lines

if (flags & CP_COMPACT_SUM_FLAG)
flags &= ~CP_COMPACT_SUM_FLAG;

Thanks,

Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
fsck/resize.c +1 -1
+
         set_cp(ckpt_flags, flags);
 
         memcpy(new_cp, cp, (unsigned char *)cp->sit_nat_version_bitmap -
--

2.7.4

Quoted 7 lines
Quoted 1 line

#/******本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件! This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!******/#

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

.