aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/scrub.c
diff options
context:
space:
mode:
authorJan Schmidt <list.btrfs@jan-o-sch.net>2011-08-04 11:15:33 -0400
committerJan Schmidt <list.btrfs@jan-o-sch.net>2011-09-29 07:38:42 -0400
commita1d3c4786a4b9c71c0767aa656a759968f7554b6 (patch)
tree1dc5596ca57f261d2816111e51a2f33928bbe4a6 /fs/btrfs/scrub.c
parentd7728c960dccf775b92f2c4139f1216275a45c44 (diff)
btrfs: btrfs_multi_bio replaced with btrfs_bio
btrfs_bio is a bio abstraction able to split and not complete after the last bio has returned (like the old btrfs_multi_bio). Additionally, btrfs_bio tracks the mirror_num used to read data which can be used for error correction purposes. Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Diffstat (limited to 'fs/btrfs/scrub.c')
-rw-r--r--fs/btrfs/scrub.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index db09f01c0e4..97142a218f0 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -572,7 +572,7 @@ static void scrub_fixup(struct scrub_bio *sbio, int ix)
572 struct scrub_dev *sdev = sbio->sdev; 572 struct scrub_dev *sdev = sbio->sdev;
573 struct btrfs_fs_info *fs_info = sdev->dev->dev_root->fs_info; 573 struct btrfs_fs_info *fs_info = sdev->dev->dev_root->fs_info;
574 struct btrfs_mapping_tree *map_tree = &fs_info->mapping_tree; 574 struct btrfs_mapping_tree *map_tree = &fs_info->mapping_tree;
575 struct btrfs_multi_bio *multi = NULL; 575 struct btrfs_bio *bbio = NULL;
576 struct scrub_fixup_nodatasum *fixup; 576 struct scrub_fixup_nodatasum *fixup;
577 u64 logical = sbio->logical + ix * PAGE_SIZE; 577 u64 logical = sbio->logical + ix * PAGE_SIZE;
578 u64 length; 578 u64 length;
@@ -610,8 +610,8 @@ static void scrub_fixup(struct scrub_bio *sbio, int ix)
610 610
611 length = PAGE_SIZE; 611 length = PAGE_SIZE;
612 ret = btrfs_map_block(map_tree, REQ_WRITE, logical, &length, 612 ret = btrfs_map_block(map_tree, REQ_WRITE, logical, &length,
613 &multi, 0); 613 &bbio, 0);
614 if (ret || !multi || length < PAGE_SIZE) { 614 if (ret || !bbio || length < PAGE_SIZE) {
615 printk(KERN_ERR 615 printk(KERN_ERR
616 "scrub_fixup: btrfs_map_block failed us for %llu\n", 616 "scrub_fixup: btrfs_map_block failed us for %llu\n",
617 (unsigned long long)logical); 617 (unsigned long long)logical);
@@ -619,19 +619,19 @@ static void scrub_fixup(struct scrub_bio *sbio, int ix)
619 return; 619 return;
620 } 620 }
621 621
622 if (multi->num_stripes == 1) 622 if (bbio->num_stripes == 1)
623 /* there aren't any replicas */ 623 /* there aren't any replicas */
624 goto uncorrectable; 624 goto uncorrectable;
625 625
626 /* 626 /*
627 * first find a good copy 627 * first find a good copy
628 */ 628 */
629 for (i = 0; i < multi->num_stripes; ++i) { 629 for (i = 0; i < bbio->num_stripes; ++i) {
630 if (i + 1 == sbio->spag[ix].mirror_num) 630 if (i + 1 == sbio->spag[ix].mirror_num)
631 continue; 631 continue;
632 632
633 if (scrub_fixup_io(READ, multi->stripes[i].dev->bdev, 633 if (scrub_fixup_io(READ, bbio->stripes[i].dev->bdev,
634 multi->stripes[i].physical >> 9, 634 bbio->stripes[i].physical >> 9,
635 sbio->bio->bi_io_vec[ix].bv_page)) { 635 sbio->bio->bi_io_vec[ix].bv_page)) {
636 /* I/O-error, this is not a good copy */ 636 /* I/O-error, this is not a good copy */
637 continue; 637 continue;
@@ -640,7 +640,7 @@ static void scrub_fixup(struct scrub_bio *sbio, int ix)
640 if (scrub_fixup_check(sbio, ix) == 0) 640 if (scrub_fixup_check(sbio, ix) == 0)
641 break; 641 break;
642 } 642 }
643 if (i == multi->num_stripes) 643 if (i == bbio->num_stripes)
644 goto uncorrectable; 644 goto uncorrectable;
645 645
646 if (!sdev->readonly) { 646 if (!sdev->readonly) {
@@ -655,7 +655,7 @@ static void scrub_fixup(struct scrub_bio *sbio, int ix)
655 } 655 }
656 } 656 }
657 657
658 kfree(multi); 658 kfree(bbio);
659 spin_lock(&sdev->stat_lock); 659 spin_lock(&sdev->stat_lock);
660 ++sdev->stat.corrected_errors; 660 ++sdev->stat.corrected_errors;
661 spin_unlock(&sdev->stat_lock); 661 spin_unlock(&sdev->stat_lock);
@@ -665,7 +665,7 @@ static void scrub_fixup(struct scrub_bio *sbio, int ix)
665 return; 665 return;
666 666
667uncorrectable: 667uncorrectable:
668 kfree(multi); 668 kfree(bbio);
669 spin_lock(&sdev->stat_lock); 669 spin_lock(&sdev->stat_lock);
670 ++sdev->stat.uncorrectable_errors; 670 ++sdev->stat.uncorrectable_errors;
671 spin_unlock(&sdev->stat_lock); 671 spin_unlock(&sdev->stat_lock);