Skip to content

Commit ba4ec9a

Browse files
fdmananakdave
authored andcommitted
btrfs: use boolean for delalloc argument to btrfs_free_reserved_bytes()
We are using an integer for the 'delalloc' argument but all we need is a boolean, so switch the type to 'bool' and rename the parameter to 'is_delalloc' to better match the fact that it's a boolean. Reviewed-by: Boris Burkov <boris@bur.io> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 87417e0 commit ba4ec9a

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

fs/btrfs/block-group.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3829,17 +3829,17 @@ int btrfs_add_reserved_bytes(struct btrfs_block_group *cache,
38293829
/*
38303830
* Update the block_group and space info counters.
38313831
*
3832-
* @cache: The cache we are manipulating
3833-
* @num_bytes: The number of bytes in question
3834-
* @delalloc: The blocks are allocated for the delalloc write
3832+
* @cache: The cache we are manipulating.
3833+
* @num_bytes: The number of bytes in question.
3834+
* @is_delalloc: Whether the blocks are allocated for a delalloc write.
38353835
*
38363836
* This is called by somebody who is freeing space that was never actually used
38373837
* on disk. For example if you reserve some space for a new leaf in transaction
38383838
* A and before transaction A commits you free that leaf, you call this with
38393839
* reserve set to 0 in order to clear the reservation.
38403840
*/
3841-
void btrfs_free_reserved_bytes(struct btrfs_block_group *cache,
3842-
u64 num_bytes, int delalloc)
3841+
void btrfs_free_reserved_bytes(struct btrfs_block_group *cache, u64 num_bytes,
3842+
bool is_delalloc)
38433843
{
38443844
struct btrfs_space_info *space_info = cache->space_info;
38453845

@@ -3853,7 +3853,7 @@ void btrfs_free_reserved_bytes(struct btrfs_block_group *cache,
38533853
space_info->bytes_reserved -= num_bytes;
38543854
space_info->max_extent_size = 0;
38553855

3856-
if (delalloc)
3856+
if (is_delalloc)
38573857
cache->delalloc_bytes -= num_bytes;
38583858
spin_unlock(&cache->lock);
38593859

fs/btrfs/block-group.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@ int btrfs_update_block_group(struct btrfs_trans_handle *trans,
340340
int btrfs_add_reserved_bytes(struct btrfs_block_group *cache,
341341
u64 ram_bytes, u64 num_bytes, int delalloc,
342342
bool force_wrong_size_class);
343-
void btrfs_free_reserved_bytes(struct btrfs_block_group *cache,
344-
u64 num_bytes, int delalloc);
343+
void btrfs_free_reserved_bytes(struct btrfs_block_group *cache, u64 num_bytes,
344+
bool is_delalloc);
345345
int btrfs_chunk_alloc(struct btrfs_trans_handle *trans,
346346
struct btrfs_space_info *space_info, u64 flags,
347347
enum btrfs_chunk_alloc_enum force);

fs/btrfs/extent-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3508,7 +3508,7 @@ int btrfs_free_tree_block(struct btrfs_trans_handle *trans,
35083508
WARN_ON(test_bit(EXTENT_BUFFER_DIRTY, &buf->bflags));
35093509

35103510
btrfs_add_free_space(bg, buf->start, buf->len);
3511-
btrfs_free_reserved_bytes(bg, buf->len, 0);
3511+
btrfs_free_reserved_bytes(bg, buf->len, false);
35123512
btrfs_put_block_group(bg);
35133513
trace_btrfs_reserved_extent_free(fs_info, buf->start, buf->len);
35143514

0 commit comments

Comments
 (0)