Skip to contentSkip to conversation

erofs-utils: add "noinline_data" extended option

PATCH New Gao Xiang 1 participant 1 message Jul 5, 2021 1 message not in the archive Library code

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): YOHlZpBbOZSiOFN%[email protected]

Gao Xiang

author
#1 lore raw

PATCH v2 1/1 erofs-utils: add "noinline_data" extended option

Don't inline regular files in order to add preliminary DAX feature support.

---
v2:
- update the prefix of the patch subject.

 include/erofs/config.h | 1 +
 lib/inode.c            | 5 +++++
 mkfs/main.c            | 6 ++++++
 3 files changed, 12 insertions(+)
include/erofs/config.h +1 -0
index 67e7a0fed24c..8124f3b36baf 100644
@@ -44,6 +44,7 @@ struct erofs_configure {
 	bool c_random_pclusterblks;
 #endif
 	char c_timeinherit;
+	bool c_noinline_data;
 
 #ifdef HAVE_LIBSELINUX
 	struct selabel_handle *sehnd;
lib/inode.c +5 -0
index 97f0cf763baf..38906370f533 100644
@@ -562,6 +562,11 @@ static int erofs_prepare_inode_buffer(struct erofs_inode *inode)
 	if (is_inode_layout_compression(inode))
 		goto noinline;
 
+	if (cfg.c_noinline_data && S_ISREG(inode->i_mode)) {
+		inode->datalayout = EROFS_INODE_FLAT_PLAIN;
+		goto noinline;
+	}
+
 	/*
 	 * if the file size is block-aligned for uncompressed files,
 	 * should use EROFS_INODE_FLAT_PLAIN data mapping mode.
mkfs/main.c +6 -0
index 28539da5ea5f..10fe14d7a722 100644
@@ -161,6 +161,12 @@ static int parse_extended_opts(const char *opts)
 				return -EINVAL;
 			erofs_sb_clear_sb_chksum();
 		}
+
+		if (MATCH_EXTENTED_OPT("noinline_data", token, keylen)) {
+			if (vallen)
+				return -EINVAL;
+			cfg.c_noinline_data = true;
+		}
 	}
 	return 0;
 }
Signature · 1 line
2.24.4