Lines Matching refs:caching_ctl

398 	if (!cache->caching_ctl) {  in btrfs_get_caching_control()
403 ctl = cache->caching_ctl; in btrfs_get_caching_control()
431 struct btrfs_caching_control *caching_ctl; in btrfs_wait_block_group_cache_progress() local
433 caching_ctl = btrfs_get_caching_control(cache); in btrfs_wait_block_group_cache_progress()
434 if (!caching_ctl) in btrfs_wait_block_group_cache_progress()
437 wait_event(caching_ctl->wait, btrfs_block_group_done(cache) || in btrfs_wait_block_group_cache_progress()
440 btrfs_put_caching_control(caching_ctl); in btrfs_wait_block_group_cache_progress()
444 struct btrfs_caching_control *caching_ctl) in btrfs_caching_ctl_wait_done() argument
446 wait_event(caching_ctl->wait, btrfs_block_group_done(cache)); in btrfs_caching_ctl_wait_done()
452 struct btrfs_caching_control *caching_ctl; in btrfs_wait_block_group_cache_done() local
455 caching_ctl = btrfs_get_caching_control(cache); in btrfs_wait_block_group_cache_done()
456 if (!caching_ctl) in btrfs_wait_block_group_cache_done()
458 ret = btrfs_caching_ctl_wait_done(cache, caching_ctl); in btrfs_wait_block_group_cache_done()
459 btrfs_put_caching_control(caching_ctl); in btrfs_wait_block_group_cache_done()
529 static int load_extent_tree_free(struct btrfs_caching_control *caching_ctl) in load_extent_tree_free() argument
531 struct btrfs_block_group *block_group = caching_ctl->block_group; in load_extent_tree_free()
598 mutex_unlock(&caching_ctl->mutex); in load_extent_tree_free()
600 mutex_lock(&caching_ctl->mutex); in load_extent_tree_free()
644 wake_up(&caching_ctl->wait); in load_extent_tree_free()
663 struct btrfs_caching_control *caching_ctl; in caching_thread() local
666 caching_ctl = container_of(work, struct btrfs_caching_control, work); in caching_thread()
667 block_group = caching_ctl->block_group; in caching_thread()
670 mutex_lock(&caching_ctl->mutex); in caching_thread()
687 wake_up(&caching_ctl->wait); in caching_thread()
699 ret = load_free_space_tree(caching_ctl); in caching_thread()
701 ret = load_extent_tree_free(caching_ctl); in caching_thread()
704 block_group->caching_ctl = NULL; in caching_thread()
724 mutex_unlock(&caching_ctl->mutex); in caching_thread()
726 wake_up(&caching_ctl->wait); in caching_thread()
728 btrfs_put_caching_control(caching_ctl); in caching_thread()
735 struct btrfs_caching_control *caching_ctl = NULL; in btrfs_cache_block_group() local
742 caching_ctl = kzalloc(sizeof(*caching_ctl), GFP_NOFS); in btrfs_cache_block_group()
743 if (!caching_ctl) in btrfs_cache_block_group()
746 INIT_LIST_HEAD(&caching_ctl->list); in btrfs_cache_block_group()
747 mutex_init(&caching_ctl->mutex); in btrfs_cache_block_group()
748 init_waitqueue_head(&caching_ctl->wait); in btrfs_cache_block_group()
749 caching_ctl->block_group = cache; in btrfs_cache_block_group()
750 refcount_set(&caching_ctl->count, 2); in btrfs_cache_block_group()
751 btrfs_init_work(&caching_ctl->work, caching_thread, NULL, NULL); in btrfs_cache_block_group()
755 kfree(caching_ctl); in btrfs_cache_block_group()
757 caching_ctl = cache->caching_ctl; in btrfs_cache_block_group()
758 if (caching_ctl) in btrfs_cache_block_group()
759 refcount_inc(&caching_ctl->count); in btrfs_cache_block_group()
763 WARN_ON(cache->caching_ctl); in btrfs_cache_block_group()
764 cache->caching_ctl = caching_ctl; in btrfs_cache_block_group()
769 refcount_inc(&caching_ctl->count); in btrfs_cache_block_group()
770 list_add_tail(&caching_ctl->list, &fs_info->caching_block_groups); in btrfs_cache_block_group()
775 btrfs_queue_work(fs_info->caching_workers, &caching_ctl->work); in btrfs_cache_block_group()
777 if (wait && caching_ctl) in btrfs_cache_block_group()
778 ret = btrfs_caching_ctl_wait_done(cache, caching_ctl); in btrfs_cache_block_group()
779 if (caching_ctl) in btrfs_cache_block_group()
780 btrfs_put_caching_control(caching_ctl); in btrfs_cache_block_group()
874 struct btrfs_caching_control *caching_ctl = NULL; in btrfs_remove_block_group() local
985 caching_ctl = btrfs_get_caching_control(block_group); in btrfs_remove_block_group()
986 if (!caching_ctl) { in btrfs_remove_block_group()
991 caching_ctl = ctl; in btrfs_remove_block_group()
992 refcount_inc(&caching_ctl->count); in btrfs_remove_block_group()
997 if (caching_ctl) in btrfs_remove_block_group()
998 list_del_init(&caching_ctl->list); in btrfs_remove_block_group()
1001 if (caching_ctl) { in btrfs_remove_block_group()
1003 btrfs_put_caching_control(caching_ctl); in btrfs_remove_block_group()
1004 btrfs_put_caching_control(caching_ctl); in btrfs_remove_block_group()
3977 struct btrfs_caching_control *caching_ctl; in btrfs_free_block_groups() local
3982 caching_ctl = list_entry(info->caching_block_groups.next, in btrfs_free_block_groups()
3984 list_del(&caching_ctl->list); in btrfs_free_block_groups()
3985 btrfs_put_caching_control(caching_ctl); in btrfs_free_block_groups()