Skip to contentSkip to conversation

f2fs_io: support F2FS_NOLINEAR_LOOKUP_FLAG

PATCH New Chao Yu via Linux-f2fs-devel 1 participant 1 message Mar 3, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs_io: support F2FS_NOLINEAR_LOOKUP_FLAG

Support F2FS_NOLINEAR_LOOKUP_FLAG in f2fs_io {get,set,clear}flags.

---
 man/f2fs_io.8           |  4 ++--
 tools/f2fs_io/f2fs_io.c | 19 ++++++++++++++++---
 tools/f2fs_io/f2fs_io.h |  5 +++++
 3 files changed, 23 insertions(+), 5 deletions(-)
man/f2fs_io.8 +2 -2
index 2ff22f7..97a893b 100644
@@ -22,11 +22,11 @@ Get the flags associated with the specified file.
 .TP
 \fBsetflags\fR \fI[flag] [file]\fR
 Set an f2fs file on specified file.  The flag can be casefold,
-compression, nocompression, immutable, and nocow.
+compression, nocompression, immutable, nocow, and nolinear_lookup.
 .TP
 \fBclearflags\fR \fI[flag] [file]\fR
 Clear the specified flag on the target file, which can be compression,
- nocompression, immutable, and nocow.
+ nocompression, immutable, nocow, and nolinear_lookup.
 .TP
 \fBshutdown\fR \fIshutdown filesystem\fR
 Freeze and stop all IOs for the file system mounted on
tools/f2fs_io/f2fs_io.c +16 -3
index fa01f8f..c0c54e2 100644
@@ -240,7 +240,8 @@ static void do_set_verity(int argc, char **argv, const struct cmd_desc *cmd)
 "  casefold\n"							\
 "  compression\n"						\
 "  nocompression\n"						\
-"  immutable\n"
+"  immutable\n"							\
+"  nolinear_lookup\n"
 
 static void do_getflags(int argc, char **argv, const struct cmd_desc *cmd)
 {
@@ -304,6 +305,12 @@ static void do_getflags(int argc, char **argv, const struct cmd_desc *cmd)
 		printf("immutable");
 		exist = 1;
 	}
+	if (flag & F2FS_NOLINEAR_LOOKUP_FLAG) {
+		if (exist)
+			printf(",");
+		printf("nolinear_lookup");
+		exist = 1;
+	}
 	if (!exist)
 		printf("none");
 	printf("\n");
@@ -319,7 +326,8 @@ static void do_getflags(int argc, char **argv, const struct cmd_desc *cmd)
 "  compression\n"						\
 "  nocompression\n"						\
 "  immutable\n"							\
-"  nocow\n"
+"  nocow\n"							\
+"  nolinear_lookup\n"
 
 static void do_setflags(int argc, char **argv, const struct cmd_desc *cmd)
 {
@@ -349,6 +357,8 @@ static void do_setflags(int argc, char **argv, const struct cmd_desc *cmd)
 		flag |= FS_IMMUTABLE_FL;
 	else if (!strcmp(argv[1], "nocow"))
 		flag |= FS_NOCOW_FL;
+	else if (!strcmp(argv[1], "nolinear_lookup"))
+		flag |= F2FS_NOLINEAR_LOOKUP_FLAG;
 
 	ret = ioctl(fd, F2FS_IOC_SETFLAGS, &flag);
 	printf("set a flag on %s ret=%d, flags=%s\n", argv[2], ret, argv[1]);
@@ -363,7 +373,8 @@ static void do_setflags(int argc, char **argv, const struct cmd_desc *cmd)
 "  compression\n"						\
 "  nocompression\n"						\
 "  immutable\n"							\
-"  nocow\n"
+"  nocow\n"							\
+"  nolinear_lookup\n"
 
 static void do_clearflags(int argc, char **argv, const struct cmd_desc *cmd)
 {
@@ -391,6 +402,8 @@ static void do_clearflags(int argc, char **argv, const struct cmd_desc *cmd)
 		flag &= ~FS_IMMUTABLE_FL;
 	else if (!strcmp(argv[1], "nocow"))
 		flag &= ~FS_NOCOW_FL;
+	else if (!strcmp(argv[1], "nolinear_lookup"))
+		flag &= ~F2FS_NOLINEAR_LOOKUP_FLAG;
 
 	ret = ioctl(fd, F2FS_IOC_SETFLAGS, &flag);
 	printf("clear a flag on %s ret=%d, flags=%s\n", argv[2], ret, argv[1]);
tools/f2fs_io/f2fs_io.h +5 -0
index 14c9dc1..c32def7 100644
@@ -246,3 +246,8 @@ struct f2fs_comp_option {
 	u8 algorithm;
 	u8 log_cluster_size;
 };
+
+/* for F2FS_IOC_{GET,SET,CLEAR}_FLAGS_EX */
+enum {
+	F2FS_NOLINEAR_LOOKUP_FLAG = 0x08000000,
+};
Signature · 8 lines
2.48.1



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel