Get rid of the global sbi when EROFS_MT_ENABLED is defined. Signed-off-by: Hongzhen Luo <hongz...@linux.alibaba.com> --- v2: Minor cleanup on the patch. v1: https://lore.kernel.org/all/20240703121247.3797289-1-hongz...@linux.alibaba.com/ --- lib/inode.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/lib/inode.c b/lib/inode.c index 3e82af7..8d60088 100644 --- a/lib/inode.c +++ b/lib/inode.c @@ -1800,6 +1800,7 @@ static int erofs_mkfs_build_tree(struct erofs_mkfs_buildtree_ctx *ctx) { struct erofs_mkfs_dfops *q; int err, err2; + struct erofs_sb_info *sbi = ctx->sbi ? ctx->sbi : ctx->u.root->sbi; q = malloc(sizeof(*q)); if (!q) @@ -1818,15 +1819,15 @@ static int erofs_mkfs_build_tree(struct erofs_mkfs_buildtree_ctx *ctx) q->head = 0; q->tail = 0; - sbi.mkfs_dfops = q; - err = pthread_create(&sbi.dfops_worker, NULL, - z_erofs_mt_dfops_worker, &sbi); + sbi->mkfs_dfops = q; + err = pthread_create(&sbi->dfops_worker, NULL, + z_erofs_mt_dfops_worker, sbi); if (err) goto fail; err = __erofs_mkfs_build_tree(ctx); - erofs_mkfs_go(&sbi, ~0, NULL, 0); - err2 = pthread_join(sbi.dfops_worker, NULL); + erofs_mkfs_go(sbi, ~0, NULL, 0); + err2 = pthread_join(sbi->dfops_worker, NULL); if (!err) err = err2; -- 2.39.3