diff mbox

[05/15] btrfs-progs: lowmem check: let check_dir_item() continue if find wrong inode_item

Message ID 20180126083519.28373-6-suy.fnst@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Su Yue Jan. 26, 2018, 8:35 a.m. UTC
check_dir_item can handle missed/mismatched inode item well.
Let it continue to check corresponding dir_item/index and inode_ref.

Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
---
 cmds-check.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

Comments

Qu Wenruo Jan. 26, 2018, 9:36 a.m. UTC | #1
On 2018年01月26日 16:35, Su Yue wrote:
> check_dir_item can handle missed/mismatched inode item well.
> Let it continue to check corresponding dir_item/index and inode_ref.
> 
> Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
>  cmds-check.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/cmds-check.c b/cmds-check.c
> index e33dd7db0048..eb65a18fe64b 100644
> --- a/cmds-check.c
> +++ b/cmds-check.c
> @@ -5984,15 +5984,12 @@ begin:
>  		ret = btrfs_search_slot(NULL, root, &location, path, 0, 0);
>  		if (ret) {
>  			tmp_err |= INODE_ITEM_MISSING;
> -			goto next;
> -		}
> -
> -		ii = btrfs_item_ptr(path->nodes[0], path->slots[0],
> -				    struct btrfs_inode_item);
> -		mode = btrfs_inode_mode(path->nodes[0], ii);
> -		if (imode_to_type(mode) != filetype) {
> -			tmp_err |= INODE_ITEM_MISMATCH;
> -			goto next;
> +		} else {
> +			ii = btrfs_item_ptr(path->nodes[0], path->slots[0],
> +					    struct btrfs_inode_item);
> +			mode = btrfs_inode_mode(path->nodes[0], ii);
> +			if (imode_to_type(mode) != filetype)
> +				tmp_err |= INODE_ITEM_MISMATCH;
>  		}
>  
>  		/* Check relative INODE_REF/INODE_EXTREF */
>
diff mbox

Patch

diff --git a/cmds-check.c b/cmds-check.c
index e33dd7db0048..eb65a18fe64b 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -5984,15 +5984,12 @@  begin:
 		ret = btrfs_search_slot(NULL, root, &location, path, 0, 0);
 		if (ret) {
 			tmp_err |= INODE_ITEM_MISSING;
-			goto next;
-		}
-
-		ii = btrfs_item_ptr(path->nodes[0], path->slots[0],
-				    struct btrfs_inode_item);
-		mode = btrfs_inode_mode(path->nodes[0], ii);
-		if (imode_to_type(mode) != filetype) {
-			tmp_err |= INODE_ITEM_MISMATCH;
-			goto next;
+		} else {
+			ii = btrfs_item_ptr(path->nodes[0], path->slots[0],
+					    struct btrfs_inode_item);
+			mode = btrfs_inode_mode(path->nodes[0], ii);
+			if (imode_to_type(mode) != filetype)
+				tmp_err |= INODE_ITEM_MISMATCH;
 		}
 
 		/* Check relative INODE_REF/INODE_EXTREF */