Lines Matching refs:caching_ctl

317 	if (!cache->caching_ctl) {  in get_caching_control()
322 ctl = cache->caching_ctl; in get_caching_control()
402 struct btrfs_caching_control *caching_ctl; in caching_thread() local
413 caching_ctl = container_of(work, struct btrfs_caching_control, work); in caching_thread()
414 block_group = caching_ctl->block_group; in caching_thread()
447 mutex_lock(&caching_ctl->mutex); in caching_thread()
475 caching_ctl->progress = last; in caching_thread()
478 mutex_unlock(&caching_ctl->mutex); in caching_thread()
499 caching_ctl->progress = last; in caching_thread()
527 wake_up(&caching_ctl->wait); in caching_thread()
538 block_group->caching_ctl = NULL; in caching_thread()
557 caching_ctl->progress = (u64)-1; in caching_thread()
564 mutex_unlock(&caching_ctl->mutex); in caching_thread()
568 block_group->caching_ctl = NULL; in caching_thread()
572 wake_up(&caching_ctl->wait); in caching_thread()
574 put_caching_control(caching_ctl); in caching_thread()
583 struct btrfs_caching_control *caching_ctl; in cache_block_group() local
586 caching_ctl = kzalloc(sizeof(*caching_ctl), GFP_NOFS); in cache_block_group()
587 if (!caching_ctl) in cache_block_group()
590 INIT_LIST_HEAD(&caching_ctl->list); in cache_block_group()
591 mutex_init(&caching_ctl->mutex); in cache_block_group()
592 init_waitqueue_head(&caching_ctl->wait); in cache_block_group()
593 caching_ctl->block_group = cache; in cache_block_group()
594 caching_ctl->progress = cache->key.objectid; in cache_block_group()
595 atomic_set(&caching_ctl->count, 1); in cache_block_group()
596 btrfs_init_work(&caching_ctl->work, btrfs_cache_helper, in cache_block_group()
615 ctl = cache->caching_ctl; in cache_block_group()
629 kfree(caching_ctl); in cache_block_group()
632 WARN_ON(cache->caching_ctl); in cache_block_group()
633 cache->caching_ctl = caching_ctl; in cache_block_group()
638 mutex_lock(&caching_ctl->mutex); in cache_block_group()
643 cache->caching_ctl = NULL; in cache_block_group()
646 caching_ctl->progress = (u64)-1; in cache_block_group()
649 cache->caching_ctl = NULL; in cache_block_group()
673 mutex_unlock(&caching_ctl->mutex); in cache_block_group()
675 wake_up(&caching_ctl->wait); in cache_block_group()
677 put_caching_control(caching_ctl); in cache_block_group()
688 cache->caching_ctl = NULL; in cache_block_group()
695 wake_up(&caching_ctl->wait); in cache_block_group()
699 put_caching_control(caching_ctl); in cache_block_group()
704 atomic_inc(&caching_ctl->count); in cache_block_group()
705 list_add_tail(&caching_ctl->list, &fs_info->caching_block_groups); in cache_block_group()
710 btrfs_queue_work(fs_info->caching_workers, &caching_ctl->work); in cache_block_group()
6049 struct btrfs_caching_control *caching_ctl; in __exclude_logged_extent() local
6056 caching_ctl = get_caching_control(block_group); in __exclude_logged_extent()
6058 if (!caching_ctl) { in __exclude_logged_extent()
6063 mutex_lock(&caching_ctl->mutex); in __exclude_logged_extent()
6065 if (start >= caching_ctl->progress) { in __exclude_logged_extent()
6067 } else if (start + num_bytes <= caching_ctl->progress) { in __exclude_logged_extent()
6071 num_bytes = caching_ctl->progress - start; in __exclude_logged_extent()
6078 caching_ctl->progress; in __exclude_logged_extent()
6079 start = caching_ctl->progress; in __exclude_logged_extent()
6083 mutex_unlock(&caching_ctl->mutex); in __exclude_logged_extent()
6084 put_caching_control(caching_ctl); in __exclude_logged_extent()
6185 struct btrfs_caching_control *caching_ctl; in btrfs_prepare_extent_commit() local
6190 list_for_each_entry_safe(caching_ctl, next, in btrfs_prepare_extent_commit()
6192 cache = caching_ctl->block_group; in btrfs_prepare_extent_commit()
6195 list_del_init(&caching_ctl->list); in btrfs_prepare_extent_commit()
6196 put_caching_control(caching_ctl); in btrfs_prepare_extent_commit()
6198 cache->last_byte_to_unpin = caching_ctl->progress; in btrfs_prepare_extent_commit()
6865 struct btrfs_caching_control *caching_ctl; in wait_block_group_cache_progress() local
6867 caching_ctl = get_caching_control(cache); in wait_block_group_cache_progress()
6868 if (!caching_ctl) in wait_block_group_cache_progress()
6871 wait_event(caching_ctl->wait, block_group_cache_done(cache) || in wait_block_group_cache_progress()
6874 put_caching_control(caching_ctl); in wait_block_group_cache_progress()
6880 struct btrfs_caching_control *caching_ctl; in wait_block_group_cache_done() local
6883 caching_ctl = get_caching_control(cache); in wait_block_group_cache_done()
6884 if (!caching_ctl) in wait_block_group_cache_done()
6887 wait_event(caching_ctl->wait, block_group_cache_done(cache)); in wait_block_group_cache_done()
6890 put_caching_control(caching_ctl); in wait_block_group_cache_done()
9510 struct btrfs_caching_control *caching_ctl; in btrfs_free_block_groups() local
9515 caching_ctl = list_entry(info->caching_block_groups.next, in btrfs_free_block_groups()
9517 list_del(&caching_ctl->list); in btrfs_free_block_groups()
9518 put_caching_control(caching_ctl); in btrfs_free_block_groups()
10017 struct btrfs_caching_control *caching_ctl = NULL; in btrfs_remove_block_group() local
10158 caching_ctl = get_caching_control(block_group); in btrfs_remove_block_group()
10163 if (!caching_ctl) { in btrfs_remove_block_group()
10169 caching_ctl = ctl; in btrfs_remove_block_group()
10170 atomic_inc(&caching_ctl->count); in btrfs_remove_block_group()
10174 if (caching_ctl) in btrfs_remove_block_group()
10175 list_del_init(&caching_ctl->list); in btrfs_remove_block_group()
10177 if (caching_ctl) { in btrfs_remove_block_group()
10179 put_caching_control(caching_ctl); in btrfs_remove_block_group()
10180 put_caching_control(caching_ctl); in btrfs_remove_block_group()