[PATCH 1/5] erofs-utils: lib: pass uniaddr_offset to erofs_rebuild_load_tree

Lucas Karpinski lkarpinski at nvidia.com
Tue Mar 3 07:01:50 AEDT 2026


uniaddr_offset will be needed for rebuild fulldata mode. Add a parameter
to erofs_rebuild_load_tree and include it in the erofs_rebuild_dir_context
struct as well.

Signed-off-by: Lucas Karpinski <lkarpinski at nvidia.com>
---
 lib/liberofs_rebuild.h | 3 ++-
 lib/rebuild.c          | 5 ++++-
 mkfs/main.c            | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/liberofs_rebuild.h b/lib/liberofs_rebuild.h
index 69802fb..d8c4c8a 100644
--- a/lib/liberofs_rebuild.h
+++ b/lib/liberofs_rebuild.h
@@ -14,7 +14,8 @@ struct erofs_dentry *erofs_rebuild_get_dentry(struct erofs_inode *pwd,
 		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,
-			    enum erofs_rebuild_datamode mode);
+			    enum erofs_rebuild_datamode mode,
+			    erofs_blk_t uniaddr_offset);
 
 int erofs_rebuild_load_basedir(struct erofs_inode *dir, u64 *nr_subdirs,
 			       unsigned int *i_nlink);
diff --git a/lib/rebuild.c b/lib/rebuild.c
index f89a17c..7e62bc9 100644
--- a/lib/rebuild.c
+++ b/lib/rebuild.c
@@ -286,6 +286,7 @@ struct erofs_rebuild_dir_context {
 			unsigned int *i_nlink;
 		};
 	};
+	erofs_blk_t uniaddr_offset;	/* unified addressing offset for FULL mode */
 };
 
 static int erofs_rebuild_dirent_iter(struct erofs_dir_context *ctx)
@@ -419,7 +420,8 @@ out:
 }
 
 int erofs_rebuild_load_tree(struct erofs_inode *root, struct erofs_sb_info *sbi,
-			    enum erofs_rebuild_datamode mode)
+			     enum erofs_rebuild_datamode mode,
+			     erofs_blk_t uniaddr_offset)
 {
 	struct erofs_inode inode = {};
 	struct erofs_rebuild_dir_context ctx;
@@ -452,6 +454,7 @@ int erofs_rebuild_load_tree(struct erofs_inode *root, struct erofs_sb_info *sbi,
 		.ctx.cb = erofs_rebuild_dirent_iter,
 		.mergedir = root,
 		.datamode = mode,
+		.uniaddr_offset = uniaddr_offset,
 	};
 	ret = erofs_iterate_dir(&ctx.ctx, false);
 	free(inode.i_srcpath);
diff --git a/mkfs/main.c b/mkfs/main.c
index aaf5358..471bce2 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -1735,7 +1735,7 @@ static int erofs_mkfs_rebuild_load_trees(struct erofs_inode *root)
 	}
 
 	list_for_each_entry(src, &rebuild_src_list, list) {
-		ret = erofs_rebuild_load_tree(root, src, datamode);
+		ret = erofs_rebuild_load_tree(root, src, datamode, 0);
 		if (ret) {
 			erofs_err("failed to load %s", src->devname);
 			return ret;

-- 
Git-155)


More information about the Linux-erofs mailing list