Lines Matching refs:caching_ctl

365 	if (!cache->caching_ctl) {  in btrfs_get_caching_control()
370 ctl = cache->caching_ctl; in btrfs_get_caching_control()
398 struct btrfs_caching_control *caching_ctl; in btrfs_wait_block_group_cache_progress() local
400 caching_ctl = btrfs_get_caching_control(cache); in btrfs_wait_block_group_cache_progress()
401 if (!caching_ctl) in btrfs_wait_block_group_cache_progress()
404 wait_event(caching_ctl->wait, btrfs_block_group_cache_done(cache) || in btrfs_wait_block_group_cache_progress()
407 btrfs_put_caching_control(caching_ctl); in btrfs_wait_block_group_cache_progress()
412 struct btrfs_caching_control *caching_ctl; in btrfs_wait_block_group_cache_done() local
415 caching_ctl = btrfs_get_caching_control(cache); in btrfs_wait_block_group_cache_done()
416 if (!caching_ctl) in btrfs_wait_block_group_cache_done()
419 wait_event(caching_ctl->wait, btrfs_block_group_cache_done(cache)); in btrfs_wait_block_group_cache_done()
422 btrfs_put_caching_control(caching_ctl); in btrfs_wait_block_group_cache_done()
492 static int load_extent_tree_free(struct btrfs_caching_control *caching_ctl) in load_extent_tree_free() argument
494 struct btrfs_block_group_cache *block_group = caching_ctl->block_group; in load_extent_tree_free()
559 caching_ctl->progress = last; in load_extent_tree_free()
562 mutex_unlock(&caching_ctl->mutex); in load_extent_tree_free()
564 mutex_lock(&caching_ctl->mutex); in load_extent_tree_free()
585 caching_ctl->progress = last; in load_extent_tree_free()
612 wake_up(&caching_ctl->wait); in load_extent_tree_free()
622 caching_ctl->progress = (u64)-1; in load_extent_tree_free()
633 struct btrfs_caching_control *caching_ctl; in caching_thread() local
636 caching_ctl = container_of(work, struct btrfs_caching_control, work); in caching_thread()
637 block_group = caching_ctl->block_group; in caching_thread()
640 mutex_lock(&caching_ctl->mutex); in caching_thread()
644 ret = load_free_space_tree(caching_ctl); in caching_thread()
646 ret = load_extent_tree_free(caching_ctl); in caching_thread()
649 block_group->caching_ctl = NULL; in caching_thread()
668 caching_ctl->progress = (u64)-1; in caching_thread()
672 mutex_unlock(&caching_ctl->mutex); in caching_thread()
674 wake_up(&caching_ctl->wait); in caching_thread()
676 btrfs_put_caching_control(caching_ctl); in caching_thread()
685 struct btrfs_caching_control *caching_ctl; in btrfs_cache_block_group() local
688 caching_ctl = kzalloc(sizeof(*caching_ctl), GFP_NOFS); in btrfs_cache_block_group()
689 if (!caching_ctl) in btrfs_cache_block_group()
692 INIT_LIST_HEAD(&caching_ctl->list); in btrfs_cache_block_group()
693 mutex_init(&caching_ctl->mutex); in btrfs_cache_block_group()
694 init_waitqueue_head(&caching_ctl->wait); in btrfs_cache_block_group()
695 caching_ctl->block_group = cache; in btrfs_cache_block_group()
696 caching_ctl->progress = cache->key.objectid; in btrfs_cache_block_group()
697 refcount_set(&caching_ctl->count, 1); in btrfs_cache_block_group()
698 btrfs_init_work(&caching_ctl->work, btrfs_cache_helper, in btrfs_cache_block_group()
717 ctl = cache->caching_ctl; in btrfs_cache_block_group()
731 kfree(caching_ctl); in btrfs_cache_block_group()
734 WARN_ON(cache->caching_ctl); in btrfs_cache_block_group()
735 cache->caching_ctl = caching_ctl; in btrfs_cache_block_group()
740 mutex_lock(&caching_ctl->mutex); in btrfs_cache_block_group()
745 cache->caching_ctl = NULL; in btrfs_cache_block_group()
748 caching_ctl->progress = (u64)-1; in btrfs_cache_block_group()
751 cache->caching_ctl = NULL; in btrfs_cache_block_group()
774 mutex_unlock(&caching_ctl->mutex); in btrfs_cache_block_group()
776 wake_up(&caching_ctl->wait); in btrfs_cache_block_group()
778 btrfs_put_caching_control(caching_ctl); in btrfs_cache_block_group()
789 cache->caching_ctl = NULL; in btrfs_cache_block_group()
796 wake_up(&caching_ctl->wait); in btrfs_cache_block_group()
800 btrfs_put_caching_control(caching_ctl); in btrfs_cache_block_group()
805 refcount_inc(&caching_ctl->count); in btrfs_cache_block_group()
806 list_add_tail(&caching_ctl->list, &fs_info->caching_block_groups); in btrfs_cache_block_group()
811 btrfs_queue_work(fs_info->caching_workers, &caching_ctl->work); in btrfs_cache_block_group()
875 struct btrfs_caching_control *caching_ctl = NULL; in btrfs_remove_block_group() local
1013 caching_ctl = btrfs_get_caching_control(block_group); in btrfs_remove_block_group()
1018 if (!caching_ctl) { in btrfs_remove_block_group()
1024 caching_ctl = ctl; in btrfs_remove_block_group()
1025 refcount_inc(&caching_ctl->count); in btrfs_remove_block_group()
1029 if (caching_ctl) in btrfs_remove_block_group()
1030 list_del_init(&caching_ctl->list); in btrfs_remove_block_group()
1032 if (caching_ctl) { in btrfs_remove_block_group()
1034 btrfs_put_caching_control(caching_ctl); in btrfs_remove_block_group()
1035 btrfs_put_caching_control(caching_ctl); in btrfs_remove_block_group()
3092 struct btrfs_caching_control *caching_ctl; in btrfs_free_block_groups() local
3097 caching_ctl = list_entry(info->caching_block_groups.next, in btrfs_free_block_groups()
3099 list_del(&caching_ctl->list); in btrfs_free_block_groups()
3100 btrfs_put_caching_control(caching_ctl); in btrfs_free_block_groups()