Commit 11b66fa6 authored by Anand Jain's avatar Anand Jain Committed by David Sterba

btrfs: reduce btrfs_update_block_group alloc argument to bool

btrfs_update_block_group() accounts for the number of bytes allocated or
freed. Argument @alloc specifies whether the call is for alloc or free.
Convert the argument @alloc type from int to bool.
Reviewed-by: default avatarSu Yue <l@damenly.su>
Signed-off-by: default avatarAnand Jain <anand.jain@oracle.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent eed2037f
...@@ -3160,7 +3160,7 @@ int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans) ...@@ -3160,7 +3160,7 @@ int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans)
} }
int btrfs_update_block_group(struct btrfs_trans_handle *trans, int btrfs_update_block_group(struct btrfs_trans_handle *trans,
u64 bytenr, u64 num_bytes, int alloc) u64 bytenr, u64 num_bytes, bool alloc)
{ {
struct btrfs_fs_info *info = trans->fs_info; struct btrfs_fs_info *info = trans->fs_info;
struct btrfs_block_group *cache = NULL; struct btrfs_block_group *cache = NULL;
......
...@@ -284,7 +284,7 @@ int btrfs_start_dirty_block_groups(struct btrfs_trans_handle *trans); ...@@ -284,7 +284,7 @@ int btrfs_start_dirty_block_groups(struct btrfs_trans_handle *trans);
int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans); int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans);
int btrfs_setup_space_cache(struct btrfs_trans_handle *trans); int btrfs_setup_space_cache(struct btrfs_trans_handle *trans);
int btrfs_update_block_group(struct btrfs_trans_handle *trans, int btrfs_update_block_group(struct btrfs_trans_handle *trans,
u64 bytenr, u64 num_bytes, int alloc); u64 bytenr, u64 num_bytes, bool alloc);
int btrfs_add_reserved_bytes(struct btrfs_block_group *cache, int btrfs_add_reserved_bytes(struct btrfs_block_group *cache,
u64 ram_bytes, u64 num_bytes, int delalloc); u64 ram_bytes, u64 num_bytes, int delalloc);
void btrfs_free_reserved_bytes(struct btrfs_block_group *cache, void btrfs_free_reserved_bytes(struct btrfs_block_group *cache,
......
...@@ -3193,7 +3193,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans, ...@@ -3193,7 +3193,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
goto out; goto out;
} }
ret = btrfs_update_block_group(trans, bytenr, num_bytes, 0); ret = btrfs_update_block_group(trans, bytenr, num_bytes, false);
if (ret) { if (ret) {
btrfs_abort_transaction(trans, ret); btrfs_abort_transaction(trans, ret);
goto out; goto out;
...@@ -4627,7 +4627,7 @@ static int alloc_reserved_file_extent(struct btrfs_trans_handle *trans, ...@@ -4627,7 +4627,7 @@ static int alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
if (ret) if (ret)
return ret; return ret;
ret = btrfs_update_block_group(trans, ins->objectid, ins->offset, 1); ret = btrfs_update_block_group(trans, ins->objectid, ins->offset, true);
if (ret) { /* -ENOENT, logic error */ if (ret) { /* -ENOENT, logic error */
btrfs_err(fs_info, "update block group failed for %llu %llu", btrfs_err(fs_info, "update block group failed for %llu %llu",
ins->objectid, ins->offset); ins->objectid, ins->offset);
...@@ -4716,7 +4716,7 @@ static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans, ...@@ -4716,7 +4716,7 @@ static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans,
return ret; return ret;
ret = btrfs_update_block_group(trans, extent_key.objectid, ret = btrfs_update_block_group(trans, extent_key.objectid,
fs_info->nodesize, 1); fs_info->nodesize, true);
if (ret) { /* -ENOENT, logic error */ if (ret) { /* -ENOENT, logic error */
btrfs_err(fs_info, "update block group failed for %llu %llu", btrfs_err(fs_info, "update block group failed for %llu %llu",
extent_key.objectid, extent_key.offset); extent_key.objectid, extent_key.offset);
......
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