erofs-utils: mkfs: pop up most recently used dentries for tarerofs
PATCH 1/1 erofs-utils: mkfs: pop up most recently used dentries for tarerofs
Each tar header keeps the full file path. It's useful to move most recently used intermediate dirs to list heads.
User time of tarerofs index mode can be reduced by 19%.
Signed-off-by Gao Xiang <[email protected]>
--- include/erofs/rebuild.h | 2 +- lib/rebuild.c | 9 +++++++-- lib/tar.c | 5 +++-- 3 files changed, 11 insertions(+), 5 deletions(-)
include/erofs/rebuild.h +1 -1
@@ -10,7 +10,7 @@ extern "C"#include "internal.h" struct erofs_dentry *erofs_rebuild_get_dentry (struct erofs_inode *pwd, -char *path,bool aufs,bool *whout,bool *opq); +char *path,bool aufs,bool *whout,bool *opq,bool to_head);int erofs_rebuild_load_tree (struct erofs_inode *root,struct erofs_sb_info *sbi);
lib/rebuild.c +7 -2
@@ -52,7 +52,7 @@ static struct erofs_dentry *erofs_rebuild_mkdir(struct erofs_inode *dir, }struct erofs_dentry *erofs_rebuild_get_dentry (struct erofs_inode *pwd, -char *path,bool aufs,bool *whout,bool *opq) +char *path,bool aufs,bool *whout,bool *opq,bool to_head) {struct erofs_dentry *d =NULL ;unsigned int len =strlen (path);
@@ -100,6 +100,10 @@ struct erofs_dentry *erofs_rebuild_get_dentry(struct erofs_inode *pwd, }if (inode) { +if (to_head) { +list_del (&d->d_child); +list_add (&d->d_child, &pwd->i_subdirs); + } pwd = inode; }else if (!slash) { d =erofs_d_alloc (pwd, s);
@@ -262,7 +266,8 @@ static int erofs_rebuild_dirent_iter(struct erofs_dir_context *ctx)erofs_dbg ("parsing %s" , path); dname = path +strlen (parent->i_srcpath) +1 ; - d =erofs_rebuild_get_dentry (parent, dname, false, &dumb, &dumb); + d =erofs_rebuild_get_dentry (parent, dname, false, + &dumb, &dumb, false);if (IS_ERR (d)) { ret =PTR_ERR (d); goto out;
lib/tar.c +3 -2
@@ -662,7 +662,7 @@ restart:erofs_dbg ("parsing %s (mode %05o)" , eh.path, st.st_mode); - d =erofs_rebuild_get_dentry (root, eh.path, tar->aufs, &whout, &opq); + d =erofs_rebuild_get_dentry (root, eh.path, tar->aufs, &whout, &opq, true);if (IS_ERR (d)) { ret =PTR_ERR (d); goto out;
@@ -695,7 +695,8 @@ restart: } d->inode =NULL ; - d2 =erofs_rebuild_get_dentry (root, eh.link, tar->aufs, &dumb, &dumb); + d2 =erofs_rebuild_get_dentry (root, eh.link, tar->aufs, + &dumb, &dumb, false);if (IS_ERR (d2)) { ret =PTR_ERR (d2); goto out;
Signature · 1 line
2.39.3