diff options
author | Yue Hu <huyue2@coolpad.com> | 2023-01-11 09:49:28 +0800 |
---|---|---|
committer | Gao Xiang <hsiangkao@linux.alibaba.com> | 2023-01-11 11:26:18 +0800 |
commit | 017f5b402d14c3ef7fc5a6b8371a11b9565754c3 (patch) | |
tree | 681f8dab828795adc33fdcb9940238e52f2f1cf9 | |
parent | 87430c69e1d542928c4519e8fabfd6348a741999 (diff) | |
download | erofs-utils-017f5b402d14c3ef7fc5a6b8371a11b9565754c3.tar.gz |
erofs-utils: fsck: add a check to packed inode
Add a check to packed inode for fsck.erofs.
Signed-off-by: Yue Hu <huyue2@coolpad.com>
Link: https://lore.kernel.org/r/ce29198d32f284c19589877c4c9e4e1588ad77b3.1673401718.git.huyue2@coolpad.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
-rw-r--r-- | fsck/main.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/fsck/main.c b/fsck/main.c index a01ca76..6b42252 100644 --- a/fsck/main.c +++ b/fsck/main.c @@ -450,7 +450,8 @@ static int erofs_verify_inode_data(struct erofs_inode *inode, int outfd) } if (fsckcfg.print_comp_ratio) { - fsckcfg.logical_blocks += BLK_ROUND_UP(inode->i_size); + if (!erofs_is_packed_inode(inode)) + fsckcfg.logical_blocks += BLK_ROUND_UP(inode->i_size); fsckcfg.physical_blocks += BLK_ROUND_UP(pchunk_len); } out: @@ -696,6 +697,8 @@ static int erofsfsck_check_inode(erofs_nid_t pnid, erofs_nid_t nid) 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: @@ -731,7 +734,7 @@ verify: ret = erofs_iterate_dir(&ctx, true); } - if (!ret) + if (!ret && !erofs_is_packed_inode(&inode)) erofsfsck_set_attributes(&inode, fsckcfg.extract_path); if (ret == -ECANCELED) @@ -786,6 +789,14 @@ int main(int argc, char **argv) goto exit_put_super; } + if (erofs_sb_has_fragments()) { + err = erofsfsck_check_inode(sbi.packed_nid, sbi.packed_nid); + if (err) { + erofs_err("failed to verify packed file"); + goto exit_put_super; + } + } + err = erofsfsck_check_inode(sbi.root_nid, sbi.root_nid); if (fsckcfg.corrupted) { if (!fsckcfg.extract_path) |