return ret;
}
-static void print_tree_block_err(struct btrfs_root *root,
+static void print_tree_block_error(struct btrfs_root *root,
struct extent_buffer *eb,
int err)
{
{
u16 csum_size =
btrfs_super_csum_size(root->fs_info->super_copy);
+ if (verify && root->fs_info->suppress_check_block_errors)
+ return verify_tree_block_csum_silent(buf, csum_size);
return csum_tree_block_size(buf, csum_size, verify);
}
while (1) {
ret = read_whole_eb(root->fs_info, eb, mirror_num);
- if (ret == 0 && check_tree_block(root, eb) == 0 &&
- csum_tree_block(root, eb, 1) == 0 &&
+ if (ret == 0 && csum_tree_block(root, eb, 1) == 0 &&
+ check_tree_block(root, eb) == 0 &&
verify_parent_transid(eb->tree, eb, parent_transid, ignore)
== 0) {
if (eb->flags & EXTENT_BAD_TRANSID &&
return eb;
}
if (ignore) {
- if (check_tree_block(root, eb))
- print_tree_block_err(root, eb,
+ if (check_tree_block(root, eb)) {
+ if (!root->fs_info->suppress_check_block_errors)
+ print_tree_block_error(root, eb,
check_tree_block(root, eb));
- else
- printk("Csum didn't match\n");
+ } else {
+ if (!root->fs_info->suppress_check_block_errors)
+ fprintf(stderr, "Csum didn't match\n");
+ }
ret = -EIO;
break;
}
struct extent_buffer *eb)
{
if (check_tree_block(root, eb)) {
- print_tree_block_err(root, eb, check_tree_block(root, eb));
+ print_tree_block_error(root, eb, check_tree_block(root, eb));
BUG();
}
}
if (flags & OPEN_CTREE_RESTORE)
fs_info->on_restoring = 1;
+ if (flags & OPEN_CTREE_SUPPRESS_CHECK_BLOCK_ERRORS)
+ fs_info->suppress_check_block_errors = 1;
ret = btrfs_scan_fs_devices(fp, path, &fs_devices, sb_bytenr,
(flags & OPEN_CTREE_RECOVER_SUPER),