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()
651 ret = load_free_space_tree(caching_ctl); in caching_thread()
653 ret = load_extent_tree_free(caching_ctl); in caching_thread()
656 block_group->caching_ctl = NULL; in caching_thread()
674 caching_ctl->progress = (u64)-1; in caching_thread()
678 mutex_unlock(&caching_ctl->mutex); in caching_thread()
680 wake_up(&caching_ctl->wait); in caching_thread()
682 btrfs_put_caching_control(caching_ctl); in caching_thread()
690 struct btrfs_caching_control *caching_ctl; in btrfs_cache_block_group() local
693 caching_ctl = kzalloc(sizeof(*caching_ctl), GFP_NOFS); in btrfs_cache_block_group()
694 if (!caching_ctl) in btrfs_cache_block_group()
697 INIT_LIST_HEAD(&caching_ctl->list); in btrfs_cache_block_group()
698 mutex_init(&caching_ctl->mutex); in btrfs_cache_block_group()
699 init_waitqueue_head(&caching_ctl->wait); in btrfs_cache_block_group()
700 caching_ctl->block_group = cache; in btrfs_cache_block_group()
701 caching_ctl->progress = cache->start; in btrfs_cache_block_group()
702 refcount_set(&caching_ctl->count, 1); in btrfs_cache_block_group()
703 btrfs_init_work(&caching_ctl->work, caching_thread, NULL, NULL); in btrfs_cache_block_group()
721 ctl = cache->caching_ctl; in btrfs_cache_block_group()
735 kfree(caching_ctl); in btrfs_cache_block_group()
738 WARN_ON(cache->caching_ctl); in btrfs_cache_block_group()
739 cache->caching_ctl = caching_ctl; in btrfs_cache_block_group()
744 mutex_lock(&caching_ctl->mutex); in btrfs_cache_block_group()
749 cache->caching_ctl = NULL; in btrfs_cache_block_group()
752 caching_ctl->progress = (u64)-1; in btrfs_cache_block_group()
755 cache->caching_ctl = NULL; in btrfs_cache_block_group()
777 mutex_unlock(&caching_ctl->mutex); in btrfs_cache_block_group()
779 wake_up(&caching_ctl->wait); in btrfs_cache_block_group()
781 btrfs_put_caching_control(caching_ctl); in btrfs_cache_block_group()
792 cache->caching_ctl = NULL; in btrfs_cache_block_group()
799 wake_up(&caching_ctl->wait); in btrfs_cache_block_group()
803 btrfs_put_caching_control(caching_ctl); in btrfs_cache_block_group()
808 refcount_inc(&caching_ctl->count); in btrfs_cache_block_group()
809 list_add_tail(&caching_ctl->list, &fs_info->caching_block_groups); in btrfs_cache_block_group()
814 btrfs_queue_work(fs_info->caching_workers, &caching_ctl->work); in btrfs_cache_block_group()
910 struct btrfs_caching_control *caching_ctl = NULL; in btrfs_remove_block_group() local
1050 caching_ctl = btrfs_get_caching_control(block_group); in btrfs_remove_block_group()
1055 if (!caching_ctl) { in btrfs_remove_block_group()
1061 caching_ctl = ctl; in btrfs_remove_block_group()
1062 refcount_inc(&caching_ctl->count); in btrfs_remove_block_group()
1066 if (caching_ctl) in btrfs_remove_block_group()
1067 list_del_init(&caching_ctl->list); in btrfs_remove_block_group()
1069 if (caching_ctl) { in btrfs_remove_block_group()
1071 btrfs_put_caching_control(caching_ctl); in btrfs_remove_block_group()
1072 btrfs_put_caching_control(caching_ctl); in btrfs_remove_block_group()
3321 struct btrfs_caching_control *caching_ctl; in btrfs_free_block_groups() local
3326 caching_ctl = list_entry(info->caching_block_groups.next, in btrfs_free_block_groups()
3328 list_del(&caching_ctl->list); in btrfs_free_block_groups()
3329 btrfs_put_caching_control(caching_ctl); in btrfs_free_block_groups()