Re: [f2fs-dev][PATCH] resize.f2fs: add option for large_nat_bitmap feature
From: Chao Yu
Date: Thu Jan 09 2020 - 02:14:31 EST
On 2020/1/8 19:20, Ping1 Xiong çå wrote:
> âFrom d5b8411dbae37180c37d96bf164fab16138fc21a Mon Sep 17 00:00:00 2001
>
> From: xiongping1 <xiongping1@xxxxxxxxxx>
> 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?
>
> 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,
>
> Signed-off-by: xiongping1 <xiongping1@xxxxxxxxxx>
> ---
> Â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
>
> â
>
>
> #/******æéäååéäåæåçååçäåäæïäéäåéçäéååäååçääæççãçæääåäääääååäçïåæääéäåéæéååæéãååãææåïæéääçäæãåææéæäæéäïèæçåçèæéäéçåääååéæéäï 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!******/#