erofs-utils: lib: get rid of global sbi in lib/inode.c
authorHongzhen Luo <hongzhen@linux.alibaba.com>
Thu, 4 Jul 2024 05:02:58 +0000 (13:02 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Thu, 4 Jul 2024 08:07:34 +0000 (16:07 +0800)
Get rid of the global sbi when EROFS_MT_ENABLED is defined.

Signed-off-by: Hongzhen Luo <hongzhen@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240704050259.520618-1-hongzhen@linux.alibaba.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
lib/inode.c

index 3e82af74fa8966e817a3a72cd634e677b1bda687..8d600885685bec7a93a4117eb2218c2ec6985115 100644 (file)
@@ -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;