summaryrefslogtreecommitdiff
path: root/fs/btrfs
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2019-06-18 16:09:23 -0400
committerDavid Sterba <dsterba@suse.com>2019-07-02 12:30:53 +0200
commitc2a67a76ec87579a46a16c49fc9997737b7fa844 (patch)
treef6f97908dea4cf1e26878f82d02ea66da6885e72 /fs/btrfs
parentb338b013e18a28341aaf9e665ac1edc9fae518d1 (diff)
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>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/ctree.h1
-rw-r--r--fs/btrfs/extent-tree.c13
2 files changed, 6 insertions, 8 deletions
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;
}