Skip to content

Commit 239c68b

Browse files
fdmananakdave
authored andcommitted
btrfs: remove btrfs_clear_extent_bits()
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 <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent e376283 commit 239c68b

File tree

10 files changed

+33
-39
lines changed

10 files changed

+33
-39
lines changed

fs/btrfs/block-group.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -832,8 +832,8 @@ static int load_extent_tree_free(struct btrfs_caching_control *caching_ctl)
832832

833833
static inline void btrfs_free_excluded_extents(const struct btrfs_block_group *bg)
834834
{
835-
btrfs_clear_extent_bits(&bg->fs_info->excluded_extents, bg->start,
836-
bg->start + bg->length - 1, EXTENT_DIRTY);
835+
btrfs_clear_extent_bit(&bg->fs_info->excluded_extents, bg->start,
836+
bg->start + bg->length - 1, EXTENT_DIRTY, NULL);
837837
}
838838

839839
static noinline void caching_thread(struct btrfs_work *work)
@@ -1436,14 +1436,14 @@ static bool clean_pinned_extents(struct btrfs_trans_handle *trans,
14361436
*/
14371437
mutex_lock(&fs_info->unused_bg_unpin_mutex);
14381438
if (prev_trans) {
1439-
ret = btrfs_clear_extent_bits(&prev_trans->pinned_extents, start, end,
1440-
EXTENT_DIRTY);
1439+
ret = btrfs_clear_extent_bit(&prev_trans->pinned_extents, start, end,
1440+
EXTENT_DIRTY, NULL);
14411441
if (ret)
14421442
goto out;
14431443
}
14441444

1445-
ret = btrfs_clear_extent_bits(&trans->transaction->pinned_extents, start, end,
1446-
EXTENT_DIRTY);
1445+
ret = btrfs_clear_extent_bit(&trans->transaction->pinned_extents, start, end,
1446+
EXTENT_DIRTY, NULL);
14471447
out:
14481448
mutex_unlock(&fs_info->unused_bg_unpin_mutex);
14491449
if (prev_trans)

fs/btrfs/disk-io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4641,7 +4641,7 @@ static void btrfs_destroy_marked_extents(struct btrfs_fs_info *fs_info,
46414641

46424642
while (btrfs_find_first_extent_bit(dirty_pages, start, &start, &end,
46434643
mark, NULL)) {
4644-
btrfs_clear_extent_bits(dirty_pages, start, end, mark);
4644+
btrfs_clear_extent_bit(dirty_pages, start, end, mark, NULL);
46454645
while (start <= end) {
46464646
eb = find_extent_buffer(fs_info, start);
46474647
start += fs_info->nodesize;

fs/btrfs/extent-io-tree.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,6 @@ static inline int btrfs_unlock_extent(struct extent_io_tree *tree, u64 start, u6
192192
cached, NULL);
193193
}
194194

195-
static inline int btrfs_clear_extent_bits(struct extent_io_tree *tree, u64 start,
196-
u64 end, u32 bits)
197-
{
198-
return btrfs_clear_extent_bit(tree, start, end, bits, NULL);
199-
}
200-
201195
int btrfs_set_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
202196
u32 bits, struct extent_changeset *changeset);
203197
int btrfs_set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,

fs/btrfs/inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3374,8 +3374,8 @@ bool btrfs_data_csum_ok(struct btrfs_bio *bbio, struct btrfs_device *dev,
33743374
btrfs_test_range_bit(&inode->io_tree, file_offset, end, EXTENT_NODATASUM,
33753375
NULL)) {
33763376
/* Skip the range without csum for data reloc inode */
3377-
btrfs_clear_extent_bits(&inode->io_tree, file_offset, end,
3378-
EXTENT_NODATASUM);
3377+
btrfs_clear_extent_bit(&inode->io_tree, file_offset, end,
3378+
EXTENT_NODATASUM, NULL);
33793379
return true;
33803380
}
33813381

fs/btrfs/qgroup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4116,8 +4116,8 @@ static int qgroup_unreserve_range(struct btrfs_inode *inode,
41164116
* Now the entry is in [start, start + len), revert the
41174117
* EXTENT_QGROUP_RESERVED bit.
41184118
*/
4119-
clear_ret = btrfs_clear_extent_bits(&inode->io_tree, entry_start,
4120-
entry_end, EXTENT_QGROUP_RESERVED);
4119+
clear_ret = btrfs_clear_extent_bit(&inode->io_tree, entry_start, entry_end,
4120+
EXTENT_QGROUP_RESERVED, NULL);
41214121
if (!ret && clear_ret < 0)
41224122
ret = clear_ret;
41234123

fs/btrfs/reflink.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ static int copy_inline_to_page(struct btrfs_inode *inode,
9393
if (ret < 0)
9494
goto out_unlock;
9595

96-
btrfs_clear_extent_bits(&inode->io_tree, file_offset, range_end,
97-
EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG);
96+
btrfs_clear_extent_bit(&inode->io_tree, file_offset, range_end,
97+
EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG, NULL);
9898
ret = btrfs_set_extent_delalloc(inode, file_offset, range_end, 0, NULL);
9999
if (ret)
100100
goto out_unlock;

fs/btrfs/relocation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3651,7 +3651,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
36513651
}
36523652

36533653
btrfs_release_path(path);
3654-
btrfs_clear_extent_bits(&rc->processed_blocks, 0, (u64)-1, EXTENT_DIRTY);
3654+
btrfs_clear_extent_bit(&rc->processed_blocks, 0, (u64)-1, EXTENT_DIRTY, NULL);
36553655

36563656
if (trans) {
36573657
btrfs_end_transaction_throttle(trans);

fs/btrfs/tests/extent-io-tests.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ static int test_find_delalloc(u32 sectorsize, u32 nodesize)
326326
out_bits:
327327
if (ret)
328328
dump_extent_io_tree(tmp);
329-
btrfs_clear_extent_bits(tmp, 0, total_dirty - 1, (unsigned)-1);
329+
btrfs_clear_extent_bit(tmp, 0, total_dirty - 1, (unsigned)-1, NULL);
330330
out:
331331
if (locked_page)
332332
put_page(locked_page);
@@ -662,7 +662,7 @@ static int test_find_first_clear_extent_bit(void)
662662
out:
663663
if (ret)
664664
dump_extent_io_tree(&tree);
665-
btrfs_clear_extent_bits(&tree, 0, (u64)-1, CHUNK_TRIMMED | CHUNK_ALLOCATED);
665+
btrfs_clear_extent_bit(&tree, 0, (u64)-1, CHUNK_TRIMMED | CHUNK_ALLOCATED, NULL);
666666

667667
return ret;
668668
}

fs/btrfs/tests/inode-tests.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -950,10 +950,10 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize)
950950
}
951951

952952
/* [BTRFS_MAX_EXTENT_SIZE/2][sectorsize HOLE][the rest] */
953-
ret = btrfs_clear_extent_bits(&BTRFS_I(inode)->io_tree,
954-
BTRFS_MAX_EXTENT_SIZE >> 1,
955-
(BTRFS_MAX_EXTENT_SIZE >> 1) + sectorsize - 1,
956-
EXTENT_DELALLOC | EXTENT_DELALLOC_NEW);
953+
ret = btrfs_clear_extent_bit(&BTRFS_I(inode)->io_tree,
954+
BTRFS_MAX_EXTENT_SIZE >> 1,
955+
(BTRFS_MAX_EXTENT_SIZE >> 1) + sectorsize - 1,
956+
EXTENT_DELALLOC | EXTENT_DELALLOC_NEW, NULL);
957957
if (ret) {
958958
test_err("clear_extent_bit returned %d", ret);
959959
goto out;
@@ -1017,10 +1017,10 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize)
10171017
}
10181018

