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