Commit 95f93bc4 authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba

btrfs: rename and export __btrfs_cow_block()

Rename and export __btrfs_cow_block() as btrfs_force_cow_block(). This is
to allow to move defrag specific code out of ctree.c and into defrag.c in
one of the next patches.
Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent b8bf4e4d
...@@ -510,13 +510,13 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans, ...@@ -510,13 +510,13 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans,
* bytes the allocator should try to find free next to the block it returns. * bytes the allocator should try to find free next to the block it returns.
* This is just a hint and may be ignored by the allocator. * This is just a hint and may be ignored by the allocator.
*/ */
static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, int btrfs_force_cow_block(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct extent_buffer *buf, struct extent_buffer *buf,
struct extent_buffer *parent, int parent_slot, struct extent_buffer *parent, int parent_slot,
struct extent_buffer **cow_ret, struct extent_buffer **cow_ret,
u64 search_start, u64 empty_size, u64 search_start, u64 empty_size,
enum btrfs_lock_nesting nest) enum btrfs_lock_nesting nest)
{ {
struct btrfs_fs_info *fs_info = root->fs_info; struct btrfs_fs_info *fs_info = root->fs_info;
struct btrfs_disk_key disk_key; struct btrfs_disk_key disk_key;
...@@ -674,7 +674,7 @@ static inline int should_cow_block(struct btrfs_trans_handle *trans, ...@@ -674,7 +674,7 @@ static inline int should_cow_block(struct btrfs_trans_handle *trans,
} }
/* /*
* cows a single block, see __btrfs_cow_block for the real work. * COWs a single block, see btrfs_force_cow_block() for the real work.
* This version of it has extra checks so that a block isn't COWed more than * This version of it has extra checks so that a block isn't COWed more than
* once per transaction, as long as it hasn't been written yet * once per transaction, as long as it hasn't been written yet
*/ */
...@@ -727,8 +727,8 @@ int btrfs_cow_block(struct btrfs_trans_handle *trans, ...@@ -727,8 +727,8 @@ int btrfs_cow_block(struct btrfs_trans_handle *trans,
* Also We don't care about the error, as it's handled internally. * Also We don't care about the error, as it's handled internally.
*/ */
btrfs_qgroup_trace_subtree_after_cow(trans, root, buf); btrfs_qgroup_trace_subtree_after_cow(trans, root, buf);
ret = __btrfs_cow_block(trans, root, buf, parent, ret = btrfs_force_cow_block(trans, root, buf, parent, parent_slot,
parent_slot, cow_ret, search_start, 0, nest); cow_ret, search_start, 0, nest);
trace_btrfs_cow_block(root, buf, *cow_ret); trace_btrfs_cow_block(root, buf, *cow_ret);
...@@ -879,11 +879,11 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans, ...@@ -879,11 +879,11 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
search_start = last_block; search_start = last_block;
btrfs_tree_lock(cur); btrfs_tree_lock(cur);
err = __btrfs_cow_block(trans, root, cur, parent, i, err = btrfs_force_cow_block(trans, root, cur, parent, i,
&cur, search_start, &cur, search_start,
min(16 * blocksize, min(16 * blocksize,
(end_slot - i) * blocksize), (end_slot - i) * blocksize),
BTRFS_NESTING_COW); BTRFS_NESTING_COW);
if (err) { if (err) {
btrfs_tree_unlock(cur); btrfs_tree_unlock(cur);
free_extent_buffer(cur); free_extent_buffer(cur);
......
...@@ -487,6 +487,13 @@ int btrfs_cow_block(struct btrfs_trans_handle *trans, ...@@ -487,6 +487,13 @@ int btrfs_cow_block(struct btrfs_trans_handle *trans,
struct extent_buffer *parent, int parent_slot, struct extent_buffer *parent, int parent_slot,
struct extent_buffer **cow_ret, struct extent_buffer **cow_ret,
enum btrfs_lock_nesting nest); enum btrfs_lock_nesting nest);
int btrfs_force_cow_block(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct extent_buffer *buf,
struct extent_buffer *parent, int parent_slot,
struct extent_buffer **cow_ret,
u64 search_start, u64 empty_size,
enum btrfs_lock_nesting nest);
int btrfs_copy_root(struct btrfs_trans_handle *trans, int btrfs_copy_root(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct extent_buffer *buf, struct extent_buffer *buf,
......
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