Commit 0b50174a authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: export btrfs_block_rsv_add_bytes

This is used in a few places, we need to make sure it's exported so we
can move it around.
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent d12ffdd1
...@@ -73,5 +73,7 @@ int btrfs_cond_migrate_bytes(struct btrfs_fs_info *fs_info, ...@@ -73,5 +73,7 @@ int btrfs_cond_migrate_bytes(struct btrfs_fs_info *fs_info,
void btrfs_block_rsv_release(struct btrfs_fs_info *fs_info, void btrfs_block_rsv_release(struct btrfs_fs_info *fs_info,
struct btrfs_block_rsv *block_rsv, struct btrfs_block_rsv *block_rsv,
u64 num_bytes); u64 num_bytes);
void btrfs_block_rsv_add_bytes(struct btrfs_block_rsv *block_rsv,
u64 num_bytes, bool update_size);
#endif /* BTRFS_BLOCK_RSV_H */ #endif /* BTRFS_BLOCK_RSV_H */
...@@ -4382,8 +4382,8 @@ int btrfs_block_rsv_use_bytes(struct btrfs_block_rsv *block_rsv, u64 num_bytes) ...@@ -4382,8 +4382,8 @@ int btrfs_block_rsv_use_bytes(struct btrfs_block_rsv *block_rsv, u64 num_bytes)
return ret; return ret;
} }
static void block_rsv_add_bytes(struct btrfs_block_rsv *block_rsv, void btrfs_block_rsv_add_bytes(struct btrfs_block_rsv *block_rsv,
u64 num_bytes, bool update_size) u64 num_bytes, bool update_size)
{ {
spin_lock(&block_rsv->lock); spin_lock(&block_rsv->lock);
block_rsv->reserved += num_bytes; block_rsv->reserved += num_bytes;
...@@ -4415,7 +4415,7 @@ int btrfs_cond_migrate_bytes(struct btrfs_fs_info *fs_info, ...@@ -4415,7 +4415,7 @@ int btrfs_cond_migrate_bytes(struct btrfs_fs_info *fs_info,
global_rsv->full = 0; global_rsv->full = 0;
spin_unlock(&global_rsv->lock); spin_unlock(&global_rsv->lock);
block_rsv_add_bytes(dest, num_bytes, true); btrfs_block_rsv_add_bytes(dest, num_bytes, true);
return 0; return 0;
} }
...@@ -4497,7 +4497,7 @@ int btrfs_delayed_refs_rsv_refill(struct btrfs_fs_info *fs_info, ...@@ -4497,7 +4497,7 @@ int btrfs_delayed_refs_rsv_refill(struct btrfs_fs_info *fs_info,
num_bytes, flush); num_bytes, flush);
if (ret) if (ret)
return ret; return ret;
block_rsv_add_bytes(block_rsv, num_bytes, 0); btrfs_block_rsv_add_bytes(block_rsv, num_bytes, 0);
trace_btrfs_space_reservation(fs_info, "delayed_refs_rsv", trace_btrfs_space_reservation(fs_info, "delayed_refs_rsv",
0, num_bytes, 1); 0, num_bytes, 1);
return 0; return 0;
...@@ -4569,7 +4569,7 @@ int btrfs_block_rsv_migrate(struct btrfs_block_rsv *src, ...@@ -4569,7 +4569,7 @@ int btrfs_block_rsv_migrate(struct btrfs_block_rsv *src,
if (ret) if (ret)
return ret; return ret;
block_rsv_add_bytes(dst, num_bytes, update_size); btrfs_block_rsv_add_bytes(dst, num_bytes, update_size);
return 0; return 0;
} }
...@@ -4622,7 +4622,7 @@ int btrfs_block_rsv_add(struct btrfs_root *root, ...@@ -4622,7 +4622,7 @@ int btrfs_block_rsv_add(struct btrfs_root *root,
ret = btrfs_reserve_metadata_bytes(root, block_rsv, num_bytes, flush); ret = btrfs_reserve_metadata_bytes(root, block_rsv, num_bytes, flush);
if (!ret) if (!ret)
block_rsv_add_bytes(block_rsv, num_bytes, true); btrfs_block_rsv_add_bytes(block_rsv, num_bytes, true);
return ret; return ret;
} }
...@@ -4667,7 +4667,7 @@ int btrfs_block_rsv_refill(struct btrfs_root *root, ...@@ -4667,7 +4667,7 @@ int btrfs_block_rsv_refill(struct btrfs_root *root,
ret = btrfs_reserve_metadata_bytes(root, block_rsv, num_bytes, flush); ret = btrfs_reserve_metadata_bytes(root, block_rsv, num_bytes, flush);
if (!ret) { if (!ret) {
block_rsv_add_bytes(block_rsv, num_bytes, false); btrfs_block_rsv_add_bytes(block_rsv, num_bytes, false);
return 0; return 0;
} }
...@@ -5057,7 +5057,7 @@ int btrfs_delalloc_reserve_metadata(struct btrfs_inode *inode, u64 num_bytes) ...@@ -5057,7 +5057,7 @@ int btrfs_delalloc_reserve_metadata(struct btrfs_inode *inode, u64 num_bytes)
spin_unlock(&inode->lock); spin_unlock(&inode->lock);
/* Now we can safely add our space to our block rsv */ /* Now we can safely add our space to our block rsv */
block_rsv_add_bytes(block_rsv, meta_reserve, false); btrfs_block_rsv_add_bytes(block_rsv, meta_reserve, false);
trace_btrfs_space_reservation(root->fs_info, "delalloc", trace_btrfs_space_reservation(root->fs_info, "delalloc",
btrfs_ino(inode), meta_reserve, 1); btrfs_ino(inode), meta_reserve, 1);
...@@ -7429,7 +7429,7 @@ use_block_rsv(struct btrfs_trans_handle *trans, ...@@ -7429,7 +7429,7 @@ use_block_rsv(struct btrfs_trans_handle *trans,
static void unuse_block_rsv(struct btrfs_fs_info *fs_info, static void unuse_block_rsv(struct btrfs_fs_info *fs_info,
struct btrfs_block_rsv *block_rsv, u32 blocksize) struct btrfs_block_rsv *block_rsv, u32 blocksize)
{ {
block_rsv_add_bytes(block_rsv, blocksize, false); btrfs_block_rsv_add_bytes(block_rsv, blocksize, false);
block_rsv_release_bytes(fs_info, block_rsv, NULL, 0, NULL); block_rsv_release_bytes(fs_info, block_rsv, NULL, 0, NULL);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment