[PATCH 2/2] erofs-utils: fsck: add a check to packed inode
Yue Hu
zbestahu at gmail.com
Thu Jan 5 20:21:57 AEDT 2023
From: Yue Hu <huyue2 at coolpad.com>
Add a check to packed inode for fsck.erofs.
Signed-off-by: Yue Hu <huyue2 at coolpad.com>
---
fsck/main.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/fsck/main.c b/fsck/main.c
index 6c43816..e60b6c1 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -467,7 +467,8 @@ static int erofs_verify_inode_data(struct erofs_inode *inode, int outfd)
return ret;
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 += compressed ? inode->u.i_blocks :
BLK_ROUND_UP(inode->i_size);
}
@@ -709,6 +710,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:
@@ -744,7 +747,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)
@@ -799,6 +802,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)
--
2.17.1
More information about the Linux-erofs
mailing list