erofs-utils: mkfs: correct sb_size if metabox is on
PATCH 1/2 erofs-utils: mkfs: correct sb_size if metabox is on
Fixes 4f7aa6b8fb7f ("erofs-utils: lib: introduce API helpers to prepare mkfs context")
Signed-off-by Gao Xiang <[email protected]>
--- lib/importer.c | 10 ++++------ lib/metabox.c | 4 +++- mkfs/main.c | 1 + 3 files changed, 8 insertions(+), 7 deletions(-)
lib/importer.c +4 -6
@@ -55,12 +55,10 @@ int erofs_importer_init(struct erofs_importer *im) goto out_err; } -if (cfg.c_mkfs_pclustersize_metabox >=0 ) { - subsys ="metabox" ; - err =erofs_metabox_init (sbi); -if (err) - goto out_err; - } + subsys ="metabox" ; + err =erofs_metabox_init (sbi); +if (err) + goto out_err;if (cfg.c_fragments) { subsys ="dedupe_ext" ;
lib/metabox.c +3 -1
@@ -30,6 +30,9 @@ int erofs_metabox_init(struct erofs_sb_info *sbi)struct erofs_metaboxmgr *m2gr;int ret; +if (!erofs_sb_has_metabox (sbi)) +return 0 ; + m2gr =malloc (sizeof (*m2gr));if (!m2gr)return -ENOMEM ;
@@ -41,7 +44,6 @@ int erofs_metabox_init(struct erofs_sb_info *sbi) m2gr->vf = (struct erofs_vfile ){ .fd = ret }; m2gr->bmgr =erofs_buffer_init (sbi,0 , &m2gr->vf);if (m2gr->bmgr) { -erofs_sb_set_metabox (sbi); sbi->m2gr = m2gr;return 0 ; }
mkfs/main.c +1 -0
@@ -1444,6 +1444,7 @@ static int mkfs_parse_options_cfg(struct erofs_importer_params *params, } cfg.c_mkfs_pclustersize_metabox = pclustersize_metabox; cfg.c_mkfs_metabox_algid = metabox_algorithmid; +erofs_sb_set_metabox (&g_sbi); }if (has_timestamp && cfg.c_timeinherit ==TIMESTAMP_UNSPECIFIED )
Signature · 1 line
2.43.5
PATCH 2/2 erofs-utils: mkfs: fix location of xattr long prefixes
Previously, xattr long prefixes were always kept in packed_inode by mkfs.erofs [1], even when the fragments feature could be avoided.
This is messy, so let's fix the placement as follows:
COMPAT_PLAIN_XATTR_PFX is not set:
- If INCOMPAT_METABOX is set, place long prefixes into metabox_inode
(since it should be treated as metadata);
- If INCOMPAT_FRAGMENTS is set, place long prefixes into packed_inode
(for compatibility only);
Otherwise, always place long prefixes directly on disk.
[1] ff160922e94a ("erofs-utils: introduce on-disk format for long xattr name prefixes")
Signed-off-by Gao Xiang <[email protected]>
--- include/erofs/internal.h | 1 + include/erofs/xattr.h | 2 +- include/erofs_fs.h | 1 + lib/xattr.c | 71 +++++++++++++++++++++++++++++++--------- mkfs/main.c | 7 +++- 5 files changed, 65 insertions(+), 17 deletions(-)
include/erofs/internal.h +1 -0
@@ -186,6 +186,7 @@ EROFS_FEATURE_FUNCS(48bit, incompat, INCOMPAT_48BIT) EROFS_FEATURE_FUNCS(metabox, incompat, INCOMPAT_METABOX) EROFS_FEATURE_FUNCS(sb_chksum, compat, COMPAT_SB_CHKSUM) EROFS_FEATURE_FUNCS(xattr_filter, compat, COMPAT_XATTR_FILTER) +EROFS_FEATURE_FUNCS(plain_xattr_pfx, compat, COMPAT_PLAIN_XATTR_PFX)#define EROFS_I_EA_INITED_BIT 0#define EROFS_I_Z_INITED_BIT 1
include/erofs/xattr.h +1 -1
@@ -50,7 +50,7 @@ int erofs_build_shared_xattrs_from_path(struct erofs_sb_info *sbi, const char *pint erofs_xattr_insert_name_prefix (const char *prefix);void erofs_xattr_cleanup_name_prefixes (void ); -int erofs_xattr_flush_name_prefixes (struct erofs_sb_info *sbi); +int erofs_xattr_flush_name_prefixes (struct erofs_sb_info *sbi,bool plain);void erofs_xattr_prefixes_cleanup (struct erofs_sb_info *sbi);int erofs_xattr_prefixes_init (struct erofs_sb_info *sbi);
include/erofs_fs.h +1 -0
@@ -16,6 +16,7 @@#define EROFS_FEATURE_COMPAT_SB_CHKSUM 0x00000001#define EROFS_FEATURE_COMPAT_MTIME 0x00000002#define EROFS_FEATURE_COMPAT_XATTR_FILTER 0x00000004 +#define EROFS_FEATURE_COMPAT_PLAIN_XATTR_PFX 0x00000010/* * Any bits that aren't in EROFS_ALL_FEATURE_INCOMPAT should
lib/xattr.c +56 -15
116 lines not on this page · raw message
mkfs/main.c +6 -1
@@ -415,6 +415,7 @@ static struct { };static bool mkfs_no_datainline; +static bool mkfs_plain_xattr_pfx;static int parse_extended_opts (const char *opts) {
@@ -491,6 +492,10 @@ static int parse_extended_opts(const char *opts)if (vallen)return -EINVAL ; cfg.c_xattr_name_filter = !clear; + }else if (MATCH_EXTENTED_OPT ("plain-xattr-prefixes" , token, keylen)) { +if (vallen) +return -EINVAL ; + mkfs_plain_xattr_pfx = true; }else {int i, err;
@@ -1788,7 +1793,7 @@ int main(int argc, char **argv) }if (cfg.c_extra_ea_name_prefixes) -erofs_xattr_flush_name_prefixes (&g_sbi); +erofs_xattr_flush_name_prefixes (&g_sbi, mkfs_plain_xattr_pfx); root =erofs_new_inode (&g_sbi);if (IS_ERR (root)) {
Signature · 1 line
2.43.5