Lines Matching refs:fs_info
80 struct btrfs_fs_info *fs_info;
86 static void reada_start_machine(struct btrfs_fs_info *fs_info);
87 static void __reada_start_machine(struct btrfs_fs_info *fs_info);
94 static void __readahead_hook(struct btrfs_fs_info *fs_info,
159 btrfs_debug(fs_info,
192 reada_extent_put(fs_info, re); /* one ref for each entry */
200 struct btrfs_fs_info *fs_info = eb->fs_info;
205 spin_lock(&fs_info->reada_lock);
206 re = radix_tree_lookup(&fs_info->reada_tree,
210 spin_unlock(&fs_info->reada_lock);
216 __readahead_hook(fs_info, re, eb, err);
217 reada_extent_put(fs_info, re); /* our ref */
220 reada_start_machine(fs_info);
227 struct btrfs_fs_info *fs_info = dev->fs_info;
236 spin_lock(&fs_info->reada_lock);
241 spin_unlock(&fs_info->reada_lock);
245 spin_unlock(&fs_info->reada_lock);
247 cache = btrfs_lookup_block_group(fs_info, logical);
279 spin_lock(&fs_info->reada_lock);
293 spin_unlock(&fs_info->reada_lock);
299 static struct reada_extent *reada_find_extent(struct btrfs_fs_info *fs_info,
316 spin_lock(&fs_info->reada_lock);
317 re = radix_tree_lookup(&fs_info->reada_tree, index);
320 spin_unlock(&fs_info->reada_lock);
338 length = fs_info->nodesize;
339 ret = btrfs_map_block(fs_info, BTRFS_MAP_GET_READ_MIRRORS, logical,
341 if (ret || !bbio || length < fs_info->nodesize)
345 btrfs_err(fs_info,
371 spin_lock(&fs_info->reada_lock);
373 spin_unlock(&fs_info->reada_lock);
381 down_read(&fs_info->dev_replace.rwsem);
384 up_read(&fs_info->dev_replace.rwsem);
388 spin_lock(&fs_info->reada_lock);
389 ret = radix_tree_insert(&fs_info->reada_tree, index, re);
391 re_exist = radix_tree_lookup(&fs_info->reada_tree, index);
393 spin_unlock(&fs_info->reada_lock);
395 up_read(&fs_info->dev_replace.rwsem);
399 spin_unlock(&fs_info->reada_lock);
401 up_read(&fs_info->dev_replace.rwsem);
407 &fs_info->dev_replace);
428 dev == fs_info->dev_replace.tgtdev) {
444 radix_tree_delete(&fs_info->reada_tree, index);
445 spin_unlock(&fs_info->reada_lock);
446 up_read(&fs_info->dev_replace.rwsem);
452 radix_tree_delete(&fs_info->reada_tree, index);
453 spin_unlock(&fs_info->reada_lock);
454 up_read(&fs_info->dev_replace.rwsem);
472 * no fs_info->reada_lock needed, as this can't be
479 spin_lock(&fs_info->reada_lock);
481 spin_unlock(&fs_info->reada_lock);
488 static void reada_extent_put(struct btrfs_fs_info *fs_info,
494 spin_lock(&fs_info->reada_lock);
496 spin_unlock(&fs_info->reada_lock);
500 radix_tree_delete(&fs_info->reada_tree, index);
507 spin_unlock(&fs_info->reada_lock);
516 /* no fs_info->reada_lock needed, as this can't be
522 spin_lock(&fs_info->reada_lock);
524 spin_unlock(&fs_info->reada_lock);
551 struct btrfs_fs_info *fs_info = rc->fs_info;
556 re = reada_find_extent(fs_info, logical, top);
562 reada_extent_put(fs_info, re);
580 * called with fs_info->reada_lock held
596 * called with fs_info->reada_lock held
647 static int reada_tree_block_flagged(struct btrfs_fs_info *fs_info, u64 bytenr,
653 buf = btrfs_find_create_tree_block(fs_info, bytenr);
678 struct btrfs_fs_info *fs_info = dev->fs_info;
686 spin_lock(&fs_info->reada_lock);
690 spin_unlock(&fs_info->reada_lock);
704 spin_unlock(&fs_info->reada_lock);
712 spin_unlock(&fs_info->reada_lock);
715 dev->reada_next = re->logical + fs_info->nodesize;
718 spin_unlock(&fs_info->reada_lock);
723 reada_extent_put(fs_info, re);
741 ret = reada_tree_block_flagged(fs_info, logical, mirror_num, &eb);
743 __readahead_hook(fs_info, re, NULL, ret);
745 __readahead_hook(fs_info, re, eb, ret);
751 reada_extent_put(fs_info, re);
767 __reada_start_machine(rmw->fs_info);
770 atomic_dec(&rmw->fs_info->reada_works_cnt);
795 static void __reada_start_machine(struct btrfs_fs_info *fs_info)
797 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices, *seed_devs;
819 reada_start_machine(fs_info);
820 if (atomic_read(&fs_info->reada_works_cnt) >
826 static void reada_start_machine(struct btrfs_fs_info *fs_info)
836 rmw->fs_info = fs_info;
838 btrfs_queue_work(fs_info->readahead_workers, &rmw->work);
839 atomic_inc(&fs_info->reada_works_cnt);
843 static void dump_devs(struct btrfs_fs_info *fs_info, int all)
846 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
853 spin_lock(&fs_info->reada_lock);
855 btrfs_debug(fs_info, "dev %lld has %d in flight", device->devid,
887 re->logical, fs_info->nodesize,
911 ret = radix_tree_gang_lookup(&fs_info->reada_tree, (void **)&re,
920 re->logical, fs_info->nodesize,
934 spin_unlock(&fs_info->reada_lock);
959 rc->fs_info = root->fs_info;
978 reada_start_machine(root->fs_info);
987 struct btrfs_fs_info *fs_info = rc->fs_info;
990 if (!atomic_read(&fs_info->reada_works_cnt))
991 reada_start_machine(fs_info);
994 dump_devs(fs_info, atomic_read(&rc->elems) < 10 ? 1 : 0);
997 dump_devs(fs_info, atomic_read(&rc->elems) < 10 ? 1 : 0);
1007 struct btrfs_fs_info *fs_info = rc->fs_info;
1010 if (!atomic_read(&fs_info->reada_works_cnt))
1011 reada_start_machine(fs_info);
1039 struct btrfs_fs_info *fs_info = dev->fs_info;
1042 spin_lock(&fs_info->reada_lock);
1044 spin_unlock(&fs_info->reada_lock);
1054 reada_start_machine(fs_info);
1055 btrfs_flush_workqueue(fs_info->readahead_workers);
1066 spin_lock(&dev->fs_info->reada_lock);
1068 spin_unlock(&dev->fs_info->reada_lock);