All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH 1/3] dump.f2fs: support to dump hex of filename in dump_dirent()
@ 2025-03-31  3:00 Chao Yu via Linux-f2fs-devel
  2025-03-31  3:00 ` [f2fs-dev] [PATCH 2/3] dump.f2fs: print s_encoding_flags Chao Yu via Linux-f2fs-devel
  2025-03-31  3:00 ` [f2fs-dev] [PATCH 3/3] fsck.f2fs: support to tune linear lookup feature Chao Yu via Linux-f2fs-devel
  0 siblings, 2 replies; 4+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2025-03-31  3:00 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel

dump.f2fs -b $blkaddr -d 3 /dev/vda

[dump_dirent: 991] bitmap pos[0x2] name[❤️] len[0x6] hash[0x19dd7132] ino[0x5] type[0x1]
[dump_dirent: 998] name(hex)[0xe2 0x9d 0xa4 0xef 0xb8 0x8f 0x0]

Signed-off-by: Chao Yu <chao@kernel.org>
---
 fsck/dump.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fsck/dump.c b/fsck/dump.c
index dc3c199..66d6c79 100644
--- a/fsck/dump.c
+++ b/fsck/dump.c
@@ -937,7 +937,7 @@ static void dump_dirent(u32 blk_addr, int is_inline, int enc_name)
 {
 	struct f2fs_dentry_ptr d;
 	void *inline_dentry, *blk;
-	int ret, i = 0;
+	int ret, i = 0, j;
 
 	blk = calloc(F2FS_BLKSIZE, 1);
 	ASSERT(blk);
@@ -992,6 +992,11 @@ static void dump_dirent(u32 blk_addr, int is_inline, int enc_name)
 				le32_to_cpu(de->ino),
 				de->file_type);
 
+		DBG(1, "%s", "name(hex)[");
+		for (j = 0; j < F2FS_NAME_LEN && en[j]; j++)
+			MSG(1, "0x%x ", (unsigned char)en[j]);
+		MSG(1, "0x%x]\n", (unsigned char)en[j]);
+
 		i += GET_DENTRY_SLOTS(name_len);
 	}
 
-- 
2.49.0



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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [f2fs-dev] [PATCH 2/3] dump.f2fs: print s_encoding_flags
  2025-03-31  3:00 [f2fs-dev] [PATCH 1/3] dump.f2fs: support to dump hex of filename in dump_dirent() Chao Yu via Linux-f2fs-devel
@ 2025-03-31  3:00 ` Chao Yu via Linux-f2fs-devel
  2025-03-31  3:00 ` [f2fs-dev] [PATCH 3/3] fsck.f2fs: support to tune linear lookup feature Chao Yu via Linux-f2fs-devel
  1 sibling, 0 replies; 4+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2025-03-31  3:00 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel

It missed to print s_encoding_flags in print_raw_sb_info(), fix it.

Signed-off-by: Chao Yu <chao@kernel.org>
---
 fsck/mount.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fsck/mount.c b/fsck/mount.c
index 0b05f00..e7c4069 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -555,6 +555,7 @@ printout:
 	DISP_u32(sb, qf_ino[PRJQUOTA]);
 
 	DISP_u16(sb, s_encoding);
+	DISP_u16(sb, s_encoding_flags);
 	DISP_u32(sb, crc);
 
 	print_sb_debug_info(sb);
