All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: Chao Yu <chao@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs-tools: disable nat_bits by default in Android
Date: Fri, 7 Mar 2025 00:49:52 +0000	[thread overview]
Message-ID: <Z8pCsM6arGKb75bX@google.com> (raw)
In-Reply-To: <20250305110506.2113560-1-chao@kernel.org>

On 03/05, Chao Yu wrote:
> This patch turns off nat_bits feature by default in Android,
> for other scenario, keep it on and keep an eye on it.
> 
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
>  fsck/mount.c            | 3 ++-
>  include/f2fs_fs.h       | 6 ++++++
>  mkfs/f2fs_format.c      | 3 ++-
>  mkfs/f2fs_format_main.c | 1 +
>  4 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/fsck/mount.c b/fsck/mount.c
> index a189ba7..2f4c631 100644
> --- a/fsck/mount.c
> +++ b/fsck/mount.c
> @@ -1708,7 +1708,8 @@ u32 update_nat_bits_flags(struct f2fs_super_block *sb,
>  	nat_bits_bytes = get_sb(segment_count_nat) << 5;
>  	nat_bits_blocks = F2FS_BYTES_TO_BLK((nat_bits_bytes << 1) + 8 +
>  						F2FS_BLKSIZE - 1);
> -	if (get_cp(cp_pack_total_block_count) <=
> +	if (!(c.disabled_feature & F2FS_FEATURE_NAT_BITS) &&

We need to set c.diabled_feature |= F2FS_FEATURE_NAT_BITS in fsck and others?

> +			get_cp(cp_pack_total_block_count) <=
>  			(1 << get_sb(log_blocks_per_seg)) - nat_bits_blocks)
>  		flags |= CP_NAT_BITS_FLAG;
>  	else
> diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
> index 0cb9228..bb40adc 100644
> --- a/include/f2fs_fs.h
> +++ b/include/f2fs_fs.h
> @@ -1471,6 +1471,11 @@ enum {
>  
>  #define MAX_CACHE_SUMS			8
>  
> +/* feature list in Android */
> +enum {
> +	F2FS_FEATURE_NAT_BITS = 0x0001,
> +};
> +
>  struct f2fs_configuration {
>  	uint32_t conf_reserved_sections;
>  	uint32_t reserved_segments;
> @@ -1537,6 +1542,7 @@ struct f2fs_configuration {
>  	int large_nat_bitmap;
>  	int fix_chksum;			/* fix old cp.chksum position */
>  	unsigned int feature;			/* defined features */
> +	unsigned int disabled_feature;	/* disabled feature, used for Android only */
>  	unsigned int quota_bits;	/* quota bits */
>  	time_t fixed_time;
>  	int roll_forward;
> diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
> index 6635eed..c28ebb0 100644
> --- a/mkfs/f2fs_format.c
> +++ b/mkfs/f2fs_format.c
> @@ -893,7 +893,8 @@ static int f2fs_write_check_point_pack(void)
>  	/* cp page (2), data summaries (1), node summaries (3) */
>  	set_cp(cp_pack_total_block_count, 6 + get_sb(cp_payload));
>  	flags = CP_UMOUNT_FLAG | CP_COMPACT_SUM_FLAG;
> -	if (get_cp(cp_pack_total_block_count) <=
> +	if (!(c.disabled_feature & F2FS_FEATURE_NAT_BITS) &&
> +			get_cp(cp_pack_total_block_count) <=
>  			(1 << get_sb(log_blocks_per_seg)) - nat_bits_blocks)
>  		flags |= CP_NAT_BITS_FLAG;
>  
> diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_main.c
> index 9407f5b..5b4569d 100644
> --- a/mkfs/f2fs_format_main.c
> +++ b/mkfs/f2fs_format_main.c
> @@ -143,6 +143,7 @@ static void add_default_options(void)
>  		force_overwrite = 1;
>  		c.wanted_sector_size = F2FS_BLKSIZE;
>  		c.root_uid = c.root_gid = 0;
> +		c.disabled_feature |= F2FS_FEATURE_NAT_BITS;
>  
>  		/* RO doesn't need any other features */
>  		if (c.feature & F2FS_FEATURE_RO)
> -- 
> 2.48.1


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

      reply	other threads:[~2025-03-07  0:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-05 11:05 [f2fs-dev] [PATCH] f2fs-tools: disable nat_bits by default in Android Chao Yu via Linux-f2fs-devel
2025-03-07  0:49 ` Jaegeuk Kim via Linux-f2fs-devel [this message]

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=Z8pCsM6arGKb75bX@google.com \
    --to=linux-f2fs-devel@lists.sourceforge.net \
    --cc=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    /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 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.