Skip to content

Commit ab9873f

Browse files
fdmananakdave
authored andcommitted
btrfs: rename the functions to count, test and get bit ranges in io trees
These functions are exported so they should have a 'btrfs_' prefix by convention, to make it clear they are btrfs specific and to avoid collisions with functions from elsewhere in the kernel. So add a 'btrfs_' prefix to their names to make it clear they are from btrfs. 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>
1 parent b96ab16 commit ab9873f

File tree

7 files changed

+38
-37
lines changed

7 files changed

+38
-37
lines changed

fs/btrfs/defrag.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,8 +1024,8 @@ static int defrag_collect_targets(struct btrfs_inode *inode,
10241024
* very likely resulting in a larger extent after writeback is
10251025
* triggered (except in a case of free space fragmentation).
10261026
*/
1027-
if (test_range_bit_exists(&inode->io_tree, cur, cur + range_len - 1,
1028-
EXTENT_DELALLOC))
1027+
if (btrfs_test_range_bit_exists(&inode->io_tree, cur, cur + range_len - 1,
1028+
EXTENT_DELALLOC))
10291029
goto next;
10301030

10311031
/*

fs/btrfs/extent-io-tree.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,10 +1612,10 @@ void btrfs_find_first_clear_extent_bit(struct extent_io_tree *tree, u64 start,
16121612
* all given bits set. If the returned number of bytes is greater than zero
16131613
* then @start is updated with the offset of the first byte with the bits set.
16141614
*/
1615-
u64 count_range_bits(struct extent_io_tree *tree,
1616-
u64 *start, u64 search_end, u64 max_bytes,
1617-
u32 bits, int contig,
1618-
struct extent_state **cached_state)
1615+
u64 btrfs_count_range_bits(struct extent_io_tree *tree,
1616+
u64 *start, u64 search_end, u64 max_bytes,
1617+
u32 bits, int contig,
1618+
struct extent_state **cached_state)
16191619
{
16201620
struct extent_state *state = NULL;
16211621
struct extent_state *cached;
@@ -1700,7 +1700,7 @@ u64 count_range_bits(struct extent_io_tree *tree,
17001700
/*
17011701
* Check if the single @bit exists in the given range.
17021702
*/
1703-
bool test_range_bit_exists(struct extent_io_tree *tree, u64 start, u64 end, u32 bit)
1703+
bool btrfs_test_range_bit_exists(struct extent_io_tree *tree, u64 start, u64 end, u32 bit)
17041704
{
17051705
struct extent_state *state;
17061706
bool bitset = false;
@@ -1726,8 +1726,8 @@ bool test_range_bit_exists(struct extent_io_tree *tree, u64 start, u64 end, u32
17261726
return bitset;
17271727
}
17281728

1729-
void get_range_bits(struct extent_io_tree *tree, u64 start, u64 end, u32 *bits,
1730-
struct extent_state **cached_state)
1729+
void btrfs_get_range_bits(struct extent_io_tree *tree, u64 start, u64 end, u32 *bits,
1730+
struct extent_state **cached_state)
17311731
{
17321732
struct extent_state *state;
17331733

@@ -1763,8 +1763,8 @@ void get_range_bits(struct extent_io_tree *tree, u64 start, u64 end, u32 *bits,
17631763
/*
17641764
* Check if the whole range [@start,@end) contains the single @bit set.
17651765
*/
1766-
bool test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, u32 bit,
1767-
struct extent_state *cached)
1766+
bool btrfs_test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, u32 bit,
1767+
struct extent_state *cached)
17681768
{
17691769
struct extent_state *state;
17701770
bool bitset = true;

fs/btrfs/extent-io-tree.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,17 +160,17 @@ static inline bool btrfs_try_lock_extent(struct extent_io_tree *tree, u64 start,
160160
int __init extent_state_init_cachep(void);
161161
void __cold extent_state_free_cachep(void);
162162

163-
u64 count_range_bits(struct extent_io_tree *tree,
164-
u64 *start, u64 search_end,
165-
u64 max_bytes, u32 bits, int contig,
166-
struct extent_state **cached_state);
163+
u64 btrfs_count_range_bits(struct extent_io_tree *tree,
164+
u64 *start, u64 search_end,
165+
u64 max_bytes, u32 bits, int contig,
166+
struct extent_state **cached_state);
167167

168168
void free_extent_state(struct extent_state *state);
169-
bool test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, u32 bit,
170-
struct extent_state *cached_state);
171-
bool test_range_bit_exists(struct extent_io_tree *tree, u64 start, u64 end, u32 bit);
172-
void get_range_bits(struct extent_io_tree *tree, u64 start, u64 end, u32 *bits,
173-
struct extent_state **cached_state);
169+
bool btrfs_test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, u32 bit,
170+
struct extent_state *cached_state);
171+
bool btrfs_test_range_bit_exists(struct extent_io_tree *tree, u64 start, u64 end, u32 bit);
172+
void btrfs_get_range_bits(struct extent_io_tree *tree, u64 start, u64 end, u32 *bits,
173+
struct extent_state **cached_state);
174174
int clear_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
175175
u32 bits, struct extent_changeset *changeset);
176176
int btrfs_clear_extent_bit_changeset(struct extent_io_tree *tree, u64 start, u64 end,

fs/btrfs/extent_io.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ noinline_for_stack bool find_lock_delalloc_range(struct inode *inode,
372372
btrfs_lock_extent(tree, delalloc_start, delalloc_end, &cached_state);
373373

374374
/* then test to make sure it is all still delalloc */
375-
ret = test_range_bit(tree, delalloc_start, delalloc_end,
376-
EXTENT_DELALLOC, cached_state);
375+
ret = btrfs_test_range_bit(tree, delalloc_start, delalloc_end,
376+
EXTENT_DELALLOC, cached_state);
377377

378378
btrfs_unlock_extent(tree, delalloc_start, delalloc_end, &cached_state);
379379
if (!ret) {
@@ -2616,7 +2616,7 @@ static bool try_release_extent_state(struct extent_io_tree *tree,
26162616
bool ret = false;
26172617
int ret2;
26182618

2619-
get_range_bits(tree, start, end, &range_bits, &cached_state);
2619+
btrfs_get_range_bits(tree, start, end, &range_bits, &cached_state);
26202620

26212621
/*
26222622
* We can release the folio if it's locked only for ordered extent
@@ -2676,8 +2676,8 @@ bool try_release_extent_mapping(struct folio *folio, gfp_t mask)
26762676
free_extent_map(em);
26772677
break;
26782678
}
2679-
if (test_range_bit_exists(io_tree, em->start,
2680-
extent_map_end(em) - 1, EXTENT_LOCKED))
2679+
if (btrfs_test_range_bit_exists(io_tree, em->start,
2680+
extent_map_end(em) - 1, EXTENT_LOCKED))
26812681
goto next;
26822682
/*
26832683
* If it's not in the list of modified extents, used by a fast

fs/btrfs/file.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3254,10 +3254,10 @@ static bool find_delalloc_subrange(struct btrfs_inode *inode, u64 start, u64 end
32543254
if (inode->delalloc_bytes > 0) {
32553255
spin_unlock(&inode->lock);
32563256
*delalloc_start_ret = start;
3257-
delalloc_len = count_range_bits(&inode->io_tree,
3258-
delalloc_start_ret, end,
3259-
len, EXTENT_DELALLOC, 1,
3260-
cached_state);
3257+
delalloc_len = btrfs_count_range_bits(&inode->io_tree,
3258+
delalloc_start_ret, end,
3259+
len, EXTENT_DELALLOC, 1,
3260+
cached_state);
32613261
} else {
32623262
spin_unlock(&inode->lock);
32633263
}

fs/btrfs/inode.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,8 +1735,8 @@ static int fallback_to_cow(struct btrfs_inode *inode,
17351735
* when starting writeback.
17361736
*/
17371737
btrfs_lock_extent(io_tree, start, end, &cached_state);
1738-
count = count_range_bits(io_tree, &range_start, end, range_bytes,
1739-
EXTENT_NORESERVE, 0, NULL);
1738+
count = btrfs_count_range_bits(io_tree, &range_start, end, range_bytes,
1739+
EXTENT_NORESERVE, 0, NULL);
17401740
if (count > 0 || is_space_ino || is_reloc_ino) {
17411741
u64 bytes = count;
17421742
struct btrfs_fs_info *fs_info = inode->root->fs_info;
@@ -2301,7 +2301,7 @@ static bool should_nocow(struct btrfs_inode *inode, u64 start, u64 end)
23012301
{
23022302
if (inode->flags & (BTRFS_INODE_NODATACOW | BTRFS_INODE_PREALLOC)) {
23032303
if (inode->defrag_bytes &&
2304-
test_range_bit_exists(&inode->io_tree, start, end, EXTENT_DEFRAG))
2304+
btrfs_test_range_bit_exists(&inode->io_tree, start, end, EXTENT_DEFRAG))
23052305
return false;
23062306
return true;
23072307
}
@@ -3369,8 +3369,8 @@ bool btrfs_data_csum_ok(struct btrfs_bio *bbio, struct btrfs_device *dev,
33693369
return true;
33703370

33713371
if (btrfs_is_data_reloc_root(inode->root) &&
3372-
test_range_bit(&inode->io_tree, file_offset, end, EXTENT_NODATASUM,
3373-
NULL)) {
3372+
btrfs_test_range_bit(&inode->io_tree, file_offset, end, EXTENT_NODATASUM,
3373+
NULL)) {
33743374
/* Skip the range without csum for data reloc inode */
33753375
btrfs_clear_extent_bits(&inode->io_tree, file_offset, end,
33763376
EXTENT_NODATASUM);
@@ -7145,7 +7145,8 @@ noinline int can_nocow_extent(struct btrfs_inode *inode, u64 offset, u64 *len,
71457145

71467146
range_end = round_up(offset + nocow_args.file_extent.num_bytes,
71477147
root->fs_info->sectorsize) - 1;
7148-
ret = test_range_bit_exists(io_tree, offset, range_end, EXTENT_DELALLOC);
7148+
ret = btrfs_test_range_bit_exists(io_tree, offset, range_end,
7149+
EXTENT_DELALLOC);
71497150
if (ret)
71507151
return -EAGAIN;
71517152
}

fs/btrfs/relocation.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2409,8 +2409,8 @@ static int tree_block_processed(u64 bytenr, struct reloc_control *rc)
24092409
{
24102410
u32 blocksize = rc->extent_root->fs_info->nodesize;
24112411

2412-
if (test_range_bit(&rc->processed_blocks, bytenr,
2413-
bytenr + blocksize - 1, EXTENT_DIRTY, NULL))
2412+
if (btrfs_test_range_bit(&rc->processed_blocks, bytenr,
2413+
bytenr + blocksize - 1, EXTENT_DIRTY, NULL))
24142414
return 1;
24152415
return 0;
24162416
}

0 commit comments

Comments
 (0)