-- 
2.49.0



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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [f2fs-dev] [PATCH 3/3] fsck.f2fs: support to tune linear lookup feature
  2025-03-31  3:00 [f2fs-dev] [PATCH 1/3] dump.f2fs: support to dump hex of filename in dump_dirent() Chao Yu via Linux-f2fs-devel
  2025-03-31  3:00 ` [f2fs-dev] [PATCH 2/3] dump.f2fs: print s_encoding_flags Chao Yu via Linux-f2fs-devel
@ 2025-03-31  3:00 ` Chao Yu via Linux-f2fs-devel
  2025-04-04 19:17   ` Jaegeuk Kim via Linux-f2fs-devel
  1 sibling, 1 reply; 4+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2025-03-31  3:00 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel

Support a new option --nolinear-lookup=X for fsck.f2fs to tune
linear lookup fallback conditionally, X=1: disable linear lookup,
X=0: enable linear lookup.

This can help to 1) add a regression testcase to check kernel
whether linear lookup fallback has fixed unicode red heart lookup
issue, 2) once unicode bug has been fixed, we can use this option
to disable linear lookup for performance recovery.

Cc: Daniel Lee <chullee@google.com>
Signed-off-by: Chao Yu <chao@kernel.org>
---
 fsck/fsck.c       | 26 +++++++++++++++++++++++++-
 fsck/fsck.h       |  1 +
 fsck/main.c       | 10 ++++++++++
 include/f2fs_fs.h |  8 ++++++--
 4 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/fsck/fsck.c b/fsck/fsck.c
index 8155cbd..059ba61 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -2357,6 +2357,30 @@ int fsck_chk_quota_files(struct f2fs_sb_info *sbi)
 	return ret;
 }
 
+void fsck_update_sb_flags(struct f2fs_sb_info *sbi)
+{
+	struct f2fs_super_block *sb = F2FS_RAW_SUPER(sbi);
+	u16 flags = get_sb(s_encoding_flags);
+
+	if (c.nolinear_lookup) {
+		if (!(flags & F2FS_ENC_NO_COMPAT_FALLBACK_FL)) {
+			flags |= F2FS_ENC_NO_COMPAT_FALLBACK_FL;
+			set_sb(s_encoding_flags, flags);
+			c.fix_on = 1;
+			c.invalid_sb |= SB_ENCODE_FLAG;
+			DBG(0, "Casefold: enable nolinear lookup\n");
+		}
+	} else {
+		if (flags & F2FS_ENC_NO_COMPAT_FALLBACK_FL) {
+			flags &= ~F2FS_ENC_NO_COMPAT_FALLBACK_FL;
+			set_sb(s_encoding_flags, flags);
+			c.fix_on = 1;
+			c.invalid_sb |= SB_ENCODE_FLAG;
+			DBG(0, "Casefold: disable nolinear lookup\n");
+		}
+	}
+}
+
 int fsck_chk_meta(struct f2fs_sb_info *sbi)
 {
 	struct f2fs_fsck *fsck = F2FS_FSCK(sbi);
@@ -3770,7 +3794,7 @@ int fsck_verify(struct f2fs_sb_info *sbi)
 		if (c.invalid_sb & SB_FS_ERRORS)
 			memset(sb->s_errors, 0, MAX_F2FS_ERRORS);
 
-		if (c.invalid_sb & SB_NEED_FIX)
+		if (c.invalid_sb & (SB_NEED_FIX | SB_ENCODE_FLAG))
 			update_superblock(sb, SB_MASK_ALL);
 
 		/* to return FSCK_ERROR_CORRECTED */
diff --git a/fsck/fsck.h b/fsck/fsck.h
index b581d3e..40cb6d9 100644
--- a/fsck/fsck.h
+++ b/fsck/fsck.h
@@ -188,6 +188,7 @@ extern int fsck_chk_dentry_blk(struct f2fs_sb_info *, int,
 int fsck_chk_inline_dentries(struct f2fs_sb_info *, struct f2fs_node *,
 		struct child_info *);
 void fsck_chk_checkpoint(struct f2fs_sb_info *sbi);
+void fsck_update_sb_flags(struct f2fs_sb_info *sbi);
 int fsck_chk_meta(struct f2fs_sb_info *sbi);
 void fsck_chk_and_fix_write_pointers(struct f2fs_sb_info *);
 int fsck_chk_curseg_info(struct f2fs_sb_info *);
diff --git a/fsck/main.c b/fsck/main.c
index 47ba6c9..524dbb1 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -91,6 +91,7 @@ void fsck_usage()
 	MSG(0, "  --no-kernel-check skips detecting kernel change\n");
 	MSG(0, "  --kernel-check checks kernel change\n");
 	MSG(0, "  --debug-cache to debug cache when -c is used\n");
+	MSG(0, "  --nolinear-lookup=X X=1: disable linear lookup, X=0: enable linear lookup\n");
 	exit(1);
 }
 
@@ -263,6 +264,7 @@ void f2fs_parse_options(int argc, char *argv[])
 			{"no-kernel-check", no_argument, 0, 2},
 			{"kernel-check", no_argument, 0, 3},
 			{"debug-cache", no_argument, 0, 4},
+			{"nolinear-lookup", required_argument, 0, 5},
 			{0, 0, 0, 0}
 		};
 
@@ -287,6 +289,12 @@ void f2fs_parse_options(int argc, char *argv[])
 			case 4:
 				c.cache_config.dbg_en = true;
 				break;
+			case 5:
+				if (!optarg || !strcmp(optarg, "0"))
+					c.nolinear_lookup = 0;
+				else
+					c.nolinear_lookup = 1;
+				break;
 			case 'a':
 				c.auto_fix = 1;
 				MSG(0, "Info: Automatic fix mode enabled.\n");
@@ -990,6 +998,8 @@ static int do_fsck(struct f2fs_sb_info *sbi)
 			F2FS_FT_DIR, TYPE_INODE, &blk_cnt, &cbc, &child);
 	fsck_chk_quota_files(sbi);
 
+	fsck_update_sb_flags(sbi);
+
 	ret = fsck_verify(sbi);
 	fsck_free(sbi);
 
diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index bb40adc..d0eff91 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -682,7 +682,8 @@ enum {
 #define IS_DEVICE_ALIASING(fi)	((fi)->i_flags & cpu_to_le32(F2FS_DEVICE_ALIAS_FL))
 
 #define F2FS_ENC_UTF8_12_1	1
-#define F2FS_ENC_STRICT_MODE_FL	(1 << 0)
+#define F2FS_ENC_STRICT_MODE_FL		(1 << 0)
+#define F2FS_ENC_NO_COMPAT_FALLBACK_FL	(1 << 1)
 
 /* This flag is used by node and meta inodes, and by recovery */
 #define GFP_F2FS_ZERO	(GFP_NOFS | __GFP_ZERO)
@@ -1467,7 +1468,9 @@ enum {
 #define SB_ABNORMAL_STOP	0x2	/* s_stop_reason is set except shutdown */
 #define SB_FS_ERRORS		0x4	/* s_erros is set */
 #define SB_INVALID		0x8	/* sb is invalid */
-#define SB_NEED_FIX (SB_ABNORMAL_STOP | SB_FS_ERRORS | SB_INVALID)
+#define SB_ENCODE_FLAG		0x16	/* encode_flag */
+#define SB_NEED_FIX		(SB_ABNORMAL_STOP | SB_FS_ERRORS |	\
+				SB_INVALID | SB_ENCODE_FLAG)
 
 #define MAX_CACHE_SUMS			8
 
@@ -1541,6 +1544,7 @@ struct f2fs_configuration {
 	int preserve_limits;		/* preserve quota limits */
 	int large_nat_bitmap;
 	int fix_chksum;			/* fix old cp.chksum position */
+	int nolinear_lookup;		/* disable linear lookup */
 	unsigned int feature;			/* defined features */
 	unsigned int disabled_feature;	/* disabled feature, used for Android only */
 	unsigned int quota_bits;	/* quota bits */
-- 
2.49.0



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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [f2fs-dev] [PATCH 3/3] fsck.f2fs: support to tune linear lookup feature
  2025-03-31  3:00 ` [f2fs-dev] [PATCH 3/3] fsck.f2fs: support to tune linear lookup feature Chao Yu via Linux-f2fs-devel
