]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
btrfs: remove btrfs_clear_extent_bits()
authorFilipe Manana <fdmanana@suse.com>
Fri, 11 Jul 2025 08:46:16 +0000 (09:46 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jul 2025 22:09:22 +0000 (00:09 +0200)
It's just a simple wrapper around btrfs_clear_extent_bit() that passes a
NULL for its last argument (a cached extent state record), plus there is
not counter part - we have a btrfs_set_extent_bit() but we do not have a
btrfs_set_extent_bits() (plural version). So just remove it and make all
callers use btrfs_clear_extent_bit() directly.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
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/disk-io.c
fs/btrfs/extent-io-tree.h
fs/btrfs/inode.c
fs/btrfs/qgroup.c
fs/btrfs/reflink.c
fs/btrfs/relocation.c
fs/btrfs/tests/extent-io-tests.c
fs/btrfs/tests/inode-tests.c
fs/btrfs/volumes.c

index 3e895427c7734e5b84fd0e79e7bcb6474f586e01..1e35094b20e024669328adc6fa357ff8532b4d1a 100644 (file)
@@ -832,8 +832,8 @@ out:
 
 static inline void btrfs_free_excluded_extents(const struct btrfs_block_group *bg)
 {
-       btrfs_clear_extent_bits(&bg->fs_info->excluded_extents, bg->start,
-                               bg->start + bg->length - 1, EXTENT_DIRTY);
+       btrfs_clear_extent_bit(&bg->fs_info->excluded_extents, bg->start,
+                              bg->start + bg->length - 1, EXTENT_DIRTY, NULL);
 }
 
 static noinline void caching_thread(struct btrfs_work *work)
@@ -1436,14 +1436,14 @@ static bool clean_pinned_extents(struct btrfs_trans_handle *trans,
         */
        mutex_lock(&fs_info->unused_bg_unpin_mutex);
        if (prev_trans) {
-               ret = btrfs_clear_extent_bits(&prev_trans->pinned_extents, start, end,
-                                             EXTENT_DIRTY);
+               ret = btrfs_clear_extent_bit(&prev_trans->pinned_extents, start, end,
+                                            EXTENT_DIRTY, NULL);
                if (ret)
                        goto out;
        }
 
-       ret = btrfs_clear_extent_bits(&trans->transaction->pinned_extents, start, end,
-                                     EXTENT_DIRTY);
+       ret = btrfs_clear_extent_bit(&trans->transaction->pinned_extents, start, end,
+                                    EXTENT_DIRTY, NULL);
 out:
        mutex_unlock(&fs_info->unused_bg_unpin_mutex);
        if (prev_trans)
index 44e7ae4a2e0b6505b4f0485f4435ef054d2420f5..9cc14ab3529741b88992feb03d886dd307b90d01 100644 (file)
@@ -4641,7 +4641,7 @@ static void btrfs_destroy_marked_extents(struct btrfs_fs_info *fs_info,
 
        while (btrfs_find_first_extent_bit(dirty_pages, start, &start, &end,
                                           mark, NULL)) {
-               btrfs_clear_extent_bits(dirty_pages, start, end, mark);
+               btrfs_clear_extent_bit(dirty_pages, start, end, mark, NULL);
                while (start <= end) {
                        eb = find_extent_buffer(fs_info, start);
                        start += fs_info->nodesize;
index 819da07bff09507a19a37805de1f7676e8ea083c..36facca379738bd3dbb98cfeca4ac16e06052190 100644 (file)
@@ -192,12 +192,6 @@ static inline int btrfs_unlock_extent(struct extent_io_tree *tree, u64 start, u6
                                                cached, NULL);
 }
 
-static inline int btrfs_clear_extent_bits(struct extent_io_tree *tree, u64 start,
-                                         u64 end, u32 bits)
-{
-       return btrfs_clear_extent_bit(tree, start, end, bits, NULL);
-}
-
 int btrfs_set_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
                                 u32 bits, struct extent_changeset *changeset);
 int btrfs_set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
index 6781956197c7015bc4cc59ad9f550153e8fc6c14..7ed340cac33fdf8b65f639febf5275d954ccf0ba 100644 (file)
@@ -3374,8 +3374,8 @@ bool btrfs_data_csum_ok(struct btrfs_bio *bbio, struct btrfs_device *dev,
            btrfs_test_range_bit(&inode->io_tree, file_offset, end, EXTENT_NODATASUM,
                                 NULL)) {
                /* Skip the range without csum for data reloc inode */
-               btrfs_clear_extent_bits(&inode->io_tree, file_offset, end,
-                                       EXTENT_NODATASUM);
+               btrfs_clear_extent_bit(&inode->io_tree, file_offset, end,
+                                      EXTENT_NODATASUM, NULL);
                return true;
        }
 
index ae9bc7c71a347e161f6829c897714f695d76a7a0..1a5972178b3a3c4e45d8fffb026db0192931edd3 100644 (file)
@@ -4116,8 +4116,8 @@ static int qgroup_unreserve_range(struct btrfs_inode *inode,
                 * Now the entry is in [start, start + len), revert the
                 * EXTENT_QGROUP_RESERVED bit.
                 */
-               clear_ret = btrfs_clear_extent_bits(&inode->io_tree, entry_start,
-                                                   entry_end, EXTENT_QGROUP_RESERVED);
+               clear_ret = btrfs_clear_extent_bit(&inode->io_tree, entry_start, entry_end,
+                                                  EXTENT_QGROUP_RESERVED, NULL);
                if (!ret && clear_ret < 0)
                        ret = clear_ret;
 
index 0197bd9160a7950632aedd4a7e607310917f419f..ce25ab7f0e9965a1b98b1494b02508c28d75d4aa 100644 (file)
@@ -93,8 +93,8 @@ static int copy_inline_to_page(struct btrfs_inode *inode,
        if (ret < 0)
                goto out_unlock;
 
-       btrfs_clear_extent_bits(&inode->io_tree, file_offset, range_end,
-                               EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG);
+       btrfs_clear_extent_bit(&inode->io_tree, file_offset, range_end,
+                              EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG, NULL);
        ret = btrfs_set_extent_delalloc(inode, file_offset, range_end, 0, NULL);
        if (ret)
                goto out_unlock;
index 47ee3216e1e060157b32ca0171dbf2b1eb5c46eb..8a71cffb4dfbf40d6f9bb6f6fd9fdfab195cccb2 100644 (file)
@@ -3651,7 +3651,7 @@ restart:
        }
 
        btrfs_release_path(path);
-       btrfs_clear_extent_bits(&rc->processed_blocks, 0, (u64)-1, EXTENT_DIRTY);
+       btrfs_clear_extent_bit(&rc->processed_blocks, 0, (u64)-1, EXTENT_DIRTY, NULL);
 
        if (trans) {
                btrfs_end_transaction_throttle(trans);
index 660141fc67a87f7d8d8e6e33777bee2222f64444..b19328d077d3b4cadc6232f534c96d344ba9417e 100644 (file)
@@ -326,7 +326,7 @@ static int test_find_delalloc(u32 sectorsize, u32 nodesize)
 out_bits:
        if (ret)
                dump_extent_io_tree(tmp);
-       btrfs_clear_extent_bits(tmp, 0, total_dirty - 1, (unsigned)-1);
+       btrfs_clear_extent_bit(tmp, 0, total_dirty - 1, (unsigned)-1, NULL);
 out:
        if (locked_page)
                put_page(locked_page);
@@ -662,7 +662,7 @@ static int test_find_first_clear_extent_bit(void)
 out:
        if (ret)
                dump_extent_io_tree(&tree);
-       btrfs_clear_extent_bits(&tree, 0, (u64)-1, CHUNK_TRIMMED | CHUNK_ALLOCATED);
+       btrfs_clear_extent_bit(&tree, 0, (u64)-1, CHUNK_TRIMMED | CHUNK_ALLOCATED, NULL);
 
        return ret;
 }
index a29d2c02c2c85707bb4a89d2bb8660e251d8dfad..a4c2b7748b953155c8496f706cd6ab3b2f0b3811 100644 (file)
@@ -950,10 +950,10 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize)
        }
 
        /* [BTRFS_MAX_EXTENT_SIZE/2][sectorsize HOLE][the rest] */
-       ret = btrfs_clear_extent_bits(&BTRFS_I(inode)->io_tree,
-                                     BTRFS_MAX_EXTENT_SIZE >> 1,
-                                     (BTRFS_MAX_EXTENT_SIZE >> 1) + sectorsize - 1,
-                                     EXTENT_DELALLOC | EXTENT_DELALLOC_NEW);
+       ret = btrfs_clear_extent_bit(&BTRFS_I(inode)->io_tree,
+                                    BTRFS_MAX_EXTENT_SIZE >> 1,
+                                    (BTRFS_MAX_EXTENT_SIZE >> 1) + sectorsize - 1,
+                                    EXTENT_DELALLOC | EXTENT_DELALLOC_NEW, NULL);
        if (ret) {
                test_err("clear_extent_bit returned %d", ret);
                goto out;
@@ -1017,10 +1017,10 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize)
        }
 
        /* [BTRFS_MAX_EXTENT_SIZE+4k][4K HOLE][BTRFS_MAX_EXTENT_SIZE+4k] */
-       ret = btrfs_clear_extent_bits(&BTRFS_I(inode)->io_tree,
-                                     BTRFS_MAX_EXTENT_SIZE + sectorsize,
-                                     BTRFS_MAX_EXTENT_SIZE + 2 * sectorsize - 1,
-                                     EXTENT_DELALLOC | EXTENT_DELALLOC_NEW);
+       ret = btrfs_clear_extent_bit(&BTRFS_I(inode)->io_tree,
+                                    BTRFS_MAX_EXTENT_SIZE + sectorsize,
+                                    BTRFS_MAX_EXTENT_SIZE + 2 * sectorsize - 1,
+                                    EXTENT_DELALLOC | EXTENT_DELALLOC_NEW, NULL);
        if (ret) {
                test_err("clear_extent_bit returned %d", ret);
                goto out;
@@ -1051,8 +1051,8 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize)
        }
 
        /* Empty */
