aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/reada.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/reada.c')
-rw-r--r--fs/btrfs/reada.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
index b63ae20618fb..0e7beea92b4c 100644
--- a/fs/btrfs/reada.c
+++ b/fs/btrfs/reada.c
@@ -66,7 +66,6 @@ struct reada_extctl {
66struct reada_extent { 66struct reada_extent {
67 u64 logical; 67 u64 logical;
68 struct btrfs_key top; 68 struct btrfs_key top;
69 u32 blocksize;
70 int err; 69 int err;
71 struct list_head extctl; 70 struct list_head extctl;
72 int refcnt; 71 int refcnt;
@@ -349,7 +348,6 @@ static struct reada_extent *reada_find_extent(struct btrfs_root *root,
349 348
350 blocksize = root->nodesize; 349 blocksize = root->nodesize;
351 re->logical = logical; 350 re->logical = logical;
352 re->blocksize = blocksize;
353 re->top = *top; 351 re->top = *top;
354 INIT_LIST_HEAD(&re->extctl); 352 INIT_LIST_HEAD(&re->extctl);
355 spin_lock_init(&re->lock); 353 spin_lock_init(&re->lock);
@@ -463,7 +461,7 @@ static struct reada_extent *reada_find_extent(struct btrfs_root *root,
463 spin_unlock(&fs_info->reada_lock); 461 spin_unlock(&fs_info->reada_lock);
464 btrfs_dev_replace_unlock(&fs_info->dev_replace); 462 btrfs_dev_replace_unlock(&fs_info->dev_replace);
465 463
466 kfree(bbio); 464 btrfs_put_bbio(bbio);
467 return re; 465 return re;
468 466
469error: 467error:
@@ -488,7 +486,7 @@ error:
488 kref_put(&zone->refcnt, reada_zone_release); 486 kref_put(&zone->refcnt, reada_zone_release);
489 spin_unlock(&fs_info->reada_lock); 487 spin_unlock(&fs_info->reada_lock);
490 } 488 }
491 kfree(bbio); 489 btrfs_put_bbio(bbio);
492 kfree(re); 490 kfree(re);
493 return re_exist; 491 return re_exist;
494} 492}
@@ -660,7 +658,6 @@ static int reada_start_machine_dev(struct btrfs_fs_info *fs_info,
660 int mirror_num = 0; 658 int mirror_num = 0;
661 struct extent_buffer *eb = NULL; 659 struct extent_buffer *eb = NULL;
662 u64 logical; 660 u64 logical;
663 u32 blocksize;
664 int ret; 661 int ret;
665 int i; 662 int i;
666 int need_kick = 0; 663 int need_kick = 0;
@@ -694,7 +691,7 @@ static int reada_start_machine_dev(struct btrfs_fs_info *fs_info,
694 spin_unlock(&fs_info->reada_lock); 691 spin_unlock(&fs_info->reada_lock);
695 return 0; 692 return 0;
696 } 693 }
697 dev->reada_next = re->logical + re->blocksize; 694 dev->reada_next = re->logical + fs_info->tree_root->nodesize;
698 re->refcnt++; 695 re->refcnt++;
699 696
700 spin_unlock(&fs_info->reada_lock); 697 spin_unlock(&fs_info->reada_lock);
@@ -709,7 +706,6 @@ static int reada_start_machine_dev(struct btrfs_fs_info *fs_info,
709 } 706 }
710 } 707 }
711 logical = re->logical; 708 logical = re->logical;
712 blocksize = re->blocksize;
713 709
714 spin_lock(&re->lock); 710 spin_lock(&re->lock);
715 if (re->scheduled_for == NULL) { 711 if (re->scheduled_for == NULL) {
@@ -724,8 +720,8 @@ static int reada_start_machine_dev(struct btrfs_fs_info *fs_info,
724 return 0; 720 return 0;
725 721
726 atomic_inc(&dev->reada_in_flight); 722 atomic_inc(&dev->reada_in_flight);
727 ret = reada_tree_block_flagged(fs_info->extent_root, logical, blocksize, 723 ret = reada_tree_block_flagged(fs_info->extent_root, logical,
728 mirror_num, &eb); 724 mirror_num, &eb);
729 if (ret) 725 if (ret)
730 __readahead_hook(fs_info->extent_root, NULL, logical, ret); 726 __readahead_hook(fs_info->extent_root, NULL, logical, ret);
731 else if (eb) 727 else if (eb)
@@ -851,7 +847,7 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all)
851 break; 847 break;
852 printk(KERN_DEBUG 848 printk(KERN_DEBUG
853 " re: logical %llu size %u empty %d for %lld", 849 " re: logical %llu size %u empty %d for %lld",
854 re->logical, re->blocksize, 850 re->logical, fs_info->tree_root->nodesize,
855 list_empty(&re->extctl), re->scheduled_for ? 851 list_empty(&re->extctl), re->scheduled_for ?
856 re->scheduled_for->devid : -1); 852 re->scheduled_for->devid : -1);
857 853
@@ -886,7 +882,8 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all)
886 } 882 }
887 printk(KERN_DEBUG 883 printk(KERN_DEBUG
888 "re: logical %llu size %u list empty %d for %lld", 884 "re: logical %llu size %u list empty %d for %lld",
889 re->logical, re->blocksize, list_empty(&re->extctl), 885 re->logical, fs_info->tree_root->nodesize,
886 list_empty(&re->extctl),
890 re->scheduled_for ? re->scheduled_for->devid : -1); 887 re->scheduled_for ? re->scheduled_for->devid : -1);
891 for (i = 0; i < re->nzones; ++i) { 888 for (i = 0; i < re->nzones; ++i) {
892 printk(KERN_CONT " zone %llu-%llu devs", 889 printk(KERN_CONT " zone %llu-%llu devs",