btrfs: export block_rsv_use_bytes

We are going to need this to move the metadata reservation stuff to
space_info.c.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Josef Bacik 2019-06-18 16:09:23 -04:00 committed by David Sterba
parent b338b013e1
commit c2a67a76ec
2 changed files with 6 additions and 8 deletions

View File

@ -2844,6 +2844,7 @@ int btrfs_block_rsv_refill(struct btrfs_root *root,
int btrfs_block_rsv_migrate(struct btrfs_block_rsv *src_rsv,
struct btrfs_block_rsv *dst_rsv, u64 num_bytes,
bool update_size);
int btrfs_block_rsv_use_bytes(struct btrfs_block_rsv *block_rsv, u64 num_bytes);
int btrfs_cond_migrate_bytes(struct btrfs_fs_info *fs_info,
struct btrfs_block_rsv *dest, u64 num_bytes,
int min_factor);

View File

@ -53,8 +53,6 @@ static int find_next_key(struct btrfs_path *path, int level,
static void dump_space_info(struct btrfs_fs_info *fs_info,
struct btrfs_space_info *info, u64 bytes,
int dump_block_groups);
static int block_rsv_use_bytes(struct btrfs_block_rsv *block_rsv,
u64 num_bytes);
static noinline int
block_group_cache_done(struct btrfs_block_group_cache *cache)
@ -5031,7 +5029,7 @@ static int reserve_metadata_bytes(struct btrfs_root *root,
if (ret == -ENOSPC &&
unlikely(root->orphan_cleanup_state == ORPHAN_CLEANUP_STARTED)) {
if (block_rsv != global_rsv &&
!block_rsv_use_bytes(global_rsv, orig_bytes))
!btrfs_block_rsv_use_bytes(global_rsv, orig_bytes))
ret = 0;
}
if (ret == -ENOSPC) {
@ -5067,8 +5065,7 @@ static struct btrfs_block_rsv *get_block_rsv(
return block_rsv;
}
static int block_rsv_use_bytes(struct btrfs_block_rsv *block_rsv,
u64 num_bytes)
int btrfs_block_rsv_use_bytes(struct btrfs_block_rsv *block_rsv, u64 num_bytes)
{
int ret = -ENOSPC;
spin_lock(&block_rsv->lock);
@ -5265,7 +5262,7 @@ int btrfs_block_rsv_migrate(struct btrfs_block_rsv *src,
{
int ret;
ret = block_rsv_use_bytes(src, num_bytes);
ret = btrfs_block_rsv_use_bytes(src, num_bytes);
if (ret)
return ret;
@ -8134,7 +8131,7 @@ use_block_rsv(struct btrfs_trans_handle *trans,
if (unlikely(block_rsv->size == 0))
goto try_reserve;
again:
ret = block_rsv_use_bytes(block_rsv, blocksize);
ret = btrfs_block_rsv_use_bytes(block_rsv, blocksize);
if (!ret)
return block_rsv;
@ -8172,7 +8169,7 @@ try_reserve:
*/
if (block_rsv->type != BTRFS_BLOCK_RSV_GLOBAL &&
block_rsv->space_info == global_rsv->space_info) {
ret = block_rsv_use_bytes(global_rsv, blocksize);
ret = btrfs_block_rsv_use_bytes(global_rsv, blocksize);
if (!ret)
return global_rsv;
}