-       ret = btrfs_clear_extent_bits(&BTRFS_I(inode)->io_tree, 0, (u64)-1,
-                                     EXTENT_DELALLOC | EXTENT_DELALLOC_NEW);
+       ret = btrfs_clear_extent_bit(&BTRFS_I(inode)->io_tree, 0, (u64)-1,
+                                    EXTENT_DELALLOC | EXTENT_DELALLOC_NEW, NULL);
        if (ret) {
                test_err("clear_extent_bit returned %d", ret);
                goto out;
@@ -1066,8 +1066,8 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize)
        ret = 0;
 out:
        if (ret)
-               btrfs_clear_extent_bits(&BTRFS_I(inode)->io_tree, 0, (u64)-1,
-                                       EXTENT_DELALLOC | EXTENT_DELALLOC_NEW);
+               btrfs_clear_extent_bit(&BTRFS_I(inode)->io_tree, 0, (u64)-1,
+                                      EXTENT_DELALLOC | EXTENT_DELALLOC_NEW, NULL);
        iput(inode);
        btrfs_free_dummy_root(root);
        btrfs_free_dummy_fs_info(fs_info);
index 3f098ce07577d19e81badf034440c160772cdcaf..fa7a929a046190a730f63fb8db507284d676bcfc 100644 (file)
@@ -5019,8 +5019,8 @@ again:
 
        mutex_lock(&fs_info->chunk_mutex);
        /* Clear all state bits beyond the shrunk device size */
-       btrfs_clear_extent_bits(&device->alloc_state, new_size, (u64)-1,
-                               CHUNK_STATE_MASK);
+       btrfs_clear_extent_bit(&device->alloc_state, new_size, (u64)-1,
+                              CHUNK_STATE_MASK, NULL);
 
        btrfs_device_set_disk_total_bytes(device, new_size);
        if (list_empty(&device->post_commit_list))
@@ -5447,9 +5447,9 @@ static void chunk_map_device_clear_bits(struct btrfs_chunk_map *map, unsigned in
                struct btrfs_io_stripe *stripe = &map->stripes[i];
                struct btrfs_device *device = stripe->dev;
 
-               btrfs_clear_extent_bits(&device->alloc_state, stripe->physical,
-                                       stripe->physical + map->stripe_size - 1,
-                                       bits | EXTENT_NOWAIT);
+               btrfs_clear_extent_bit(&device->alloc_state, stripe->physical,
+                                      stripe->physical + map->stripe_size - 1,
+                                      bits | EXTENT_NOWAIT, NULL);
        }
 }