10191019
/* [BTRFS_MAX_EXTENT_SIZE+4k][4K HOLE][BTRFS_MAX_EXTENT_SIZE+4k] */
1020-
ret = btrfs_clear_extent_bits(&BTRFS_I(inode)->io_tree,
1021-
BTRFS_MAX_EXTENT_SIZE + sectorsize,
1022-
BTRFS_MAX_EXTENT_SIZE + 2 * sectorsize - 1,
1023-
EXTENT_DELALLOC | EXTENT_DELALLOC_NEW);
1020+
ret = btrfs_clear_extent_bit(&BTRFS_I(inode)->io_tree,
1021+
BTRFS_MAX_EXTENT_SIZE + sectorsize,
1022+
BTRFS_MAX_EXTENT_SIZE + 2 * sectorsize - 1,
1023+
EXTENT_DELALLOC | EXTENT_DELALLOC_NEW, NULL);
10241024
if (ret) {
10251025
test_err("clear_extent_bit returned %d", ret);
10261026
goto out;
@@ -1051,8 +1051,8 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize)
10511051
}
10521052

10531053
/* Empty */
1054-
ret = btrfs_clear_extent_bits(&BTRFS_I(inode)->io_tree, 0, (u64)-1,
1055-
EXTENT_DELALLOC | EXTENT_DELALLOC_NEW);
1054+
ret = btrfs_clear_extent_bit(&BTRFS_I(inode)->io_tree, 0, (u64)-1,
1055+
EXTENT_DELALLOC | EXTENT_DELALLOC_NEW, NULL);
10561056
if (ret) {
10571057
test_err("clear_extent_bit returned %d", ret);
10581058
goto out;
@@ -1066,8 +1066,8 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize)
10661066
ret = 0;
10671067
out:
10681068
if (ret)
1069-
btrfs_clear_extent_bits(&BTRFS_I(inode)->io_tree, 0, (u64)-1,
1070-
EXTENT_DELALLOC | EXTENT_DELALLOC_NEW);
1069+
btrfs_clear_extent_bit(&BTRFS_I(inode)->io_tree, 0, (u64)-1,
1070+
EXTENT_DELALLOC | EXTENT_DELALLOC_NEW, NULL);
10711071
iput(inode);
10721072
btrfs_free_dummy_root(root);
10731073
btrfs_free_dummy_fs_info(fs_info);

fs/btrfs/volumes.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5019,8 +5019,8 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size)
50195019

50205020
mutex_lock(&fs_info->chunk_mutex);
50215021
/* Clear all state bits beyond the shrunk device size */
5022-
btrfs_clear_extent_bits(&device->alloc_state, new_size, (u64)-1,
5023-
CHUNK_STATE_MASK);
5022+
btrfs_clear_extent_bit(&device->alloc_state, new_size, (u64)-1,
5023+
CHUNK_STATE_MASK, NULL);
50245024

50255025
btrfs_device_set_disk_total_bytes(device, new_size);
50265026
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
54475447
struct btrfs_io_stripe *stripe = &map->stripes[i];
54485448
struct btrfs_device *device = stripe->dev;
54495449

5450-
btrfs_clear_extent_bits(&device->alloc_state, stripe->physical,
5451-
stripe->physical + map->stripe_size - 1,
5452-
bits | EXTENT_NOWAIT);
5450+
btrfs_clear_extent_bit(&device->alloc_state, stripe->physical,
5451+
stripe->physical + map->stripe_size - 1,
5452+
bits | EXTENT_NOWAIT, NULL);
54535453
}
54545454
}
54555455

0 commit comments

Comments
 (0)