linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ping xiong <xp1982.06.06@gmail.com>
To: yuchao0@huawei.com
Cc: jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, xiongping1 <xiongping1@xiaomi.com>
Subject: [f2fs-dev][PATCH] resize.f2fs: add option for large_nat_bitmap feature
Date: Thu,  9 Jan 2020 17:32:29 +0800	[thread overview]
Message-ID: <1578562349-842-1-git-send-email-xp1982.06.06@gmail.com> (raw)

From: xiongping1 <xiongping1@xiaomi.com>

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.

Signed-off-by: xiongping1 <xiongping1@xiaomi.com>
---
 fsck/main.c   | 6 +++++-
 fsck/resize.c | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/fsck/main.c b/fsck/main.c
index 9a7d499..e7e3dfc 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -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);
diff --git a/fsck/resize.c b/fsck/resize.c
index fc563f2..88e063e 100644
--- a/fsck/resize.c
+++ b/fsck/resize.c
@@ -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


             reply	other threads:[~2020-01-09  9:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-09  9:32 ping xiong [this message]
     [not found] <1578482416650.67283@xiaomi.com>
2020-01-09  7:14 ` [f2fs-dev][PATCH] resize.f2fs: add option for large_nat_bitmap feature Chao Yu
2020-01-10  9:58   ` [f2fs-dev] [PATCH] " xiong ping
2020-01-11  9:43     ` Chao Yu
2020-01-13  6:50       ` xiong ping

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1578562349-842-1-git-send-email-xp1982.06.06@gmail.com \
    --to=xp1982.06.06@gmail.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiongping1@xiaomi.com \
    --cc=yuchao0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).