Lines Matching refs:caching_ctl
366 if (!cache->caching_ctl) { in btrfs_get_caching_control()
371 ctl = cache->caching_ctl; in btrfs_get_caching_control()
399 struct btrfs_caching_control *caching_ctl; in btrfs_wait_block_group_cache_progress() local
401 caching_ctl = btrfs_get_caching_control(cache); in btrfs_wait_block_group_cache_progress()
402 if (!caching_ctl) in btrfs_wait_block_group_cache_progress()
405 wait_event(caching_ctl->wait, btrfs_block_group_done(cache) || in btrfs_wait_block_group_cache_progress()
408 btrfs_put_caching_control(caching_ctl); in btrfs_wait_block_group_cache_progress()
413 struct btrfs_caching_control *caching_ctl; in btrfs_wait_block_group_cache_done() local
416 caching_ctl = btrfs_get_caching_control(cache); in btrfs_wait_block_group_cache_done()
417 if (!caching_ctl) in btrfs_wait_block_group_cache_done()
420 wait_event(caching_ctl->wait, btrfs_block_group_done(cache)); in btrfs_wait_block_group_cache_done()
423 btrfs_put_caching_control(caching_ctl); in btrfs_wait_block_group_cache_done()
493 static int load_extent_tree_free(struct btrfs_caching_control *caching_ctl) in load_extent_tree_free() argument
495 struct btrfs_block_group *block_group = caching_ctl->block_group; in load_extent_tree_free()
560 caching_ctl->progress = last; in load_extent_tree_free()
563 mutex_unlock(&caching_ctl->mutex); in load_extent_tree_free()
565 mutex_lock(&caching_ctl->mutex); in load_extent_tree_free()
586 caching_ctl->progress = last; in load_extent_tree_free()
612 wake_up(&caching_ctl->wait); in load_extent_tree_free()
621 caching_ctl->progress = (u64)-1; in load_extent_tree_free()
632 struct btrfs_caching_control *caching_ctl; in caching_thread() local
635 caching_ctl = container_of(work, struct btrfs_caching_control, work); in caching_thread()
636 block_group = caching_ctl->block_group; in caching_thread()
639 mutex_lock(&caching_ctl->mutex); in caching_thread()
643 ret = load_free_space_tree(caching_ctl); in caching_thread()
645 ret = load_extent_tree_free(caching_ctl); in caching_thread()
648 block_group->caching_ctl = NULL; in caching_thread()
666 caching_ctl->progress = (u64)-1; in caching_thread()
670 mutex_unlock(&caching_ctl->mutex); in caching_thread()
672 wake_up(&caching_ctl->wait); in caching_thread()
674 btrfs_put_caching_control(caching_ctl); in caching_thread()
682 struct btrfs_caching_control *caching_ctl; in btrfs_cache_block_group() local
685 caching_ctl = kzalloc(sizeof(*caching_ctl), GFP_NOFS); in btrfs_cache_block_group()
686 if (!caching_ctl) in btrfs_cache_block_group()
689 INIT_LIST_HEAD(&caching_ctl->list); in btrfs_cache_block_group()
690 mutex_init(&caching_ctl->mutex); in btrfs_cache_block_group()
691 init_waitqueue_head(&caching_ctl->wait); in btrfs_cache_block_group()
692 caching_ctl->block_group = cache; in btrfs_cache_block_group()
693 caching_ctl->progress = cache->start; in btrfs_cache_block_group()
694 refcount_set(&caching_ctl->count, 1); in btrfs_cache_block_group()
695 btrfs_init_work(&caching_ctl->work, caching_thread, NULL, NULL); in btrfs_cache_block_group()
713 ctl = cache->caching_ctl; in btrfs_cache_block_group()
727 kfree(caching_ctl); in btrfs_cache_block_group()
730 WARN_ON(cache->caching_ctl); in btrfs_cache_block_group()
731 cache->caching_ctl = caching_ctl; in btrfs_cache_block_group()
736 mutex_lock(&caching_ctl->mutex); in btrfs_cache_block_group()
741 cache->caching_ctl = NULL; in btrfs_cache_block_group()
744 caching_ctl->progress = (u64)-1; in btrfs_cache_block_group()
747 cache->caching_ctl = NULL; in btrfs_cache_block_group()
769 mutex_unlock(&caching_ctl->mutex); in btrfs_cache_block_group()
771 wake_up(&caching_ctl->wait); in btrfs_cache_block_group()
773 btrfs_put_caching_control(caching_ctl); in btrfs_cache_block_group()
784 cache->caching_ctl = NULL; in btrfs_cache_block_group()
791 wake_up(&caching_ctl->wait); in btrfs_cache_block_group()
795 btrfs_put_caching_control(caching_ctl); in btrfs_cache_block_group()
800 refcount_inc(&caching_ctl->count); in btrfs_cache_block_group()
801 list_add_tail(&caching_ctl->list, &fs_info->caching_block_groups); in btrfs_cache_block_group()
806 btrfs_queue_work(fs_info->caching_workers, &caching_ctl->work); in btrfs_cache_block_group()
902 struct btrfs_caching_control *caching_ctl = NULL; in btrfs_remove_block_group() local
1042 caching_ctl = btrfs_get_caching_control(block_group); in btrfs_remove_block_group()
1047 if (!caching_ctl) { in btrfs_remove_block_group()
1053 caching_ctl = ctl; in btrfs_remove_block_group()
1054 refcount_inc(&caching_ctl->count); in btrfs_remove_block_group()
1058 if (caching_ctl) in btrfs_remove_block_group()
1059 list_del_init(&caching_ctl->list); in btrfs_remove_block_group()
1061 if (caching_ctl) { in btrfs_remove_block_group()
1063 btrfs_put_caching_control(caching_ctl); in btrfs_remove_block_group()
1064 btrfs_put_caching_control(caching_ctl); in btrfs_remove_block_group()
3307 struct btrfs_caching_control *caching_ctl; in btrfs_free_block_groups() local
3312 caching_ctl = list_entry(info->caching_block_groups.next, in btrfs_free_block_groups()
3314 list_del(&caching_ctl->list); in btrfs_free_block_groups()
3315 btrfs_put_caching_control(caching_ctl); in btrfs_free_block_groups()