Commit 8bd98f0e authored by Alex Lyakas's avatar Alex Lyakas Committed by David Sterba

btrfs: csum_tree_block: return proper errno value

Signed-off-by: default avatarAlex Lyakas <alex@zadarastorage.com>
Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 5e33a2bd
...@@ -302,7 +302,7 @@ static int csum_tree_block(struct btrfs_fs_info *fs_info, ...@@ -302,7 +302,7 @@ static int csum_tree_block(struct btrfs_fs_info *fs_info,
err = map_private_extent_buffer(buf, offset, 32, err = map_private_extent_buffer(buf, offset, 32,
&kaddr, &map_start, &map_len); &kaddr, &map_start, &map_len);
if (err) if (err)
return 1; return err;
cur_len = min(len, map_len - (offset - map_start)); cur_len = min(len, map_len - (offset - map_start));
crc = btrfs_csum_data(kaddr + offset - map_start, crc = btrfs_csum_data(kaddr + offset - map_start,
crc, cur_len); crc, cur_len);
...@@ -312,7 +312,7 @@ static int csum_tree_block(struct btrfs_fs_info *fs_info, ...@@ -312,7 +312,7 @@ static int csum_tree_block(struct btrfs_fs_info *fs_info,
if (csum_size > sizeof(inline_result)) { if (csum_size > sizeof(inline_result)) {
result = kzalloc(csum_size, GFP_NOFS); result = kzalloc(csum_size, GFP_NOFS);
if (!result) if (!result)
return 1; return -ENOMEM;
} else { } else {
result = (char *)&inline_result; result = (char *)&inline_result;
} }
...@@ -333,7 +333,7 @@ static int csum_tree_block(struct btrfs_fs_info *fs_info, ...@@ -333,7 +333,7 @@ static int csum_tree_block(struct btrfs_fs_info *fs_info,
val, found, btrfs_header_level(buf)); val, found, btrfs_header_level(buf));
if (result != (char *)&inline_result) if (result != (char *)&inline_result)
kfree(result); kfree(result);
return 1; return -EUCLEAN;
} }
} else { } else {
write_extent_buffer(buf, result, 0, csum_size); write_extent_buffer(buf, result, 0, csum_size);
...@@ -515,8 +515,7 @@ static int csum_dirty_buffer(struct btrfs_fs_info *fs_info, struct page *page) ...@@ -515,8 +515,7 @@ static int csum_dirty_buffer(struct btrfs_fs_info *fs_info, struct page *page)
found_start = btrfs_header_bytenr(eb); found_start = btrfs_header_bytenr(eb);
if (WARN_ON(found_start != start || !PageUptodate(page))) if (WARN_ON(found_start != start || !PageUptodate(page)))
return 0; return 0;
csum_tree_block(fs_info, eb, 0); return csum_tree_block(fs_info, eb, 0);
return 0;
} }
static int check_tree_block_fsid(struct btrfs_fs_info *fs_info, static int check_tree_block_fsid(struct btrfs_fs_info *fs_info,
...@@ -660,10 +659,8 @@ static int btree_readpage_end_io_hook(struct btrfs_io_bio *io_bio, ...@@ -660,10 +659,8 @@ static int btree_readpage_end_io_hook(struct btrfs_io_bio *io_bio,
eb, found_level); eb, found_level);
ret = csum_tree_block(fs_info, eb, 1); ret = csum_tree_block(fs_info, eb, 1);
if (ret) { if (ret)
ret = -EIO;
goto err; goto err;
}
/* /*
* If this is a leaf block and it is corrupt, set the corrupt bit so * If this is a leaf block and it is corrupt, set the corrupt bit so
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment