diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 8fca40370cf1..b78470fdc226 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -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); diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 7b4a287e0c5c..b0cd367994a8 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -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; }