erofs-utils: fsck: don't dump packed inode data if unneeded
authorGao Xiang <hsiangkao@linux.alibaba.com>
Fri, 24 Jan 2025 09:06:28 +0000 (17:06 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Thu, 6 Feb 2025 05:01:10 +0000 (13:01 +0800)
It was a vain attempt.

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20250124090628.2865088-2-hsiangkao@linux.alibaba.com
fsck/main.c

index b1d6214497576748fb85bbfe27f6b3c024a4d87d..372fee67ad6fbcf3a8fc769097e138c80b734f38 100644 (file)
@@ -518,6 +518,7 @@ static int erofs_verify_inode_data(struct erofs_inode *inode, int outfd)
        struct erofs_map_blocks map = {
                .index = UINT_MAX,
        };
+       bool needdecode = fsckcfg.check_decomp && !erofs_is_packed_inode(inode);
        int ret = 0;
        bool compressed;
        erofs_off_t pos = 0;
@@ -552,7 +553,7 @@ static int erofs_verify_inode_data(struct erofs_inode *inode, int outfd)
                pos += map.m_llen;
 
                /* should skip decomp? */
-               if (map.m_la >= inode->i_size || !fsckcfg.check_decomp)
+               if (map.m_la >= inode->i_size || !needdecode)
                        continue;
 
                if (outfd >= 0 && !(map.m_flags & EROFS_MAP_MAPPED)) {
@@ -918,7 +919,7 @@ static int erofsfsck_extract_inode(struct erofs_inode *inode)
        int ret;
        char *oldpath;
 
-       if (!fsckcfg.extract_path) {
+       if (!fsckcfg.extract_path || erofs_is_packed_inode(inode)) {
 verify:
                /* verify data chunk layout */
                return erofs_verify_inode_data(inode, -1);
@@ -939,8 +940,6 @@ verify:
                ret = erofs_extract_dir(inode);
                break;
        case S_IFREG:
-               if (erofs_is_packed_inode(inode))
-                       goto verify;
                ret = erofs_extract_file(inode);
                break;
        case S_IFLNK: