btrfs: use boolean for delalloc argument to btrfs_free_reserved_bytes()
authorFilipe Manana <fdmanana@suse.com>
Wed, 7 May 2025 15:28:51 +0000 (16:28 +0100)
committerDavid Sterba <dsterba@suse.com>
Thu, 15 May 2025 12:30:56 +0000 (14:30 +0200)
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>
fs/btrfs/block-group.c
fs/btrfs/block-group.h
fs/btrfs/extent-tree.c

index aa9f89e2817b3c970ceec4377a858e760bb14b29..5b0cb04b2b93f2c2a76206aa930145eb397f3cf8 100644 (file)
@@ -3829,17 +3829,17 @@ out:
 /*
  * Update the block_group and space info counters.
  *
- * @cache:      The cache we are manipulating
- * @num_bytes:  The number of bytes in question
- * @delalloc:   The blocks are allocated for the delalloc write
+ * @cache:       The cache we are manipulating.
+ * @num_bytes:   The number of bytes in question.
+ * @is_delalloc: Whether the blocks are allocated for a delalloc write.
  *
  * This is called by somebody who is freeing space that was never actually used
  * on disk.  For example if you reserve some space for a new leaf in transaction
  * A and before transaction A commits you free that leaf, you call this with
  * reserve set to 0 in order to clear the reservation.
  */
-void btrfs_free_reserved_bytes(struct btrfs_block_group *cache,
-                              u64 num_bytes, int delalloc)
+void btrfs_free_reserved_bytes(struct btrfs_block_group *cache, u64 num_bytes,
+                              bool is_delalloc)
 {
        struct btrfs_space_info *space_info = cache->space_info;
 
@@ -3853,7 +3853,7 @@ void btrfs_free_reserved_bytes(struct btrfs_block_group *cache,
        space_info->bytes_reserved -= num_bytes;
        space_info->max_extent_size = 0;
 
-       if (delalloc)
+       if (is_delalloc)
                cache->delalloc_bytes -= num_bytes;
        spin_unlock(&cache->lock);
 
index 35309b690d6fa5133c96aa34c6af8e3371268547..9de356bcb4113cc2fd46a1a94a6399057c94d4ba 100644 (file)
@@ -340,8 +340,8 @@ int btrfs_update_block_group(struct btrfs_trans_handle *trans,
 int btrfs_add_reserved_bytes(struct btrfs_block_group *cache,
                             u64 ram_bytes, u64 num_bytes, int delalloc,
                             bool force_wrong_size_class);
-void btrfs_free_reserved_bytes(struct btrfs_block_group *cache,
-                              u64 num_bytes, int delalloc);
+void btrfs_free_reserved_bytes(struct btrfs_block_group *cache, u64 num_bytes,
+                              bool is_delalloc);
 int btrfs_chunk_alloc(struct btrfs_trans_handle *trans,
                      struct btrfs_space_info *space_info, u64 flags,
                      enum btrfs_chunk_alloc_enum force);
index 64e8c653ae8f3e0c01d39243142f561acff2d54b..ca229381d448b6f327a45ef5dfc7639b8f7c9b60 100644 (file)
@@ -3508,7 +3508,7 @@ int btrfs_free_tree_block(struct btrfs_trans_handle *trans,
        WARN_ON(test_bit(EXTENT_BUFFER_DIRTY, &buf->bflags));
 
        btrfs_add_free_space(bg, buf->start, buf->len);
-       btrfs_free_reserved_bytes(bg, buf->len, 0);
+       btrfs_free_reserved_bytes(bg, buf->len, false);
        btrfs_put_block_group(bg);
        trace_btrfs_reserved_extent_free(fs_info, buf->start, buf->len);