[PATCH] erofs-utils: mkfs: add ^{inline_data,ztailpacking,dedupe} options
Gao Xiang
hsiangkao at linux.alibaba.com
Mon Sep 11 17:18:19 AEST 2023
Later, some preset configurations will be added, which could enable
some of these features by default.
Let's add a way to turn each individual off too.
Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
include/erofs/config.h | 2 +-
lib/inode.c | 2 +-
mkfs/main.c | 13 ++++++++++---
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/include/erofs/config.h b/include/erofs/config.h
index dea5d74..e342722 100644
--- a/include/erofs/config.h
+++ b/include/erofs/config.h
@@ -45,7 +45,7 @@ struct erofs_configure {
#endif
char c_timeinherit;
char c_chunkbits;
- bool c_noinline_data;
+ bool c_inline_data;
bool c_ztailpacking;
bool c_fragments;
bool c_all_fragments;
diff --git a/lib/inode.c b/lib/inode.c
index d393602..3976c47 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -657,7 +657,7 @@ static int erofs_prepare_inode_buffer(struct erofs_inode *inode)
goto noinline;
if (!is_inode_layout_compression(inode)) {
- if (cfg.c_noinline_data && S_ISREG(inode->i_mode)) {
+ if (!cfg.c_inline_data && S_ISREG(inode->i_mode)) {
inode->datalayout = EROFS_INODE_FLAT_PLAIN;
goto noinline;
}
diff --git a/mkfs/main.c b/mkfs/main.c
index 8f34e57..ad0e320 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -214,7 +214,13 @@ static int parse_extended_opts(const char *opts)
if (MATCH_EXTENTED_OPT("noinline_data", token, keylen)) {
if (vallen)
return -EINVAL;
- cfg.c_noinline_data = true;
+ cfg.c_inline_data = false;
+ }
+
+ if (MATCH_EXTENTED_OPT("inline_data", token, keylen)) {
+ if (vallen)
+ return -EINVAL;
+ cfg.c_inline_data = !clear;
}
if (MATCH_EXTENTED_OPT("force-inode-blockmap", token, keylen)) {
@@ -232,7 +238,7 @@ static int parse_extended_opts(const char *opts)
if (MATCH_EXTENTED_OPT("ztailpacking", token, keylen)) {
if (vallen)
return -EINVAL;
- cfg.c_ztailpacking = true;
+ cfg.c_ztailpacking = !clear;
}
if (MATCH_EXTENTED_OPT("all-fragments", token, keylen)) {
@@ -260,7 +266,7 @@ handle_fragment:
if (MATCH_EXTENTED_OPT("dedupe", token, keylen)) {
if (vallen)
return -EINVAL;
- cfg.c_dedupe = true;
+ cfg.c_dedupe = !clear;
}
if (MATCH_EXTENTED_OPT("xattr-name-filter", token, keylen)) {
@@ -773,6 +779,7 @@ static void erofs_mkfs_default_options(void)
{
cfg.c_showprogress = true;
cfg.c_legacy_compress = false;
+ cfg.c_inline_data = true;
cfg.c_xattr_name_filter = true;
sbi.blkszbits = ilog2(min_t(u32, getpagesize(), EROFS_MAX_BLOCK_SIZE));
sbi.feature_incompat = EROFS_FEATURE_INCOMPAT_ZERO_PADDING;
--
2.39.3
More information about the Linux-erofs
mailing list