Lines Matching refs:caching_ctl

319 	if (!cache->caching_ctl) {  in get_caching_control()
324 ctl = cache->caching_ctl; in get_caching_control()
383 struct btrfs_caching_control *caching_ctl; in caching_thread() local
393 caching_ctl = container_of(work, struct btrfs_caching_control, work); in caching_thread()
394 block_group = caching_ctl->block_group; in caching_thread()
418 mutex_lock(&caching_ctl->mutex); in caching_thread()
445 caching_ctl->progress = last; in caching_thread()
448 mutex_unlock(&caching_ctl->mutex); in caching_thread()
468 caching_ctl->progress = last; in caching_thread()
495 wake_up(&caching_ctl->wait); in caching_thread()
505 caching_ctl->progress = (u64)-1; in caching_thread()
508 block_group->caching_ctl = NULL; in caching_thread()
518 mutex_unlock(&caching_ctl->mutex); in caching_thread()
522 block_group->caching_ctl = NULL; in caching_thread()
526 wake_up(&caching_ctl->wait); in caching_thread()
528 put_caching_control(caching_ctl); in caching_thread()
537 struct btrfs_caching_control *caching_ctl; in cache_block_group() local
540 caching_ctl = kzalloc(sizeof(*caching_ctl), GFP_NOFS); in cache_block_group()
541 if (!caching_ctl) in cache_block_group()
544 INIT_LIST_HEAD(&caching_ctl->list); in cache_block_group()
545 mutex_init(&caching_ctl->mutex); in cache_block_group()
546 init_waitqueue_head(&caching_ctl->wait); in cache_block_group()
547 caching_ctl->block_group = cache; in cache_block_group()
548 caching_ctl->progress = cache->key.objectid; in cache_block_group()
549 atomic_set(&caching_ctl->count, 1); in cache_block_group()
550 btrfs_init_work(&caching_ctl->work, btrfs_cache_helper, in cache_block_group()
569 ctl = cache->caching_ctl; in cache_block_group()
583 kfree(caching_ctl); in cache_block_group()
586 WARN_ON(cache->caching_ctl); in cache_block_group()
587 cache->caching_ctl = caching_ctl; in cache_block_group()
592 mutex_lock(&caching_ctl->mutex); in cache_block_group()
597 cache->caching_ctl = NULL; in cache_block_group()
600 caching_ctl->progress = (u64)-1; in cache_block_group()
603 cache->caching_ctl = NULL; in cache_block_group()
611 mutex_unlock(&caching_ctl->mutex); in cache_block_group()
613 wake_up(&caching_ctl->wait); in cache_block_group()
615 put_caching_control(caching_ctl); in cache_block_group()
626 cache->caching_ctl = NULL; in cache_block_group()
633 wake_up(&caching_ctl->wait); in cache_block_group()
637 put_caching_control(caching_ctl); in cache_block_group()
642 atomic_inc(&caching_ctl->count); in cache_block_group()
643 list_add_tail(&caching_ctl->list, &fs_info->caching_block_groups); in cache_block_group()
648 btrfs_queue_work(fs_info->caching_workers, &caching_ctl->work); in cache_block_group()
5814 struct btrfs_caching_control *caching_ctl; in __exclude_logged_extent() local
5821 caching_ctl = get_caching_control(block_group); in __exclude_logged_extent()
5823 if (!caching_ctl) { in __exclude_logged_extent()
5828 mutex_lock(&caching_ctl->mutex); in __exclude_logged_extent()
5830 if (start >= caching_ctl->progress) { in __exclude_logged_extent()
5832 } else if (start + num_bytes <= caching_ctl->progress) { in __exclude_logged_extent()
5836 num_bytes = caching_ctl->progress - start; in __exclude_logged_extent()
5843 caching_ctl->progress; in __exclude_logged_extent()
5844 start = caching_ctl->progress; in __exclude_logged_extent()
5848 mutex_unlock(&caching_ctl->mutex); in __exclude_logged_extent()
5849 put_caching_control(caching_ctl); in __exclude_logged_extent()
5950 struct btrfs_caching_control *caching_ctl; in btrfs_prepare_extent_commit() local
5955 list_for_each_entry_safe(caching_ctl, next, in btrfs_prepare_extent_commit()
5957 cache = caching_ctl->block_group; in btrfs_prepare_extent_commit()
5960 list_del_init(&caching_ctl->list); in btrfs_prepare_extent_commit()
5961 put_caching_control(caching_ctl); in btrfs_prepare_extent_commit()
5963 cache->last_byte_to_unpin = caching_ctl->progress; in btrfs_prepare_extent_commit()
6567 struct btrfs_caching_control *caching_ctl; in wait_block_group_cache_progress() local
6569 caching_ctl = get_caching_control(cache); in wait_block_group_cache_progress()
6570 if (!caching_ctl) in wait_block_group_cache_progress()
6573 wait_event(caching_ctl->wait, block_group_cache_done(cache) || in wait_block_group_cache_progress()
6576 put_caching_control(caching_ctl); in wait_block_group_cache_progress()
6582 struct btrfs_caching_control *caching_ctl; in wait_block_group_cache_done() local
6585 caching_ctl = get_caching_control(cache); in wait_block_group_cache_done()
6586 if (!caching_ctl) in wait_block_group_cache_done()
6589 wait_event(caching_ctl->wait, block_group_cache_done(cache)); in wait_block_group_cache_done()
6592 put_caching_control(caching_ctl); in wait_block_group_cache_done()
9155 struct btrfs_caching_control *caching_ctl; in btrfs_free_block_groups() local
9160 caching_ctl = list_entry(info->caching_block_groups.next, in btrfs_free_block_groups()
9162 list_del(&caching_ctl->list); in btrfs_free_block_groups()
9163 put_caching_control(caching_ctl); in btrfs_free_block_groups()
9634 struct btrfs_caching_control *caching_ctl = NULL; in btrfs_remove_block_group() local
9775 caching_ctl = get_caching_control(block_group); in btrfs_remove_block_group()
9780 if (!caching_ctl) { in btrfs_remove_block_group()
9786 caching_ctl = ctl; in btrfs_remove_block_group()
9787 atomic_inc(&caching_ctl->count); in btrfs_remove_block_group()
9791 if (caching_ctl) in btrfs_remove_block_group()
9792 list_del_init(&caching_ctl->list); in btrfs_remove_block_group()
9794 if (caching_ctl) { in btrfs_remove_block_group()
9796 put_caching_control(caching_ctl); in btrfs_remove_block_group()
9797 put_caching_control(caching_ctl); in btrfs_remove_block_group()