aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/scrub.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/scrub.c')
-rw-r--r--fs/btrfs/scrub.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index bc015f77f3ea..2f3d6f917fb3 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -998,6 +998,7 @@ static int scrub_setup_recheck_block(struct scrub_dev *sdev,
998 page = sblock->pagev + page_index; 998 page = sblock->pagev + page_index;
999 page->logical = logical; 999 page->logical = logical;
1000 page->physical = bbio->stripes[mirror_index].physical; 1000 page->physical = bbio->stripes[mirror_index].physical;
1001 /* for missing devices, bdev is NULL */
1001 page->bdev = bbio->stripes[mirror_index].dev->bdev; 1002 page->bdev = bbio->stripes[mirror_index].dev->bdev;
1002 page->mirror_num = mirror_index + 1; 1003 page->mirror_num = mirror_index + 1;
1003 page->page = alloc_page(GFP_NOFS); 1004 page->page = alloc_page(GFP_NOFS);
@@ -1042,6 +1043,12 @@ static int scrub_recheck_block(struct btrfs_fs_info *fs_info,
1042 struct scrub_page *page = sblock->pagev + page_num; 1043 struct scrub_page *page = sblock->pagev + page_num;
1043 DECLARE_COMPLETION_ONSTACK(complete); 1044 DECLARE_COMPLETION_ONSTACK(complete);
1044 1045
1046 if (page->bdev == NULL) {
1047 page->io_error = 1;
1048 sblock->no_io_error_seen = 0;
1049 continue;
1050 }
1051
1045 BUG_ON(!page->page); 1052 BUG_ON(!page->page);
1046 bio = bio_alloc(GFP_NOFS, 1); 1053 bio = bio_alloc(GFP_NOFS, 1);
1047 if (!bio) 1054 if (!bio)
@@ -1257,12 +1264,6 @@ static int scrub_checksum_data(struct scrub_block *sblock)
1257 if (memcmp(csum, on_disk_csum, sdev->csum_size)) 1264 if (memcmp(csum, on_disk_csum, sdev->csum_size))
1258 fail = 1; 1265 fail = 1;
1259 1266
1260 if (fail) {
1261 spin_lock(&sdev->stat_lock);
1262 ++sdev->stat.csum_errors;
1263 spin_unlock(&sdev->stat_lock);
1264 }
1265
1266 return fail; 1267 return fail;
1267} 1268}
1268 1269
@@ -1335,15 +1336,6 @@ static int scrub_checksum_tree_block(struct scrub_block *sblock)
1335 if (memcmp(calculated_csum, on_disk_csum, sdev->csum_size)) 1336 if (memcmp(calculated_csum, on_disk_csum, sdev->csum_size))
1336 ++crc_fail; 1337 ++crc_fail;
1337 1338
1338 if (crc_fail || fail) {
1339 spin_lock(&sdev->stat_lock);
1340 if (crc_fail)
1341 ++sdev->stat.csum_errors;
1342 if (fail)
1343 ++sdev->stat.verify_errors;
1344 spin_unlock(&sdev->stat_lock);
1345 }
1346
1347 return fail || crc_fail; 1339 return fail || crc_fail;
1348} 1340}
1349 1341