Otherwise, metabox won't keep several types of inodes.

Fixes: 7928074b7643 ("erofs-utils: introduce metadata compression [metabox]")
Signed-off-by: Gao Xiang <[email protected]>
---
 lib/inode.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/inode.c b/lib/inode.c
index f9b5ee997877..09b2e507c609 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -903,8 +903,7 @@ static int erofs_prepare_inode_buffer(struct erofs_importer 
*im,
 {
        const struct erofs_importer_params *params = im->params;
        struct erofs_sb_info *sbi = im->sbi;
-       struct erofs_bufmgr *bmgr = sbi->bmgr;
-       struct erofs_bufmgr *ibmgr = bmgr;
+       struct erofs_bufmgr *ibmgr;
        unsigned int inodesize;
        struct erofs_buffer_head *bh, *ibh;
 
@@ -922,6 +921,13 @@ static int erofs_prepare_inode_buffer(struct 
erofs_importer *im,
        if (inode->extent_isize)
                inodesize = roundup(inodesize, 8) + inode->extent_isize;
 
+       if (!erofs_is_special_identifier(inode->i_srcpath) &&
+           erofs_metabox_bmgr(sbi))
+               inode->in_metabox = true;
+
+       if (inode->in_metabox)
+               ibmgr = erofs_metabox_bmgr(sbi) ?: sbi->bmgr;
+
        if (inode->datalayout == EROFS_INODE_FLAT_PLAIN)
                goto noinline;
 
@@ -942,12 +948,6 @@ static int erofs_prepare_inode_buffer(struct 
erofs_importer *im,
                        inode->datalayout = EROFS_INODE_FLAT_PLAIN;
        }
 
-       if (!erofs_is_special_identifier(inode->i_srcpath) &&
-           erofs_metabox_bmgr(sbi))
-               inode->in_metabox = true;
-
-       if (inode->in_metabox)
-               ibmgr = erofs_metabox_bmgr(sbi) ?: bmgr;
        bh = erofs_balloc(ibmgr, INODE, inodesize, inode->idata_size);
        if (bh == ERR_PTR(-ENOSPC)) {
                int ret;
-- 
2.43.5


Reply via email to