scrub.c (3cae210fa529d69cb25c2a3c491f29dab687b245) scrub.c (c1c9ff7c94e83fae89a742df74db51156869bad5)
1/*
2 * Copyright (C) 2011, 2012 STRATO. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,

--- 740 unchanged lines hidden (view full) ---

749 spin_lock(&sctx->stat_lock);
750 ++sctx->stat.uncorrectable_errors;
751 spin_unlock(&sctx->stat_lock);
752 btrfs_dev_replace_stats_inc(
753 &sctx->dev_root->fs_info->dev_replace.
754 num_uncorrectable_read_errors);
755 printk_ratelimited_in_rcu(KERN_ERR
756 "btrfs: unable to fixup (nodatasum) error at logical %llu on dev %s\n",
1/*
2 * Copyright (C) 2011, 2012 STRATO. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,

--- 740 unchanged lines hidden (view full) ---

749 spin_lock(&sctx->stat_lock);
750 ++sctx->stat.uncorrectable_errors;
751 spin_unlock(&sctx->stat_lock);
752 btrfs_dev_replace_stats_inc(
753 &sctx->dev_root->fs_info->dev_replace.
754 num_uncorrectable_read_errors);
755 printk_ratelimited_in_rcu(KERN_ERR
756 "btrfs: unable to fixup (nodatasum) error at logical %llu on dev %s\n",
757 (unsigned long long)fixup->logical,
758 rcu_str_deref(fixup->dev->name));
757 fixup->logical, rcu_str_deref(fixup->dev->name));
759 }
760
761 btrfs_free_path(path);
762 kfree(fixup);
763
764 scrub_pending_trans_workers_dec(sctx);
765}
766

--- 382 unchanged lines hidden (view full) ---

1149 goto did_not_correct_error;
1150 } else {
1151corrected_error:
1152 spin_lock(&sctx->stat_lock);
1153 sctx->stat.corrected_errors++;
1154 spin_unlock(&sctx->stat_lock);
1155 printk_ratelimited_in_rcu(KERN_ERR
1156 "btrfs: fixed up error at logical %llu on dev %s\n",
758 }
759
760 btrfs_free_path(path);
761 kfree(fixup);
762
763 scrub_pending_trans_workers_dec(sctx);
764}
765

--- 382 unchanged lines hidden (view full) ---

1148 goto did_not_correct_error;
1149 } else {
1150corrected_error:
1151 spin_lock(&sctx->stat_lock);
1152 sctx->stat.corrected_errors++;
1153 spin_unlock(&sctx->stat_lock);
1154 printk_ratelimited_in_rcu(KERN_ERR
1155 "btrfs: fixed up error at logical %llu on dev %s\n",
1157 (unsigned long long)logical,
1158 rcu_str_deref(dev->name));
1156 logical, rcu_str_deref(dev->name));
1159 }
1160 } else {
1161did_not_correct_error:
1162 spin_lock(&sctx->stat_lock);
1163 sctx->stat.uncorrectable_errors++;
1164 spin_unlock(&sctx->stat_lock);
1165 printk_ratelimited_in_rcu(KERN_ERR
1166 "btrfs: unable to fixup (regular) error at logical %llu on dev %s\n",
1157 }
1158 } else {
1159did_not_correct_error:
1160 spin_lock(&sctx->stat_lock);
1161 sctx->stat.uncorrectable_errors++;
1162 spin_unlock(&sctx->stat_lock);
1163 printk_ratelimited_in_rcu(KERN_ERR
1164 "btrfs: unable to fixup (regular) error at logical %llu on dev %s\n",
1167 (unsigned long long)logical,
1168 rcu_str_deref(dev->name));
1165 logical, rcu_str_deref(dev->name));
1169 }
1170
1171out:
1172 if (sblocks_for_recheck) {
1173 for (mirror_index = 0; mirror_index < BTRFS_MAX_MIRRORS;
1174 mirror_index++) {
1175 struct scrub_block *sblock = sblocks_for_recheck +
1176 mirror_index;

--- 1273 unchanged lines hidden (view full) ---

2450 flags = btrfs_extent_flags(l, extent);
2451 generation = btrfs_extent_generation(l, extent);
2452
2453 if (key.objectid < logical &&
2454 (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK)) {
2455 printk(KERN_ERR
2456 "btrfs scrub: tree block %llu spanning "
2457 "stripes, ignored. logical=%llu\n",
1166 }
1167
1168out:
1169 if (sblocks_for_recheck) {
1170 for (mirror_index = 0; mirror_index < BTRFS_MAX_MIRRORS;
1171 mirror_index++) {
1172 struct scrub_block *sblock = sblocks_for_recheck +
1173 mirror_index;

--- 1273 unchanged lines hidden (view full) ---

2447 flags = btrfs_extent_flags(l, extent);
2448 generation = btrfs_extent_generation(l, extent);
2449
2450 if (key.objectid < logical &&
2451 (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK)) {
2452 printk(KERN_ERR
2453 "btrfs scrub: tree block %llu spanning "
2454 "stripes, ignored. logical=%llu\n",
2458 (unsigned long long)key.objectid,
2459 (unsigned long long)logical);
2455 key.objectid, logical);
2460 goto next;
2461 }
2462
2463again:
2464 extent_logical = key.objectid;
2465 extent_len = bytes;
2466
2467 /*

--- 703 unchanged lines hidden (view full) ---

3171 goto out;
3172 }
3173
3174 ret = iterate_inodes_from_logical(logical, fs_info, path,
3175 copy_nocow_pages_for_inode,
3176 nocow_ctx);
3177 if (ret != 0 && ret != -ENOENT) {
3178 pr_warn("iterate_inodes_from_logical() failed: log %llu, phys %llu, len %llu, mir %llu, ret %d\n",
2456 goto next;
2457 }
2458
2459again:
2460 extent_logical = key.objectid;
2461 extent_len = bytes;
2462
2463 /*

--- 703 unchanged lines hidden (view full) ---

3167 goto out;
3168 }
3169
3170 ret = iterate_inodes_from_logical(logical, fs_info, path,
3171 copy_nocow_pages_for_inode,
3172 nocow_ctx);
3173 if (ret != 0 && ret != -ENOENT) {
3174 pr_warn("iterate_inodes_from_logical() failed: log %llu, phys %llu, len %llu, mir %llu, ret %d\n",
3179 (unsigned long long)logical,
3180 (unsigned long long)physical_for_dev_replace,
3181 (unsigned long long)len,
3175 logical, physical_for_dev_replace, len,
3182 (unsigned long long)mirror_num, ret);
3183 not_written = 1;
3184 goto out;
3185 }
3186
3187out:
3188 if (trans && !IS_ERR(trans))
3189 btrfs_end_transaction(trans, root);

--- 162 unchanged lines hidden ---
3176 (unsigned long long)mirror_num, ret);
3177 not_written = 1;
3178 goto out;
3179 }
3180
3181out:
3182 if (trans && !IS_ERR(trans))
3183 btrfs_end_transaction(trans, root);

--- 162 unchanged lines hidden ---