Commit 2454151c authored by David Sterba's avatar David Sterba

btrfs: pass btrfs_inode to btrfs_merge_delalloc_extent

The function is for internal interfaces so we should use the
btrfs_inode.
Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 0988fc7b
...@@ -475,7 +475,7 @@ struct inode *btrfs_new_subvol_inode(struct user_namespace *mnt_userns, ...@@ -475,7 +475,7 @@ struct inode *btrfs_new_subvol_inode(struct user_namespace *mnt_userns,
u32 bits); u32 bits);
void btrfs_clear_delalloc_extent(struct inode *inode, void btrfs_clear_delalloc_extent(struct inode *inode,
struct extent_state *state, u32 bits); struct extent_state *state, u32 bits);
void btrfs_merge_delalloc_extent(struct inode *inode, struct extent_state *new, void btrfs_merge_delalloc_extent(struct btrfs_inode *inode, struct extent_state *new,
struct extent_state *other); struct extent_state *other);
void btrfs_split_delalloc_extent(struct inode *inode, void btrfs_split_delalloc_extent(struct inode *inode,
struct extent_state *orig, u64 split); struct extent_state *orig, u64 split);
......
...@@ -347,8 +347,7 @@ static void merge_state(struct extent_io_tree *tree, struct extent_state *state) ...@@ -347,8 +347,7 @@ static void merge_state(struct extent_io_tree *tree, struct extent_state *state)
if (other && other->end == state->start - 1 && if (other && other->end == state->start - 1 &&
other->state == state->state) { other->state == state->state) {
if (tree->inode) if (tree->inode)
btrfs_merge_delalloc_extent(&tree->inode->vfs_inode, state, btrfs_merge_delalloc_extent(tree->inode, state, other);
other);
state->start = other->start; state->start = other->start;
rb_erase(&other->rb_node, &tree->state); rb_erase(&other->rb_node, &tree->state);
RB_CLEAR_NODE(&other->rb_node); RB_CLEAR_NODE(&other->rb_node);
...@@ -358,8 +357,7 @@ static void merge_state(struct extent_io_tree *tree, struct extent_state *state) ...@@ -358,8 +357,7 @@ static void merge_state(struct extent_io_tree *tree, struct extent_state *state)
if (other && other->start == state->end + 1 && if (other && other->start == state->end + 1 &&
other->state == state->state) { other->state == state->state) {
if (tree->inode) if (tree->inode)
btrfs_merge_delalloc_extent(&tree->inode->vfs_inode, state, btrfs_merge_delalloc_extent(tree->inode, state, other);
other);
state->end = other->end; state->end = other->end;
rb_erase(&other->rb_node, &tree->state); rb_erase(&other->rb_node, &tree->state);
RB_CLEAR_NODE(&other->rb_node); RB_CLEAR_NODE(&other->rb_node);
......
...@@ -2314,10 +2314,10 @@ void btrfs_split_delalloc_extent(struct inode *inode, ...@@ -2314,10 +2314,10 @@ void btrfs_split_delalloc_extent(struct inode *inode,
* that are just merged onto old extents, such as when we are doing sequential * that are just merged onto old extents, such as when we are doing sequential
* writes, so we can properly account for the metadata space we'll need. * writes, so we can properly account for the metadata space we'll need.
*/ */
void btrfs_merge_delalloc_extent(struct inode *inode, struct extent_state *new, void btrfs_merge_delalloc_extent(struct btrfs_inode *inode, struct extent_state *new,
struct extent_state *other) struct extent_state *other)
{ {
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); struct btrfs_fs_info *fs_info = inode->root->fs_info;
u64 new_size, old_size; u64 new_size, old_size;
u32 num_extents; u32 num_extents;
...@@ -2332,9 +2332,9 @@ void btrfs_merge_delalloc_extent(struct inode *inode, struct extent_state *new, ...@@ -2332,9 +2332,9 @@ void btrfs_merge_delalloc_extent(struct inode *inode, struct extent_state *new,
/* we're not bigger than the max, unreserve the space and go */ /* we're not bigger than the max, unreserve the space and go */
if (new_size <= fs_info->max_extent_size) { if (new_size <= fs_info->max_extent_size) {
spin_lock(&BTRFS_I(inode)->lock); spin_lock(&inode->lock);
btrfs_mod_outstanding_extents(BTRFS_I(inode), -1); btrfs_mod_outstanding_extents(inode, -1);
spin_unlock(&BTRFS_I(inode)->lock); spin_unlock(&inode->lock);
return; return;
} }
...@@ -2363,9 +2363,9 @@ void btrfs_merge_delalloc_extent(struct inode *inode, struct extent_state *new, ...@@ -2363,9 +2363,9 @@ void btrfs_merge_delalloc_extent(struct inode *inode, struct extent_state *new,
if (count_max_extents(fs_info, new_size) >= num_extents) if (count_max_extents(fs_info, new_size) >= num_extents)
return; return;
spin_lock(&BTRFS_I(inode)->lock); spin_lock(&inode->lock);
btrfs_mod_outstanding_extents(BTRFS_I(inode), -1); btrfs_mod_outstanding_extents(inode, -1);
spin_unlock(&BTRFS_I(inode)->lock); spin_unlock(&inode->lock);
} }
static void btrfs_add_delalloc_inodes(struct btrfs_root *root, static void btrfs_add_delalloc_inodes(struct btrfs_root *root,
......
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