Skip to content

Commit a1d3c47

Browse files
author
Jan Schmidt
committed
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 <[email protected]>
1 parent d7728c9 commit a1d3c47

File tree

4 files changed

+90
-78
lines changed

4 files changed

+90
-78
lines changed

fs/btrfs/extent-tree.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,18 +1770,18 @@ static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr,
17701770
{
17711771
int ret;
17721772
u64 discarded_bytes = 0;
1773-
struct btrfs_multi_bio *multi = NULL;
1773+
struct btrfs_bio *bbio = NULL;
17741774

17751775

17761776
/* Tell the block device(s) that the sectors can be discarded */
17771777
ret = btrfs_map_block(&root->fs_info->mapping_tree, REQ_DISCARD,
1778-
bytenr, &num_bytes, &multi, 0);
1778+
bytenr, &num_bytes, &bbio, 0);
17791779
if (!ret) {
1780-
struct btrfs_bio_stripe *stripe = multi->stripes;
1780+
struct btrfs_bio_stripe *stripe = bbio->stripes;
17811781
int i;
17821782

17831783

1784-
for (i = 0; i < multi->num_stripes; i++, stripe++) {
1784+
for (i = 0; i < bbio->num_stripes; i++, stripe++) {
17851785
if (!stripe->dev->can_discard)
17861786
continue;
17871787

@@ -1800,7 +1800,7 @@ static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr,
18001800
*/
18011801
ret = 0;
18021802
}
1803-
kfree(multi);
1803+
kfree(bbio);
18041804
}
18051805

18061806
if (actual_bytes)

fs/btrfs/scrub.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ static void scrub_fixup(struct scrub_bio *sbio, int ix)
572572
struct scrub_dev *sdev = sbio->sdev;
573573
struct btrfs_fs_info *fs_info = sdev->dev->dev_root->fs_info;
574574
struct btrfs_mapping_tree *map_tree = &fs_info->mapping_tree;
575-
struct btrfs_multi_bio *multi = NULL;
575+
struct btrfs_bio *bbio = NULL;
576576
struct scrub_fixup_nodatasum *fixup;
577577
u64 logical = sbio->logical + ix * PAGE_SIZE;
578578
u64 length;
@@ -610,28 +610,28 @@ static void scrub_fixup(struct scrub_bio *sbio, int ix)
610610

611611
length = PAGE_SIZE;
612612
ret = btrfs_map_block(map_tree, REQ_WRITE, logical, &length,
613-
&multi, 0);
614-
if (ret || !multi || length < PAGE_SIZE) {
613+
&bbio, 0);
614+
if (ret || !bbio || length < PAGE_SIZE) {
615615
printk(KERN_ERR
616616
"scrub_fixup: btrfs_map_block failed us for %llu\n",
617617
(unsigned long long)logical);
618618
WARN_ON(1);
619619
return;
620620
}
621621

622-
if (multi->num_stripes == 1)
622+
if (bbio->num_stripes == 1)
623623
/* there aren't any replicas */
624624
goto uncorrectable;
625625

626626
/*
627627
* first find a good copy
628628
*/
629-
for (i = 0; i < multi->num_stripes; ++i) {
629+
for (i = 0; i < bbio->num_stripes; ++i) {
630630
if (i + 1 == sbio->spag[ix].mirror_num)
631631
continue;
632632

633-
if (scrub_fixup_io(READ, multi->stripes[i].dev->bdev,
634-
multi->stripes[i].physical >> 9,
633+
if (scrub_fixup_io(READ, bbio->stripes[i].dev->bdev,
634+
bbio->stripes[i].physical >> 9,
635635
sbio->bio->bi_io_vec[ix].bv_page)) {
636636
/* I/O-error, this is not a good copy */
637637
continue;
@@ -640,7 +640,7 @@ static void scrub_fixup(struct scrub_bio *sbio, int ix)
640640
if (scrub_fixup_check(sbio, ix) == 0)
641641
break;
642642
}
643-
if (i == multi->num_stripes)
643+
if (i == bbio->num_stripes)
644644
goto uncorrectable;
645645

646646
if (!sdev->readonly) {
@@ -655,7 +655,7 @@ static void scrub_fixup(struct scrub_bio *sbio, int ix)
655655
}
656656
}
657657

658-
kfree(multi);
658+
kfree(bbio);
659659
spin_lock(&sdev->stat_lock);
660660
++sdev->stat.corrected_errors;
661661
spin_unlock(&sdev->stat_lock);
@@ -665,7 +665,7 @@ static void scrub_fixup(struct scrub_bio *sbio, int ix)
665665
return;
666666

667667
uncorrectable:
668-
kfree(multi);
668+
kfree(bbio);
669669
spin_lock(&sdev->stat_lock);
670670
++sdev->stat.uncorrectable_errors;
671671
spin_unlock(&sdev->stat_lock);

0 commit comments

Comments
 (0)