return 0;
}
-static struct btrfs_caching_control *
-get_caching_control(struct btrfs_block_group_cache *cache)
+struct btrfs_caching_control *btrfs_get_caching_control(
+ struct btrfs_block_group_cache *cache)
{
struct btrfs_caching_control *ctl;
return ctl;
}
-static void put_caching_control(struct btrfs_caching_control *ctl)
+void btrfs_put_caching_control(struct btrfs_caching_control *ctl)
{
if (refcount_dec_and_test(&ctl->count))
kfree(ctl);
wake_up(&caching_ctl->wait);
- put_caching_control(caching_ctl);
+ btrfs_put_caching_control(caching_ctl);
btrfs_put_block_group(block_group);
}
schedule();
finish_wait(&ctl->wait, &wait);
- put_caching_control(ctl);
+ btrfs_put_caching_control(ctl);
spin_lock(&cache->lock);
}
wake_up(&caching_ctl->wait);
if (ret == 1) {
- put_caching_control(caching_ctl);
+ btrfs_put_caching_control(caching_ctl);
btrfs_free_excluded_extents(cache);
return 0;
}
}
if (load_cache_only) {
- put_caching_control(caching_ctl);
+ btrfs_put_caching_control(caching_ctl);
return 0;
}
return -EINVAL;
btrfs_cache_block_group(block_group, 0);
- caching_ctl = get_caching_control(block_group);
+ caching_ctl = btrfs_get_caching_control(block_group);
if (!caching_ctl) {
/* Logic error */
}
out_lock:
mutex_unlock(&caching_ctl->mutex);
- put_caching_control(caching_ctl);
+ btrfs_put_caching_control(caching_ctl);
}
btrfs_put_block_group(block_group);
return ret;
if (btrfs_block_group_cache_done(cache)) {
cache->last_byte_to_unpin = (u64)-1;
list_del_init(&caching_ctl->list);
- put_caching_control(caching_ctl);
+ btrfs_put_caching_control(caching_ctl);
} else {
cache->last_byte_to_unpin = caching_ctl->progress;
}
{
struct btrfs_caching_control *caching_ctl;
- caching_ctl = get_caching_control(cache);
+ caching_ctl = btrfs_get_caching_control(cache);
if (!caching_ctl)
return;
wait_event(caching_ctl->wait, btrfs_block_group_cache_done(cache) ||
(cache->free_space_ctl->free_space >= num_bytes));
- put_caching_control(caching_ctl);
+ btrfs_put_caching_control(caching_ctl);
}
int btrfs_wait_block_group_cache_done(struct btrfs_block_group_cache *cache)
struct btrfs_caching_control *caching_ctl;
int ret = 0;
- caching_ctl = get_caching_control(cache);
+ caching_ctl = btrfs_get_caching_control(cache);
if (!caching_ctl)
return (cache->cached == BTRFS_CACHE_ERROR) ? -EIO : 0;
wait_event(caching_ctl->wait, btrfs_block_group_cache_done(cache));
if (cache->cached == BTRFS_CACHE_ERROR)
ret = -EIO;
- put_caching_control(caching_ctl);
+ btrfs_put_caching_control(caching_ctl);
return ret;
}
caching_ctl = list_entry(info->caching_block_groups.next,
struct btrfs_caching_control, list);
list_del(&caching_ctl->list);
- put_caching_control(caching_ctl);
+ btrfs_put_caching_control(caching_ctl);
}
up_write(&info->commit_root_sem);
}
if (block_group->has_caching_ctl)
- caching_ctl = get_caching_control(block_group);
+ caching_ctl = btrfs_get_caching_control(block_group);
if (block_group->cached == BTRFS_CACHE_STARTED)
btrfs_wait_block_group_cache_done(block_group);
if (block_group->has_caching_ctl) {
up_write(&fs_info->commit_root_sem);
if (caching_ctl) {
/* Once for the caching bgs list and once for us. */
- put_caching_control(caching_ctl);
- put_caching_control(caching_ctl);
+ btrfs_put_caching_control(caching_ctl);
+ btrfs_put_caching_control(caching_ctl);
}
}