Skip to contentSkip to conversation

mkfs.f2fs: support hot file extension

PATCH Superseded Chao Yu 1 participant 1 message Mar 1, 2018

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH v2 1/2 mkfs.f2fs: support hot file extension

This patch adds new option '-E' to accept user configured hot file extension, in order to let kernel module handle hot/cold file's datas separately better.

---
v2: fix to add missing f2fs_super_block layout modification.

 include/f2fs_fs.h       |  5 +--
 mkfs/f2fs_format.c      | 83 +++++++++++++++++++++++++++++++++----------------
 mkfs/f2fs_format_main.c | 16 +++++++---
 3 files changed, 70 insertions(+), 34 deletions(-)
include/f2fs_fs.h +3 -2
index ca4522d54de2..be0a2da8f950 100644
@@ -347,7 +347,7 @@ struct f2fs_configuration {
 	int32_t dump_fd;
 	struct device_info devices[MAX_DEVICES];
 	int ndevs;
-	char *extension_list;
+	char *extension_list[2];
 	const char *rootdev_name;
 	int dbg_lv;
 	int show_dentry;
@@ -614,7 +614,8 @@ struct f2fs_super_block {
 	__u8 encrypt_pw_salt[16];	/* Salt used for string2key algorithm */
 	struct f2fs_device devs[MAX_DEVICES];	/* device list */
 	__le32 qf_ino[F2FS_MAX_QUOTAS];	/* quota inode numbers */
-	__u8 reserved[315];		/* valid reserved region */
+	__u8 hot_ext_count;		/* # of hot file extension */
+	__u8 reserved[314];		/* valid reserved region */
 } __attribute__((packed));
 
 /*
mkfs/f2fs_format.c +56 -27

106 lines not on this page · raw message

mkfs/f2fs_format_main.c +11 -5
index 120eeba91007..4a52a24cd297 100644
@@ -44,7 +44,8 @@ static void mkfs_usage()
 	MSG(0, "  -a heap-based allocation [default:0]\n");
 	MSG(0, "  -c [device path] up to 7 devices excepts meta device\n");
 	MSG(0, "  -d debug level [default:0]\n");
-	MSG(0, "  -e [extension list] e.g. \"mp3,gif,mov\"\n");
+	MSG(0, "  -e [cold file ext list] e.g. \"mp3,gif,mov\"\n");
+	MSG(0, "  -E [hot file ext list] e.g. \"db\"\n");
 	MSG(0, "  -f force overwrite the exist filesystem\n");
 	MSG(0, "  -i extended node bitmap, node ratio is 20%% by default\n");
 	MSG(0, "  -l label\n");
@@ -69,8 +70,10 @@ static void f2fs_show_info()
 		MSG(0, "Info: Disable heap-based policy\n");
 
 	MSG(0, "Info: Debug level = %d\n", c.dbg_lv);
-	if (c.extension_list)
-		MSG(0, "Info: Add new extension list\n");
+	if (c.extension_list[0])
+		MSG(0, "Info: Add new cold file extension list\n");
+	if (c.extension_list[1])
+		MSG(0, "Info: Add new hot file extension list\n");
 
 	if (c.vol_label)
 		MSG(0, "Info: Label = %s\n", c.vol_label);
@@ -103,7 +106,7 @@ static void parse_feature(const char *features)
 
 static void f2fs_parse_options(int argc, char *argv[])
 {
-	static const char *option_string = "qa:c:d:e:il:mo:O:s:S:z:t:f";
+	static const char *option_string = "qa:c:d:e:E:il:mo:O:s:S:z:t:f";
 	int32_t option=0;
 
 	while ((option = getopt(argc,argv,option_string)) != EOF) {
@@ -131,7 +134,10 @@ static void f2fs_parse_options(int argc, char *argv[])
 			c.dbg_lv = atoi(optarg);
 			break;
 		case 'e':
-			c.extension_list = strdup(optarg);
+			c.extension_list[0] = strdup(optarg);
+			break;
+		case 'E':
+			c.extension_list[1] = strdup(optarg);
 			break;
 		case 'i':
 			c.large_nat_bitmap = 1;
Signature · 1 line
2.15.0.55.gc2ece9dc4de6