erofs-utils: lib: introduce prefix-aware erofs_setxattr()
PATCH v2 1/4 erofs-utils: lib: introduce prefix-aware erofs_setxattr()
Allows users to specify a predefined prefix for xattr names.
--- include/erofs/xattr.h | 5 +++-- lib/tar.c | 2 +- lib/xattr.c | 45 +++++++++++++++++++++++++++++++++---------- 3 files changed, 39 insertions(+), 13 deletions(-)
include/erofs/xattr.h +3 -2
@@ -36,9 +36,10 @@ int erofs_xattr_insert_name_prefix(const char *prefix);void erofs_xattr_cleanup_name_prefixes (void );int erofs_xattr_flush_name_prefixes (struct erofs_importer *im,bool plain);int erofs_xattr_prefixes_init (struct erofs_sb_info *sbi); - -int erofs_setxattr (struct erofs_inode *inode,char *key, +int erofs_setxattr (struct erofs_inode *inode,int index,const char *name,const void *value,size_t size); +int erofs_vfs_setxattr (struct erofs_inode *inode,const char *name, +const void *value,size_t size);int erofs_set_opaque_xattr (struct erofs_inode *inode);void erofs_clear_opaque_xattr (struct erofs_inode *inode);int erofs_set_origin_xattr (struct erofs_inode *inode);
lib/tar.c +1 -1
@@ -411,7 +411,7 @@ int tarerofs_apply_xattrs(struct erofs_inode *inode, struct list_head *xattrs) item->kv[item->namelen] ='\0' ;erofs_dbg ("Recording xattr(%s)=\"%s\" (of %u bytes) to file %s" , item->kv, v, vsz, inode->i_srcpath); - ret =erofs_setxattr (inode, item->kv, v, vsz); + ret =erofs_vfs_setxattr (inode, item->kv, v, vsz);if (ret == -ENODATA )erofs_err ("Failed to set xattr(%s)=%s to file %s" , item->kv, v, inode->i_srcpath);
lib/xattr.c +35 -10
91 lines not on this page · raw message
Signature · 1 line
2.43.5
PATCH v2 2/4 erofs-utils: lib: switch to use `struct erofs_mkfs_btctx`
Sometimes, it's necessary to know whether it's an incremental build or not.
--- lib/inode.c | 102 +++++++++++++++++++++++++++------------------------- 1 file changed, 53 insertions(+), 49 deletions(-)
lib/inode.c +53 -49
@@ -1450,7 +1450,12 @@ out:return ret; } -static int erofs_mkfs_handle_nondirectory (struct erofs_importer *im, +struct erofs_mkfs_btctx { +struct erofs_importer *im; +bool rebuild, incremental; +}; + +static int erofs_mkfs_handle_nondirectory (const struct erofs_mkfs_btctx *btctx,struct erofs_mkfs_job_ndir_ctx *ctx) {struct erofs_inode *inode = ctx->inode;
@@ -1480,7 +1485,7 @@ static int erofs_mkfs_handle_nondirectory(struct erofs_importer *im, }if (ret)return ret; -erofs_prepare_inode_buffer (im, inode); +erofs_prepare_inode_buffer (btctx->im, inode);erofs_write_tail_end (inode);return 0 ; }
@@ -1501,7 +1506,7 @@ struct erofs_mkfs_jobitem { } u; }; -static int erofs_mkfs_jobfn (struct erofs_importer *im, +static int erofs_mkfs_jobfn (const struct erofs_mkfs_btctx *ctx,struct erofs_mkfs_jobitem *item) {struct erofs_inode *inode = item->u.inode;
@@ -1511,7 +1516,7 @@ static int erofs_mkfs_jobfn(struct erofs_importer *im,return 1 ;if (item->type ==EROFS_MKFS_JOB_NDIR ) -return erofs_mkfs_handle_nondirectory (im, &item->u.ndir); +return erofs_mkfs_handle_nondirectory (ctx, &item->u.ndir);if (item->type ==EROFS_MKFS_JOB_DIR ) {unsigned int bsz =erofs_blksiz (inode->sbi);
@@ -1519,7 +1524,7 @@ static int erofs_mkfs_jobfn(struct erofs_importer *im,if (inode->datalayout ==EROFS_INODE_DATALAYOUT_MAX ) { inode->datalayout =EROFS_INODE_FLAT_INLINE ; - ret =erofs_begin_compress_dir (im, inode); + ret =erofs_begin_compress_dir (ctx->im, inode);if (ret && ret != -ENOSPC )return ret; }else {
@@ -1535,7 +1540,7 @@ static int erofs_mkfs_jobfn(struct erofs_importer *im,* in the parent directory since parent directories should * generally be prioritized. */ - ret =erofs_prepare_inode_buffer (im, inode); + ret =erofs_prepare_inode_buffer (ctx->im, inode);if (ret)return ret; inode->bh->op = &erofs_skip_write_bhops;
@@ -1603,8 +1608,8 @@ static void erofs_mkfs_pop_jobitem(struct erofs_mkfs_dfops *q)static void *z_erofs_mt_dfops_worker (void *arg) { -struct erofs_importer *im = arg; -struct erofs_sb_info *sbi = im->sbi; +const struct erofs_mkfs_btctx *ctx = arg; +struct erofs_sb_info *sbi = ctx->im->sbi;struct erofs_mkfs_dfops *dfops = sbi->mkfs_dfops;int ret;
@@ -1612,7 +1617,7 @@ static void *z_erofs_mt_dfops_worker(void *arg)struct erofs_mkfs_jobitem *item; item =erofs_mkfs_top_jobitem (dfops); - ret =erofs_mkfs_jobfn (im, item); + ret =erofs_mkfs_jobfn (ctx, item);erofs_mkfs_pop_jobitem (dfops); }while (!ret);
@@ -1622,10 +1627,10 @@ static void *z_erofs_mt_dfops_worker(void *arg)pthread_exit ((void *)(uintptr_t )(ret <0 ? ret :0 )); } -static int erofs_mkfs_go (struct erofs_importer *im, +static int erofs_mkfs_go (const struct erofs_mkfs_btctx *ctx,enum erofs_mkfs_jobtype type,void *elem,int size) { -struct erofs_mkfs_dfops *q = im->sbi->mkfs_dfops; +struct erofs_mkfs_dfops *q = ctx->im->sbi->mkfs_dfops;struct erofs_mkfs_jobitem *item;pthread_mutex_lock (&q->lock);
@@ -1649,14 +1654,14 @@ static int erofs_mkfs_go(struct erofs_importer *im, return 0; }#else -static int erofs_mkfs_go (struct erofs_importer *im, +static int erofs_mkfs_go (const struct erofs_mkfs_btctx *ctx,enum erofs_mkfs_jobtype type,void *elem,int size) {struct erofs_mkfs_jobitem item; item.type = type;memcpy (&item.u, elem, size); -return erofs_mkfs_jobfn (im, &item); +return erofs_mkfs_jobfn (ctx, &item); }static void erofs_mkfs_flushjobs (struct erofs_sb_info *sbi) {
@@ -1686,7 +1691,7 @@ int erofs_mkfs_push_pending_job(struct list_head *pending,return 0 ; } -int erofs_mkfs_flush_pending_jobs (struct erofs_importer *im, +int erofs_mkfs_flush_pending_jobs (const struct erofs_mkfs_btctx *ctx,struct list_head *q) {struct erofs_mkfs_pending_jobitem *pji, *n;
@@ -1696,7 +1701,7 @@ int erofs_mkfs_flush_pending_jobs(struct erofs_importer *im,list_for_each_entry_safe (pji, n, q, list) {list_del (&pji->list); - err2 =erofs_mkfs_go (im, pji->item.type, &pji->item.u, + err2 =erofs_mkfs_go (ctx, pji->item.type, &pji->item.u, pji->item._usize);free (pji);if (!err)
@@ -1809,11 +1814,10 @@ static void erofs_dentry_kill(struct erofs_dentry *d)free (d); } -static int erofs_prepare_dir_inode (struct erofs_importer *im, -struct erofs_inode *dir, -bool rebuild, -bool incremental) +static int erofs_prepare_dir_inode (const struct erofs_mkfs_btctx *ctx, +struct erofs_inode *dir) { +struct erofs_importer *im = ctx->im;struct erofs_sb_info *sbi = im->sbi;struct erofs_dentry *d, *n;unsigned int i_nlink;
@@ -1833,14 +1837,14 @@ static int erofs_prepare_dir_inode(struct erofs_importer *im, ++nr_subdirs; } -if (!rebuild) { +if (!ctx->rebuild) { ret =erofs_mkfs_import_localdir (im, dir, &nr_subdirs, &i_nlink);if (ret)return ret; } -if (incremental && dir->dev == sbi->dev && !dir->opaque) { +if (ctx->incremental && dir->dev == sbi->dev && !dir->opaque) { ret =erofs_rebuild_load_basedir (dir, &nr_subdirs, &i_nlink);if (ret)return ret;
@@ -1861,7 +1865,7 @@ static int erofs_prepare_dir_inode(struct erofs_importer *im,if (ret)return ret; -if (IS_ROOT (dir) && incremental && !erofs_sb_has_48bit (sbi)) +if (IS_ROOT (dir) && ctx->incremental && !erofs_sb_has_48bit (sbi)) dir->datalayout =EROFS_INODE_FLAT_PLAIN ; dir->i_nlink = i_nlink;
@@ -1879,9 +1883,10 @@ static int erofs_prepare_dir_inode(struct erofs_importer *im,return 0 ; } -static int erofs_mkfs_begin_nondirectory (struct erofs_importer *im, +static int erofs_mkfs_begin_nondirectory (const struct erofs_mkfs_btctx *btctx,struct erofs_inode *inode) { +struct erofs_importer *im = btctx->im;struct erofs_mkfs_job_ndir_ctx ctx = { .inode = inode, .fd =-1 };int ret;
@@ -1913,14 +1918,14 @@ static int erofs_mkfs_begin_nondirectory(struct erofs_importer *im,return ret; } } -return erofs_mkfs_go (im,EROFS_MKFS_JOB_NDIR , &ctx,sizeof (ctx)); +return erofs_mkfs_go (btctx,EROFS_MKFS_JOB_NDIR , &ctx,sizeof (ctx)); } -static int erofs_mkfs_handle_inode (struct erofs_importer *im, -struct erofs_inode *inode, -bool rebuild,bool incremental) +static int erofs_mkfs_handle_inode (const struct erofs_mkfs_btctx *ctx, +struct erofs_inode *inode) {const char *relpath =erofs_fspath (inode->i_srcpath); +struct erofs_importer *im = ctx->im;const struct erofs_importer_params *params = im->params;char *trimmed;int ret;
@@ -1942,12 +1947,12 @@ static int erofs_mkfs_handle_inode(struct erofs_importer *im, }if (S_ISDIR (inode->i_mode)) { - ret =erofs_prepare_dir_inode (im, inode, rebuild, incremental); + ret =erofs_prepare_dir_inode (ctx, inode);if (ret <0 )return ret; } -if (!rebuild && !params->no_xattrs) { +if (!ctx->rebuild && !params->no_xattrs) { ret =erofs_scan_file_xattrs (inode);if (ret <0 )return ret;
@@ -1959,14 +1964,14 @@ static int erofs_mkfs_handle_inode(struct erofs_importer *im,else if (inode->whiteouts)erofs_set_origin_xattr (inode); - ret =erofs_prepare_xattr_ibody (inode, incremental &&IS_ROOT (inode)); + ret =erofs_prepare_xattr_ibody (inode, ctx->incremental &&IS_ROOT (inode));if (ret <0 )return ret;if (!S_ISDIR (inode->i_mode)) { - ret =erofs_mkfs_begin_nondirectory (im, inode); + ret =erofs_mkfs_begin_nondirectory (ctx, inode); }else { - ret =erofs_mkfs_go (im,EROFS_MKFS_JOB_DIR , &inode, + ret =erofs_mkfs_go (ctx,EROFS_MKFS_JOB_DIR , &inode,sizeof (inode)); } erofs_info("file %s dumped (mode %05o)", *relpath ? relpath : "/",
@@ -1985,9 +1990,9 @@ static void erofs_mark_parent_inode(struct erofs_inode *inode, inode->i_parent = (void *)((unsigned long )dir |1 ); } -static int erofs_mkfs_dump_tree (struct erofs_importer *im,bool rebuild, -bool incremental) +static int erofs_mkfs_dump_tree (const struct erofs_mkfs_btctx *ctx) { +struct erofs_importer *im = ctx->im;struct erofs_inode *root = im->root;struct erofs_sb_info *sbi = root->sbi;struct erofs_inode *dumpdir =erofs_igrab (root);
@@ -1998,7 +2003,7 @@ static int erofs_mkfs_dump_tree(struct erofs_importer *im, bool rebuild,erofs_mark_parent_inode (root, root);/* rootdir mark */ root->next_dirwrite =NULL ;/* update dev/i_ino[1] to keep track of the base image */ -if (incremental) { +if (ctx->incremental) { root->dev = root->sbi->dev; root->i_ino[1 ] = sbi->root_nid;erofs_remove_ihash (root);
@@ -2013,12 +2018,12 @@ static int erofs_mkfs_dump_tree(struct erofs_importer *im, bool rebuild, root->xattr_isize = cfg.c_root_xattr_isize; } - err =erofs_mkfs_handle_inode (im, root, rebuild, incremental); + err =erofs_mkfs_handle_inode (ctx, root);if (err)return err;/* assign root NID immediately for non-incremental builds */ -if (!incremental) { +if (!ctx->incremental) {erofs_mkfs_flushjobs (sbi);erofs_fixup_meta_blkaddr (root); sbi->root_nid = root->nid;
@@ -2039,13 +2044,12 @@ static int erofs_mkfs_dump_tree(struct erofs_importer *im, bool rebuild,continue ;if (!erofs_inode_visited (inode)) { -DBG_BUGON (rebuild && (inode->i_nlink ==1 || +DBG_BUGON (ctx->rebuild && (inode->i_nlink ==1 ||S_ISDIR (inode->i_mode)) &&erofs_parent_inode (inode) != dir);erofs_mark_parent_inode (inode, dir); - err =erofs_mkfs_handle_inode (im, inode, - rebuild, incremental); + err =erofs_mkfs_handle_inode (ctx, inode);if (err)break ;if (S_ISDIR (inode->i_mode)) {
@@ -2053,7 +2057,7 @@ static int erofs_mkfs_dump_tree(struct erofs_importer *im, bool rebuild, last = &inode->next_dirwrite; (void )erofs_igrab (inode); } - }else if (!rebuild) { + }else if (!ctx->rebuild) { ++inode->i_nlink; } }
@@ -2062,7 +2066,7 @@ static int erofs_mkfs_dump_tree(struct erofs_importer *im, bool rebuild, err2 = grouped_dirdata ?erofs_mkfs_push_pending_job (&pending_dirs,EROFS_MKFS_JOB_DIR_BH , &dir,sizeof (dir)) : -erofs_mkfs_go (im,EROFS_MKFS_JOB_DIR_BH , +erofs_mkfs_go (ctx,EROFS_MKFS_JOB_DIR_BH , &dir,sizeof (dir));if (err || err2) {if (!err)
@@ -2070,7 +2074,7 @@ static int erofs_mkfs_dump_tree(struct erofs_importer *im, bool rebuild,break ; } }while (dumpdir); - err2 =erofs_mkfs_flush_pending_jobs (im, &pending_dirs); + err2 =erofs_mkfs_flush_pending_jobs (ctx, &pending_dirs);return err ? err : err2; }
@@ -2082,7 +2086,7 @@ struct erofs_mkfs_buildtree_ctx {#define __erofs_mkfs_build_tree erofs_mkfs_build_tree#endif -static int __erofs_mkfs_build_tree (struct erofs_mkfs_buildtree_ctx *ctx) +static int __erofs_mkfs_build_tree (const struct erofs_mkfs_btctx *ctx) {struct erofs_importer *im = ctx->im;
@@ -2099,7 +2103,7 @@ static int __erofs_mkfs_build_tree(struct erofs_mkfs_buildtree_ctx *ctx)if (err)return err; } -return erofs_mkfs_dump_tree (im, ctx->rebuild, ctx->incremental); +return erofs_mkfs_dump_tree (ctx); }#ifdef EROFS_MT_ENABLED
@@ -2125,7 +2129,7 @@ static int erofs_get_fdlimit(void)#endif } -static int erofs_mkfs_build_tree (struct erofs_mkfs_buildtree_ctx *ctx) +static int erofs_mkfs_build_tree (struct erofs_mkfs_btctx *ctx) {struct erofs_importer *im = ctx->im;struct erofs_importer_params *params = im->params;
@@ -2162,12 +2166,12 @@ static int erofs_mkfs_build_tree(struct erofs_mkfs_buildtree_ctx *ctx) sbi->mkfs_dfops = q; err =pthread_create (&sbi->dfops_worker,NULL , - z_erofs_mt_dfops_worker, im); + z_erofs_mt_dfops_worker, ctx);if (err) goto fail; err =__erofs_mkfs_build_tree (ctx); -erofs_mkfs_go (im, ~0 ,NULL ,0 ); +erofs_mkfs_go (ctx, ~0 ,NULL ,0 ); err2 =pthread_join (sbi->dfops_worker, &retval);DBG_BUGON (!q->exited);if (!err || err == -ECHILD ) {
@@ -2195,7 +2199,7 @@ int erofs_importer_load_tree(struct erofs_importer *im, bool rebuild,return -EOPNOTSUPP ; } - return erofs_mkfs_build_tree(&((struct erofs_mkfs_buildtree_ctx) { + return erofs_mkfs_build_tree(&((struct erofs_mkfs_btctx) { .im = im, .rebuild = rebuild, .incremental = incremental,
Signature · 1 line
2.43.5
PATCH v2 3/4 erofs-utils: lib: delay erofs_prepare_xattr_ibody()
In reply to Gao XiangCall erofs_prepare_xattr_ibody() in erofs_mkfs_handle_nondirectory() and erofs_mkfs_create_directory() instead.
Note that it shouldn't be called in erofs_prepare_inode_buffer(), which is too late.
--- lib/inode.c | 77 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 33 deletions(-)
lib/inode.c +44 -33
@@ -1459,7 +1459,12 @@ static int erofs_mkfs_handle_nondirectory(const struct erofs_mkfs_btctx *btctx, struct erofs_mkfs_job_ndir_ctx *ctx) {struct erofs_inode *inode = ctx->inode; -int ret =0 ; +int ret; + + ret =erofs_prepare_xattr_ibody (inode, + btctx->incremental &&IS_ROOT (inode)); +if (ret <0 ) +return ret;if (S_ISLNK (inode->i_mode)) {char *symlink = inode->i_link;
@@ -1490,6 +1495,42 @@ static int erofs_mkfs_handle_nondirectory(const struct erofs_mkfs_btctx *btctx,return 0 ; } +static int erofs_mkfs_create_directory (const struct erofs_mkfs_btctx *ctx, +struct erofs_inode *inode) +{ +unsigned int bsz =erofs_blksiz (inode->sbi); +int ret; + + ret =erofs_prepare_xattr_ibody (inode, ctx->incremental &&IS_ROOT (inode)); +if (ret <0 ) +return ret; + +if (inode->datalayout ==EROFS_INODE_DATALAYOUT_MAX ) { + inode->datalayout =EROFS_INODE_FLAT_INLINE ; + + ret =erofs_begin_compress_dir (ctx->im, inode); +if (ret && ret != -ENOSPC ) +return ret; + }else { +DBG_BUGON (inode->datalayout !=EROFS_INODE_FLAT_PLAIN ); + } + +/* it will be used in erofs_prepare_inode_buffer */ +if (inode->datalayout ==EROFS_INODE_FLAT_INLINE ) + inode->idata_size = inode->i_size & (bsz -1 ); + +/* +* Directory on-disk inodes should be close to other inodes +* in the parent directory since parent directories should +* generally be prioritized. +*/ + ret =erofs_prepare_inode_buffer (ctx->im, inode); +if (ret) +return ret; + inode->bh->op = &erofs_skip_write_bhops; +return 0 ; +} +enum erofs_mkfs_jobtype {/* ordered job types */ EROFS_MKFS_JOB_NDIR ,EROFS_MKFS_JOB_DIR ,
@@ -1518,34 +1559,8 @@ static int erofs_mkfs_jobfn(const struct erofs_mkfs_btctx *ctx,if (item->type ==EROFS_MKFS_JOB_NDIR )return erofs_mkfs_handle_nondirectory (ctx, &item->u.ndir); -if (item->type ==EROFS_MKFS_JOB_DIR ) { -unsigned int bsz =erofs_blksiz (inode->sbi); - -if (inode->datalayout ==EROFS_INODE_DATALAYOUT_MAX ) { - inode->datalayout =EROFS_INODE_FLAT_INLINE ; - - ret =erofs_begin_compress_dir (ctx->im, inode); -if (ret && ret != -ENOSPC ) -return ret; - }else { -DBG_BUGON (inode->datalayout !=EROFS_INODE_FLAT_PLAIN ); - } - -/* it will be used in erofs_prepare_inode_buffer */ -if (inode->datalayout ==EROFS_INODE_FLAT_INLINE ) - inode->idata_size = inode->i_size & (bsz -1 ); - -/* -* Directory on-disk inodes should be close to other inodes -* in the parent directory since parent directories should -* generally be prioritized. -*/ - ret =erofs_prepare_inode_buffer (ctx->im, inode); -if (ret) -return ret; - inode->bh->op = &erofs_skip_write_bhops; -return 0 ; - } +if (item->type ==EROFS_MKFS_JOB_DIR ) +return erofs_mkfs_create_directory (ctx, inode);if (item->type ==EROFS_MKFS_JOB_DIR_BH ) { ret =erofs_write_dir_file (inode);
@@ -1964,10 +1979,6 @@ static int erofs_mkfs_handle_inode(const struct erofs_mkfs_btctx *ctx,else if (inode->whiteouts)erofs_set_origin_xattr (inode); - ret =erofs_prepare_xattr_ibody (inode, ctx->incremental &&IS_ROOT (inode)); -if (ret <0 ) -return ret; -if (!S_ISDIR (inode->i_mode)) { ret =erofs_mkfs_begin_nondirectory (ctx, inode); }else {
Signature · 1 line
2.43.5
PATCH v2 4/4 erofs-utils: mkfs: add `--inode-digest-xattr` option
In reply to Gao XiangBased on the original Hongbo's version [1], it enables storing the SHA-256 digest of each inode as an extended attribute, in preparation for the upcoming page cache sharing feature.
Example usage:
$ mkfs.erofs --xattr-inode-digest=trusted.erofs.fingerprint [-zlz4hc] foo.erofs foo/
[1] https://lore.kernel.org/r/[email protected]
---
- address Hongbo's comment:
https://lore.kernel.org/r/[email protected]
include/erofs/internal.h | 2 + include/erofs/xattr.h | 2 + include/erofs_fs.h | 4 +- lib/inode.c | 46 +++++++++- lib/super.c | 13 ++- lib/xattr.c | 14 ++- mkfs/main.c | 186 ++++++++++++++++++++++----------------- 7 files changed, 178 insertions(+), 89 deletions(-)
include/erofs/internal.h +2 -0
@@ -130,6 +130,7 @@ struct erofs_sb_info {u32 xattr_prefix_start;u8 xattr_prefix_count; +u8 ishare_xattr_prefix_id;struct erofs_xattr_prefix_item *xattr_prefixes;struct erofs_vfile bdev;
@@ -189,6 +190,7 @@ 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) +EROFS_FEATURE_FUNCS(ishare_xattrs, compat, COMPAT_ISHARE_XATTRS)#define EROFS_I_EA_INITED_BIT 0#define EROFS_I_Z_INITED_BIT 1
include/erofs/xattr.h +2 -0
@@ -33,6 +33,8 @@ char *erofs_export_xattr_ibody(struct erofs_inode *inode);int erofs_load_shared_xattrs_from_path (struct erofs_sb_info *sbi,const char *path,long inlinexattr_tolerance);int erofs_xattr_insert_name_prefix (const char *prefix); +int erofs_xattr_set_ishare_prefix (struct erofs_sb_info *sbi, +const char *prefix);void erofs_xattr_cleanup_name_prefixes (void );int erofs_xattr_flush_name_prefixes (struct erofs_importer *im,bool plain);int erofs_xattr_prefixes_init (struct erofs_sb_info *sbi);
include/erofs_fs.h +3 -1
@@ -17,6 +17,7 @@#define EROFS_FEATURE_COMPAT_MTIME 0x00000002#define EROFS_FEATURE_COMPAT_XATTR_FILTER 0x00000004#define EROFS_FEATURE_COMPAT_PLAIN_XATTR_PFX 0x00000010 +#define EROFS_FEATURE_COMPAT_ISHARE_XATTRS 0x00000020/* * Any bits that aren't in EROFS_ALL_FEATURE_INCOMPAT should
@@ -82,7 +83,8 @@ struct erofs_super_block {__le32 xattr_prefix_start;/* start of long xattr prefixes */ __le64 packed_nid;/* nid of the special packed inode */ __u8 xattr_filter_reserved;/* reserved for xattr name filter */ -__u8 reserved[3 ]; +__u8 ishare_xattr_prefix_id; +__u8 reserved[2 ];__le32 build_time;/* seconds added to epoch for mkfs time */ __le64 rootnid_8b;/* (48BIT on) nid of root directory */ __le64 reserved2;
lib/inode.c +43 -3
72 lines not on this page · raw message
lib/super.c +11 -2
@@ -146,7 +146,15 @@ int erofs_read_superblock(struct erofs_sb_info *sbi) sbi->build_time =le32_to_cpu (dsb->build_time);memcpy (&sbi->uuid, dsb->uuid,sizeof (dsb->uuid)); - +if (erofs_sb_has_ishare_xattrs (sbi)) { +if (dsb->ishare_xattr_prefix_id >= sbi->xattr_prefix_count) { +erofs_err ("invalid ishare xattr prefix id %d" , + dsb->ishare_xattr_prefix_id); +return -EFSCORRUPTED ; + } + sbi->ishare_xattr_prefix_id = + dsb->ishare_xattr_prefix_id |EROFS_XATTR_LONG_PREFIX ; + } ret =z_erofs_parse_cfgs (sbi, dsb);if (ret)return ret;
@@ -160,7 +168,6 @@ int erofs_read_superblock(struct erofs_sb_info *sbi)free (sbi->devs); sbi->devs =NULL ; } - sbi->sb_valid = !ret;return ret; }
@@ -206,6 +213,8 @@ int erofs_writesb(struct erofs_sb_info *sbi) .extra_devices = cpu_to_le16(sbi->extra_devices), .devt_slotoff = cpu_to_le16(sbi->devt_slotoff), .packed_nid = cpu_to_le64(sbi->packed_nid), + .ishare_xattr_prefix_id = sbi->ishare_xattr_prefix_id & + EROFS_XATTR_LONG_PREFIX_MASK, };char *buf;int ret;
lib/xattr.c +13 -1
@@ -1495,9 +1495,21 @@ int erofs_xattr_insert_name_prefix(const char *prefix) } tnode->index =EROFS_XATTR_LONG_PREFIX | ea_prefix_count; - ea_prefix_count++;init_list_head (&tnode->list);list_add_tail (&tnode->list, &ea_name_prefixes); +return ea_prefix_count++; +} + +int erofs_xattr_set_ishare_prefix (struct erofs_sb_info *sbi, +const char *prefix) +{ +int err; + + err =erofs_xattr_insert_name_prefix (prefix); +if (err <0 ) +return err; + sbi->ishare_xattr_prefix_id =EROFS_XATTR_LONG_PREFIX | err; +erofs_sb_set_ishare_xattrs (sbi);return 0 ; }
mkfs/main.c +104 -82
249 lines not on this page · raw message
Signature · 1 line
2.43.5
Re: [PATCH v2 4/4] erofs-utils: mkfs: add `--inode-digest-xattr` option
Quoted 10 lines · Gao Xiang
Based on the original Hongbo's version [1], it enables storing the SHA-256 digest of each inode as an extended attribute, in preparation for the upcoming page cache sharing feature.
Example usage:
$ mkfs.erofs --xattr-inode-digest=trusted.erofs.fingerprint [-zlz4hc] foo.erofs foo/Co-developed-by Hongbo Li <[email protected]>[1] https://lore.kernel.org/r/[email protected]
Signed-off-by Gao Xiang <[email protected]>
Maybe the subject should be changed to "erofs-utils: mkfs: add --xattr-inode-digest option".
Thanks,
Hongbo
Quoted 473 lines
---
- address Hongbo's comment:https://lore.kernel.org/r/[email protected]include/erofs/internal.h | 2 + include/erofs/xattr.h | 2 + include/erofs_fs.h | 4 +- lib/inode.c | 46 +++++++++- lib/super.c | 13 ++- lib/xattr.c | 14 ++- mkfs/main.c | 186 ++++++++++++++++++++++----------------- 7 files changed, 178 insertions(+), 89 deletions(-)include/erofs/internal.h +2
-0@@ -130,6 +130,7 @@ struct erofs_sb_info {u32 xattr_prefix_start;u8 xattr_prefix_count; +u8 ishare_xattr_prefix_id;struct erofs_xattr_prefix_item *xattr_prefixes;struct erofs_vfile bdev;@@ -189,6 +190,7 @@ 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) +EROFS_FEATURE_FUNCS(ishare_xattrs, compat, COMPAT_ISHARE_XATTRS)#define EROFS_I_EA_INITED_BIT 0#define EROFS_I_Z_INITED_BIT 1include/erofs/xattr.h +2
-0@@ -33,6 +33,8 @@ char *erofs_export_xattr_ibody(struct erofs_inode *inode);int erofs_load_shared_xattrs_from_path (struct erofs_sb_info *sbi,const char *path,long inlinexattr_tolerance);int erofs_xattr_insert_name_prefix (const char *prefix); +int erofs_xattr_set_ishare_prefix (struct erofs_sb_info *sbi, +const char *prefix);void erofs_xattr_cleanup_name_prefixes (void );int erofs_xattr_flush_name_prefixes (struct erofs_importer *im,bool plain);int erofs_xattr_prefixes_init (struct erofs_sb_info *sbi);include/erofs_fs.h +3
-1@@ -17,6 +17,7 @@#define EROFS_FEATURE_COMPAT_MTIME 0x00000002#define EROFS_FEATURE_COMPAT_XATTR_FILTER 0x00000004#define EROFS_FEATURE_COMPAT_PLAIN_XATTR_PFX 0x00000010 +#define EROFS_FEATURE_COMPAT_ISHARE_XATTRS 0x00000020/* * Any bits that aren't in EROFS_ALL_FEATURE_INCOMPAT should @@ -82,7 +83,8 @@ struct erofs_super_block {__le32 xattr_prefix_start;/* start of long xattr prefixes */ __le64 packed_nid;/* nid of the special packed inode */ __u8 xattr_filter_reserved;/* reserved for xattr name filter */ -__u8 reserved[3 ]; +__u8 ishare_xattr_prefix_id; +__u8 reserved[2 ];__le32 build_time;/* seconds added to epoch for mkfs time */ __le64 rootnid_8b;/* (48BIT on) nid of root directory */ __le64 reserved2;lib/inode.c +43
-3@@ -31,6 +31,7 @@#include "liberofs_metabox.h" #include "liberofs_private.h" #include "liberofs_rebuild.h" +#include "sha256.h" static inline bool erofs_is_special_identifier (const char *path) {@@ -1898,6 +1899,37 @@ static int erofs_prepare_dir_inode(const struct erofs_mkfs_btctx *ctx,return 0 ; } +static int erofs_set_inode_fingerprint (struct erofs_inode *inode,int fd, +erofs_off_t pos) +{ +u8 ishare_xattr_prefix_id = inode->sbi->ishare_xattr_prefix_id; +erofs_off_t remaining = inode->i_size; +struct erofs_vfile vf = { .fd = fd }; +struct sha256_state md; +u8 out[32 +sizeof ("sha256:" ) -1 ]; +int ret; + +if (!ishare_xattr_prefix_id) +return 0 ; +erofs_sha256_init (&md); +do { +u8 buf[32768 ]; + + ret =erofs_io_pread (&vf, buf, +min_t (u64, remaining,sizeof (buf)), pos); +if (ret <0 ) +return ret; +if (ret >0 ) +erofs_sha256_process (&md, buf, ret); + remaining -= ret; + pos += ret; + }while (remaining); +erofs_sha256_done (&md, out +sizeof ("sha256:" ) -1 ); +memcpy (out,"sha256:" ,sizeof ("sha256:" ) -1 ); +return erofs_setxattr (inode, ishare_xattr_prefix_id,"" , + out,sizeof (out)); +} +static int erofs_mkfs_begin_nondirectory (const struct erofs_mkfs_btctx *btctx,struct erofs_inode *inode) {@@ -1917,11 +1949,18 @@ static int erofs_mkfs_begin_nondirectory(const struct erofs_mkfs_btctx *btctx, ctx.fd =open (inode->i_srcpath,O_RDONLY |O_BINARY );if (ctx.fd <0 )return -errno; - __erofs_fallthrough; -default :break ; +default : + goto out; } -if (ctx.fd >=0 && cfg.c_compr_opts[0 ].alg && + +if (S_ISREG (inode->i_mode) && inode->i_size) { + ret =erofs_set_inode_fingerprint (inode, ctx.fd, ctx.fpos); +if (ret <0 ) +return ret; + } + +if (cfg.c_compr_opts[0 ].alg &&erofs_file_is_compressible (im, inode)) { ctx.ictx =erofs_prepare_compressed_file (im, inode);if (IS_ERR (ctx.ictx))@@ -1933,6 +1972,7 @@ static int erofs_mkfs_begin_nondirectory(const struct erofs_mkfs_btctx *btctx,return ret; } } +out:return erofs_mkfs_go (btctx,EROFS_MKFS_JOB_NDIR , &ctx,sizeof (ctx)); }lib/super.c +11
-2@@ -146,7 +146,15 @@ int erofs_read_superblock(struct erofs_sb_info *sbi) sbi->build_time =le32_to_cpu (dsb->build_time);memcpy (&sbi->uuid, dsb->uuid,sizeof (dsb->uuid)); - +if (erofs_sb_has_ishare_xattrs (sbi)) { +if (dsb->ishare_xattr_prefix_id >= sbi->xattr_prefix_count) { +erofs_err ("invalid ishare xattr prefix id %d" , + dsb->ishare_xattr_prefix_id); +return -EFSCORRUPTED ; + } + sbi->ishare_xattr_prefix_id = + dsb->ishare_xattr_prefix_id |EROFS_XATTR_LONG_PREFIX ; + } ret =z_erofs_parse_cfgs (sbi, dsb);if (ret)return ret;@@ -160,7 +168,6 @@ int erofs_read_superblock(struct erofs_sb_info *sbi)free (sbi->devs); sbi->devs =NULL ; } - sbi->sb_valid = !ret;return ret; }@@ -206,6 +213,8 @@ int erofs_writesb(struct erofs_sb_info *sbi) .extra_devices = cpu_to_le16(sbi->extra_devices), .devt_slotoff = cpu_to_le16(sbi->devt_slotoff), .packed_nid = cpu_to_le64(sbi->packed_nid), + .ishare_xattr_prefix_id = sbi->ishare_xattr_prefix_id & + EROFS_XATTR_LONG_PREFIX_MASK, };char *buf;int ret;lib/xattr.c +13
-1@@ -1495,9 +1495,21 @@ int erofs_xattr_insert_name_prefix(const char *prefix) } tnode->index =EROFS_XATTR_LONG_PREFIX | ea_prefix_count; - ea_prefix_count++;init_list_head (&tnode->list);list_add_tail (&tnode->list, &ea_name_prefixes); +return ea_prefix_count++; +} + +int erofs_xattr_set_ishare_prefix (struct erofs_sb_info *sbi, +const char *prefix) +{ +int err; + + err =erofs_xattr_insert_name_prefix (prefix); +if (err <0 ) +return err; + sbi->ishare_xattr_prefix_id =EROFS_XATTR_LONG_PREFIX | err; +erofs_sb_set_ishare_xattrs (sbi);return 0 ; }mkfs/main.c +104
-82@@ -61,7 +61,6 @@ static struct option long_options[] = { {"tar", optional_argument, NULL, 20}, {"aufs", no_argument, NULL, 21}, {"mount-point", required_argument, NULL, 512}, - {"xattr-prefix", required_argument, NULL, 19}, #ifdef WITH_ANDROID {"product-out", required_argument, NULL, 513}, {"fs-config-file", required_argument, NULL, 514},@@ -102,6 +101,8 @@ static struct option long_options[] = {#endif {"zD", optional_argument, NULL, 536}, {"ZI", optional_argument, NULL, 537}, + {"xattr-prefix", required_argument, NULL, 538}, + {"xattr-inode-digest", required_argument, NULL, 539}, {0, 0, 0, 0}, };@@ -167,95 +168,96 @@ static void usage(int argc, char **argv) } }printf ( - " -C# specify the size of compress physical cluster in bytes\n" - " -EX[,...] X=extended options\n" - " -L volume-label set the volume label (maximum 15 bytes)\n" - " -m#[:X] enable metadata compression (# = physical cluster size in bytes;\n" - " X = another compression algorithm for metadata)\n" - " -T# specify a fixed UNIX timestamp # as build time\n" - " --all-time the timestamp is also applied to all files (default)\n" - " --mkfs-time the timestamp is applied as build time only\n" - " -UX use a given filesystem UUID\n" - " --zD[=<0|1>] specify directory compression: 0=disable [default], 1=enable\n" - " --ZI[=<0|1>] specify the separate inode metadata zone availability: 0=disable [default], 1=enable\n" - " --all-root make all files owned by root\n" + " -C# specify the size of compress physical cluster in bytes\n" + " -EX[,...] X=extended options\n" + " -L volume-label set the volume label (maximum 15 bytes)\n" + " -m#[:X] enable metadata compression (# = physical cluster size in bytes;\n" + " X = another compression algorithm for metadata)\n" + " -T# specify a fixed UNIX timestamp # as build time\n" + " --all-time the timestamp is also applied to all files (default)\n" + " --mkfs-time the timestamp is applied as build time only\n" + " -UX use a given filesystem UUID\n" + " --zD[=<0|1>] specify directory compression: 0=disable [default], 1=enable\n" + " --ZI[=<0|1>] specify the separate inode metadata zone availability: 0=disable [default], 1=enable\n" + " --all-root make all files owned by root\n" #ifdef EROFS_MT_ENABLED - " --async-queue-limit=# specify the maximum number of entries in the multi-threaded job queue\n" + " --async-queue-limit=# specify the maximum number of entries in the multi-threaded job queue\n" #endif - " --blobdev=X specify an extra device X to store chunked data\n" - " --chunksize=# generate chunk-based files with #-byte chunks\n" - " --clean=X run full clean build (default) or:\n" - " --incremental=X run incremental build\n" - " X = data|rvsp|0 (data: full data, rvsp: space fallocated\n" - " 0: inodes zeroed)\n" - " --compress-hints=X specify a file to configure per-file compression strategy\n" - " --dsunit=# align all data block addresses to multiples of #\n" - " --exclude-path=X avoid including file X (X = exact literal path)\n" - " --exclude-regex=X avoid including files that match X (X = regular expression)\n" + " --blobdev=X specify an extra device X to store chunked data\n" + " --chunksize=# generate chunk-based files with #-byte chunks\n" + " --clean=X run full clean build (default) or:\n" + " --incremental=X run incremental build\n" + " X = data|rvsp|0 (data: full data, rvsp: space fallocated\n" + " 0: inodes zeroed)\n" + " --compress-hints=X specify a file to configure per-file compression strategy\n" + " --dsunit=# align all data block addresses to multiples of #\n" + " --exclude-path=X avoid including file X (X = exact literal path)\n" + " --exclude-regex=X avoid including files that match X (X = regular expression)\n" #ifdef HAVE_LIBSELINUX - " --file-contexts=X specify a file contexts file to setup selinux labels\n" + " --file-contexts=X specify a file contexts file to setup selinux labels\n" #endif - " --force-uid=# set all file uids to # (# = UID)\n" - " --force-gid=# set all file gids to # (# = GID)\n" - " --fsalignblks=# specify the alignment of the primary device size in blocks\n" - " --uid-offset=# add offset # to all file uids (# = id offset)\n" - " --gid-offset=# add offset # to all file gids (# = id offset)\n" - " --hard-dereference dereference hardlinks, add links as separate inodes\n" - " --ignore-mtime use build time instead of strict per-file modification time\n" - " --max-extent-bytes=# set maximum decompressed extent size # in bytes\n" - " --mount-point=X X=prefix of target fs path (default: /)\n" - " --preserve-mtime keep per-file modification time strictly\n" - " --offset=# skip # bytes at the beginning of IMAGE.\n" - " --root-xattr-isize=# ensure the inline xattr size of the root directory is # bytes at least\n" - " --aufs replace aufs special files with overlayfs metadata\n" - " --sort=<path,none> data sorting order for tarballs as input (default: path)\n" + " --force-uid=# set all file uids to # (# = UID)\n" + " --force-gid=# set all file gids to # (# = GID)\n" + " --fsalignblks=# specify the alignment of the primary device size in blocks\n" + " --uid-offset=# add offset # to all file uids (# = id offset)\n" + " --gid-offset=# add offset # to all file gids (# = id offset)\n" + " --hard-dereference dereference hardlinks, add links as separate inodes\n" + " --ignore-mtime use build time instead of strict per-file modification time\n" + " --max-extent-bytes=# set maximum decompressed extent size # in bytes\n" + " --mount-point=X X=prefix of target fs path (default: /)\n" + " --preserve-mtime keep per-file modification time strictly\n" + " --offset=# skip # bytes at the beginning of IMAGE.\n" + " --root-xattr-isize=# ensure the inline xattr size of the root directory is # bytes at least\n" + " --aufs replace aufs special files with overlayfs metadata\n" + " --sort=<path,none> data sorting order for tarballs as input (default: path)\n" #ifdef S3EROFS_ENABLED - " --s3=X generate an image from S3-compatible object store\n" - " [,passwd_file=Y] X=endpoint, Y=s3fs-compatible password file\n" - " [,urlstyle=Z] S3 API calling style (Z = vhost|path) (default: vhost)\n" - " [,sig=<2,4>] S3 API signature version (default: 2)\n" - " [,region=W] W=region code in which endpoint belongs to (required for sig=4)\n" + " --s3=X generate an image from S3-compatible object store\n" + " [,passwd_file=Y] X=endpoint, Y=s3fs-compatible password file\n" + " [,urlstyle=Z] S3 API calling style (Z = vhost|path) (default: vhost)\n" + " [,sig=<2,4>] S3 API signature version (default: 2)\n" + " [,region=W] W=region code in which endpoint belongs to (required for sig=4)\n" #endif #ifdef OCIEROFS_ENABLED - " --oci=[f|i] generate a full (f) or index-only (i) image from OCI remote source\n" - " [,platform=X] X=platform (default: linux/amd64)\n" - " [,layer=#] #=layer index to extract (0-based; omit to extract all layers)\n" - " [,blob=Y] Y=blob digest to extract (omit to extract all layers)\n" - " [,username=Z] Z=username for authentication (optional)\n" - " [,password=W] W=password for authentication (optional)\n" - " [,insecure] use HTTP instead of HTTPS (optional)\n" + " --oci=[f|i] generate a full (f) or index-only (i) image from OCI remote source\n" + " [,platform=X] X=platform (default: linux/amd64)\n" + " [,layer=#] #=layer index to extract (0-based; omit to extract all layers)\n" + " [,blob=Y] Y=blob digest to extract (omit to extract all layers)\n" + " [,username=Z] Z=username for authentication (optional)\n" + " [,password=W] W=password for authentication (optional)\n" + " [,insecure] use HTTP instead of HTTPS (optional)\n" #endif - " --tar=X generate a full or index-only image from a tarball(-ish) source\n" - " (X = f|i|headerball; f=full mode, i=index mode,\n" - " headerball=file data is omited in the source stream)\n" - " --ovlfs-strip=<0,1> strip overlayfs metadata in the target image (e.g. whiteouts)\n" - " --quiet quiet execution (do not write anything to standard output.)\n" + " --tar=X generate a full or index-only image from a tarball(-ish) source\n" + " (X = f|i|headerball; f=full mode, i=index mode,\n" + " headerball=file data is omitted in the source stream)\n" + " --ovlfs-strip=<0,1> strip overlayfs metadata in the target image (e.g. whiteouts)\n" + " --quiet quiet execution (do not write anything to standard output.)\n" #ifndef NDEBUG - " --random-pclusterblks randomize pclusterblks for big pcluster (debugging only)\n" - " --random-algorithms randomize per-file algorithms (debugging only)\n" + " --random-pclusterblks randomize pclusterblks for big pcluster (debugging only)\n" + " --random-algorithms randomize per-file algorithms (debugging only)\n" #endif #ifdef HAVE_ZLIB - " --ungzip[=X] try to filter the tarball stream through gzip\n" - " (and optionally dump the raw stream to X together)\n" + " --ungzip[=X] try to filter the tarball stream through gzip\n" + " (and optionally dump the raw stream to X together)\n" #endif #ifdef HAVE_LIBLZMA - " --unxz[=X] try to filter the tarball stream through xz/lzma/lzip\n" - " (and optionally dump the raw stream to X together)\n" + " --unxz[=X] try to filter the tarball stream through xz/lzma/lzip\n" + " (and optionally dump the raw stream to X together)\n" #endif #ifdef HAVE_ZLIB - " --gzinfo[=X] generate AWS SOCI-compatible zinfo in order to support random gzip access\n" + " --gzinfo[=X] generate AWS SOCI-compatible zinfo in order to support random gzip access\n" #endif - " --vmdk-desc=X generate a VMDK descriptor file to merge sub-filesystems\n" + " --vmdk-desc=X generate a VMDK descriptor file to merge sub-filesystems\n" #ifdef EROFS_MT_ENABLED - " --workers=# set the number of worker threads to # (default: %u)\n" + " --workers=# set the number of worker threads to # (default: %u)\n" #endif -" --xattr-prefix=X X=extra xattr name prefix\n" -" --zfeature-bits=# toggle filesystem compression features according to given bits #\n" +" --xattr-inode-digest=X specify extended attribute name X to record inode digests\n" +" --xattr-prefix=X X=extra xattr name prefix\n" +" --zfeature-bits=# toggle filesystem compression features according to given bits #\n" #ifdef WITH_ANDROID"\n" "Android-specific options:\n" -" --product-out=X X=product_out directory\n" -" --fs-config-file=X X=fs_config file\n" +" --product-out=X X=product_out directory\n" +" --fs-config-file=X X=fs_config file\n" #endif #ifdef EROFS_MT_ENABLED , erofs_get_available_processors() /* --workers= */@@ -1259,16 +1261,6 @@ static int mkfs_parse_options_cfg(struct erofs_importer_params *params,return -EINVAL ; }break ; -case 19 : - errno =0 ; - opt =erofs_xattr_insert_name_prefix (optarg); -if (opt) { -erofs_err ("failed to parse xattr name prefix: %s" , -erofs_strerror (opt)); -return opt; - } - cfg.c_extra_ea_name_prefixes = true; -break ;case 20 :mkfs_parse_tar_cfg (optarg);break ;@@ -1424,6 +1416,24 @@ static int mkfs_parse_options_cfg(struct erofs_importer_params *params,else mkfscfg.inode_metazone = false;break ; +case 538 : + errno =0 ; + opt =erofs_xattr_insert_name_prefix (optarg); +if (opt <0 ) { +erofs_err ("failed to parse xattr name prefix: %s" , +erofs_strerror (opt)); +return opt; + } + cfg.c_extra_ea_name_prefixes = true; +break ; +case 539 : + err =erofs_xattr_set_ishare_prefix (&g_sbi, optarg); +if (err <0 ) { +erofs_err ("failed to parse ishare name: %s" , +erofs_strerror (err)); +return err; + } +break ;case 'V' :version ();exit (0 );@@ -1878,9 +1888,13 @@ int main(int argc, char **argv) goto exit; } -if (cfg.c_extra_ea_name_prefixes) -erofs_xattr_flush_name_prefixes (&importer, - mkfs_plain_xattr_pfx); + err =erofs_xattr_flush_name_prefixes (&importer, + mkfs_plain_xattr_pfx); +if (err) { +erofs_err ("failed to flush long xattr prefixes: %s" , +erofs_strerror (err)); + goto exit; + } root =erofs_new_inode (&g_sbi);if (IS_ERR (root)) {@@ -1888,6 +1902,14 @@ int main(int argc, char **argv) goto exit; } }else { + err =erofs_xattr_flush_name_prefixes (&importer, + mkfs_plain_xattr_pfx); +if (err) { +erofs_err ("failed to flush long xattr prefixes: %s" , +erofs_strerror (err)); + goto exit; + } + root =erofs_rebuild_make_root (&g_sbi);if (IS_ERR (root)) { err =PTR_ERR (root);
Re: [PATCH v2 4/4] erofs-utils: mkfs: add `--inode-digest-xattr` option
Quoted 7 lines · Hongbo Li
Quoted 4 lines · Gao Xiang
Based on the original Hongbo's version [1], it enables storing the SHA-256 digest of each inode as an extended attribute, in preparation for the upcoming page cache sharing feature.
Quoted 8 lines
Quoted 6 lines
Example usage:
$ mkfs.erofs --xattr-inode-digest=trusted.erofs.fingerprint [-zlz4hc] foo.erofs foo/Co-developed-by Hongbo Li <[email protected]>[1] https://lore.kernel.org/r/[email protected]
Signed-off-by Gao Xiang <[email protected]>Maybe the subject should be changed to "erofs-utils: mkfs: add
--xattr-inode-digestoption".
Updated.
Quoted 2 lines
Tested-by Hongbo Li <[email protected]>
Thanks!
Thanks,
Gao Xiang
Quoted 3 lines
Thanks,
Hongbo