@ 2025-04-04 19:17   ` Jaegeuk Kim via Linux-f2fs-devel
  0 siblings, 0 replies; 4+ messages in thread
From: Jaegeuk Kim via Linux-f2fs-devel @ 2025-04-04 19:17 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-f2fs-devel

Can we also update man page?

On 03/31, Chao Yu wrote:
> Support a new option --nolinear-lookup=X for fsck.f2fs to tune
> linear lookup fallback conditionally, X=1: disable linear lookup,
> X=0: enable linear lookup.
> 
> This can help to 1) add a regression testcase to check kernel
> whether linear lookup fallback has fixed unicode red heart lookup
> issue, 2) once unicode bug has been fixed, we can use this option
> to disable linear lookup for performance recovery.
> 
> Cc: Daniel Lee <chullee@google.com>
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
>  fsck/fsck.c       | 26 +++++++++++++++++++++++++-
>  fsck/fsck.h       |  1 +
>  fsck/main.c       | 10 ++++++++++
>  include/f2fs_fs.h |  8 ++++++--
>  4 files changed, 42 insertions(+), 3 deletions(-)
> 
> diff --git a/fsck/fsck.c b/fsck/fsck.c
> index 8155cbd..059ba61 100644
> --- a/fsck/fsck.c
> +++ b/fsck/fsck.c
> @@ -2357,6 +2357,30 @@ int fsck_chk_quota_files(struct f2fs_sb_info *sbi)
>  	return ret;
>  }
>  
> +void fsck_update_sb_flags(struct f2fs_sb_info *sbi)
> +{
> +	struct f2fs_super_block *sb = F2FS_RAW_SUPER(sbi);
> +	u16 flags = get_sb(s_encoding_flags);
> +
> +	if (c.nolinear_lookup) {
> +		if (!(flags & F2FS_ENC_NO_COMPAT_FALLBACK_FL)) {
> +			flags |= F2FS_ENC_NO_COMPAT_FALLBACK_FL;
> +			set_sb(s_encoding_flags, flags);
> +			c.fix_on = 1;
> +			c.invalid_sb |= SB_ENCODE_FLAG;
> +			DBG(0, "Casefold: enable nolinear lookup\n");
> +		}
> +	} else {
> +		if (flags & F2FS_ENC_NO_COMPAT_FALLBACK_FL) {
> +			flags &= ~F2FS_ENC_NO_COMPAT_FALLBACK_FL;
> +			set_sb(s_encoding_flags, flags);
> +			c.fix_on = 1;
> +			c.invalid_sb |= SB_ENCODE_FLAG;
> +			DBG(0, "Casefold: disable nolinear lookup\n");
> +		}
> +	}
> +}
> +
>  int fsck_chk_meta(struct f2fs_sb_info *sbi)
>  {
>  	struct f2fs_fsck *fsck = F2FS_FSCK(sbi);
> @@ -3770,7 +3794,7 @@ int fsck_verify(struct f2fs_sb_info *sbi)
>  		if (c.invalid_sb & SB_FS_ERRORS)
>  			memset(sb->s_errors, 0, MAX_F2FS_ERRORS);
>  
> -		if (c.invalid_sb & SB_NEED_FIX)
> +		if (c.invalid_sb & (SB_NEED_FIX | SB_ENCODE_FLAG))
>  			update_superblock(sb, SB_MASK_ALL);
>  
>  		/* to return FSCK_ERROR_CORRECTED */
> diff --git a/fsck/fsck.h b/fsck/fsck.h
> index b581d3e..40cb6d9 100644
> --- a/fsck/fsck.h
> +++ b/fsck/fsck.h
> @@ -188,6 +188,7 @@ extern int fsck_chk_dentry_blk(struct f2fs_sb_info *, int,
>  int fsck_chk_inline_dentries(struct f2fs_sb_info *, struct f2fs_node *,
>  		struct child_info *);
>  void fsck_chk_checkpoint(struct f2fs_sb_info *sbi);
> +void fsck_update_sb_flags(struct f2fs_sb_info *sbi);
>  int fsck_chk_meta(struct f2fs_sb_info *sbi);
>  void fsck_chk_and_fix_write_pointers(struct f2fs_sb_info *);
>  int fsck_chk_curseg_info(struct f2fs_sb_info *);
> diff --git a/fsck/main.c b/fsck/main.c
> index 47ba6c9..524dbb1 100644
> --- a/fsck/main.c
> +++ b/fsck/main.c
> @@ -91,6 +91,7 @@ void fsck_usage()
>  	MSG(0, "  --no-kernel-check skips detecting kernel change\n");
>  	MSG(0, "  --kernel-check checks kernel change\n");
>  	MSG(0, "  --debug-cache to debug cache when -c is used\n");
> +	MSG(0, "  --nolinear-lookup=X X=1: disable linear lookup, X=0: enable linear lookup\n");
>  	exit(1);
>  }
>  
> @@ -263,6 +264,7 @@ void f2fs_parse_options(int argc, char *argv[])
>  			{"no-kernel-check", no_argument, 0, 2},
>  			{"kernel-check", no_argument, 0, 3},
>  			{"debug-cache", no_argument, 0, 4},
> +			{"nolinear-lookup", required_argument, 0, 5},
>  			{0, 0, 0, 0}
>  		};
>  
> @@ -287,6 +289,12 @@ void f2fs_parse_options(int argc, char *argv[])
>  			case 4:
>  				c.cache_config.dbg_en = true;
>  				break;
> +			case 5:
> +				if (!optarg || !strcmp(optarg, "0"))
> +					c.nolinear_lookup = 0;
> +				else
> +					c.nolinear_lookup = 1;
> +				break;
>  			case 'a':
>  				c.auto_fix = 1;
>  				MSG(0, "Info: Automatic fix mode enabled.\n");
> @@ -990,6 +998,8 @@ static int do_fsck(struct f2fs_sb_info *sbi)
>  			F2FS_FT_DIR, TYPE_INODE, &blk_cnt, &cbc, &child);
>  	fsck_chk_quota_files(sbi);
>  
> +	fsck_update_sb_flags(sbi);
> +
>  	ret = fsck_verify(sbi);
>  	fsck_free(sbi);
>  
> diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
> index bb40adc..d0eff91 100644
> --- a/include/f2fs_fs.h
> +++ b/include/f2fs_fs.h
> @@ -682,7 +682,8 @@ enum {
>  #define IS_DEVICE_ALIASING(fi)	((fi)->i_flags & cpu_to_le32(F2FS_DEVICE_ALIAS_FL))
>  
>  #define F2FS_ENC_UTF8_12_1	1
> -#define F2FS_ENC_STRICT_MODE_FL	(1 << 0)
> +#define F2FS_ENC_STRICT_MODE_FL		(1 << 0)
> +#define F2FS_ENC_NO_COMPAT_FALLBACK_FL	(1 << 1)
>  
>  /* This flag is used by node and meta inodes, and by recovery */
>  #define GFP_F2FS_ZERO	(GFP_NOFS | __GFP_ZERO)
> @@ -1467,7 +1468,9 @@ enum {
>  #define SB_ABNORMAL_STOP	0x2	/* s_stop_reason is set except shutdown */
>  #define SB_FS_ERRORS		0x4	/* s_erros is set */
>  #define SB_INVALID		0x8	/* sb is invalid */
> -#define SB_NEED_FIX (SB_ABNORMAL_STOP | SB_FS_ERRORS | SB_INVALID)
> +#define SB_ENCODE_FLAG		0x16	/* encode_flag */
> +#define SB_NEED_FIX		(SB_ABNORMAL_STOP | SB_FS_ERRORS |	\
> +				SB_INVALID | SB_ENCODE_FLAG)
>  
>  #define MAX_CACHE_SUMS			8
>  
> @@ -1541,6 +1544,7 @@ struct f2fs_configuration {
>  	int preserve_limits;		/* preserve quota limits */
>  	int large_nat_bitmap;
>  	int fix_chksum;			/* fix old cp.chksum position */
> +	int nolinear_lookup;		/* disable linear lookup */
>  	unsigned int feature;			/* defined features */
>  	unsigned int disabled_feature;	/* disabled feature, used for Android only */
>  	unsigned int quota_bits;	/* quota bits */
> -- 
> 2.49.0


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-04-04 19:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-31  3:00 [f2fs-dev] [PATCH 1/3] dump.f2fs: support to dump hex of filename in dump_dirent() Chao Yu via Linux-f2fs-devel
2025-03-31  3:00 ` [f2fs-dev] [PATCH 2/3] dump.f2fs: print s_encoding_flags Chao Yu via Linux-f2fs-devel
2025-03-31  3:00 ` [f2fs-dev] [PATCH 3/3] fsck.f2fs: support to tune linear lookup feature Chao Yu via Linux-f2fs-devel
2025-04-04 19:17   ` Jaegeuk Kim via Linux-f2fs-devel

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.