f2fs-tools: disable nat_bits by default in Android
PATCH v2 1/1 f2fs-tools: disable nat_bits by default in Android
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 <[email protected]>
---
v2:
- fix to disable nat_bits feature in fsck tool.
fsck/main.c | 3 +++ fsck/mount.c | 3 ++- include/f2fs_fs.h | 6 ++++++ mkfs/f2fs_format.c | 3 ++- mkfs/f2fs_format_main.c | 1 + 5 files changed, 14 insertions(+), 2 deletions(-)
fsck/main.c +3 -0
@@ -219,6 +219,9 @@ static void __add_fsck_options(void) {/* -a */ c.auto_fix =1 ; + +/* disable nat_bits feature by default */ + c.disabled_feature |=F2FS_FEATURE_NAT_BITS ; }static void add_default_options (void )
fsck/mount.c +2 -1
@@ -1713,7 +1713,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 ) && +get_cp (cp_pack_total_block_count) <= (1 <<get_sb (log_blocks_per_seg)) - nat_bits_blocks) flags |=CP_NAT_BITS_FLAG ;else
include/f2fs_fs.h +6 -0
@@ -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;
mkfs/f2fs_format.c +2 -1
@@ -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 ;
mkfs/f2fs_format_main.c +1 -0
@@ -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 )
Signature · 8 lines
2.40.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel