Skip to contentSkip to conversation

mkfs.f2fs: support hot file extension

PATCH Superseded Chao Yu 1 participant 2 messages Feb 28, 2018

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 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.

---
 include/f2fs_fs.h       |  2 +-
 mkfs/f2fs_format.c      | 83 +++++++++++++++++++++++++++++++++----------------
 mkfs/f2fs_format_main.c | 16 +++++++---
 3 files changed, 68 insertions(+), 33 deletions(-)
include/f2fs_fs.h +1 -1
index 9968c917afcc..0e21d1ec53e5 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;
mkfs/f2fs_format.c +56 -27

106 lines not on this page · raw message

mkfs/f2fs_format_main.c +11 -5
index 46a6335e833e..c051ba2f20b3 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);
@@ -109,7 +112,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) {
@@ -137,7 +140,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':
 			MSG(0, "Warning: extend node bitmap feature needs 4.16+ kernel support\n");
Signature · 6 lines
2.15.0.55.gc2ece9dc4de6


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
author
#1 lore raw

PATCH 2/2 mkfs.f2fs: treat db's data as hot one

DB files like .db, .db-journal, .db-wal, .db-shm are very active, this patch adds db file type to hot file extension list by default.

---
 mkfs/f2fs_format.c | 1 +
 1 file changed, 1 insertion(+)
mkfs/f2fs_format.c +1 -0
index 3fc2f05437dd..f4a1b08789c1 100644
@@ -69,6 +69,7 @@ const char *media_ext_lists[] = {
 };
 
 const char *hot_ext_lists[] = {
+	"db",
 	NULL
 };
 
Signature · 1 line
2.15.0.55.gc2ece9dc4de6