From: Qu Wenruo Date: Mon, 22 Dec 2014 02:53:36 +0000 (+0800) Subject: btrfs-progs: Don't increase error count if the inode can be repaired. X-Git-Tag: upstream/4.16.1~2451 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e960b3f0577390a1c05913f179a444367b036a48;p=platform%2Fupstream%2Fbtrfs-progs.git btrfs-progs: Don't increase error count if the inode can be repaired. The original check_inode_recs() will return -1 if found any error in a inode_record. This is OK for original design since there is almost nothing can repair at that time. However more and more error from nlink mismatch to missing inode item can be repaired in try_repair_inode(), check_inode_recs() should not increase the error count if the inode can be repair. With this patch, repair function for leaf-corruption will not return error if all corruption inode can be recovered. Signed-off-by: Qu Wenruo Reviewed-by: Satoru Takeuchi Signed-off-by: David Sterba --- diff --git a/cmds-check.c b/cmds-check.c index e3c5d54..f06e029 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -2308,7 +2308,7 @@ static int check_inode_recs(struct btrfs_root *root, struct inode_record *rec; struct inode_backref *backref; int stage = 0; - int ret; + int ret = 0; int err = 0; u64 error = 0; u64 root_dirid = btrfs_root_dirid(&root->root_item); @@ -2458,7 +2458,8 @@ static int check_inode_recs(struct btrfs_root *root, ret = 0; } - error++; + if (!(repair && ret == 0)) + error++; print_inode_error(root, rec); list_for_each_entry(backref, &rec->backrefs, list) { if (!backref->found_dir_item)