btrfs: open code set_extent_bits
This helper calls set_extent_bit with two more parameters set to default values, but otherwise it's purpose is not clear. Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
@@ -795,8 +795,8 @@ static int btrfs_set_target_alloc_state(struct btrfs_device *srcdev,
|
||||
while (!find_first_extent_bit(&srcdev->alloc_state, start,
|
||||
&found_start, &found_end,
|
||||
CHUNK_ALLOCATED, &cached_state)) {
|
||||
ret = set_extent_bits(&tgtdev->alloc_state, found_start,
|
||||
found_end, CHUNK_ALLOCATED);
|
||||
ret = set_extent_bit(&tgtdev->alloc_state, found_start,
|
||||
found_end, CHUNK_ALLOCATED, NULL, GFP_NOFS);
|
||||
if (ret)
|
||||
break;
|
||||
start = found_end + 1;
|
||||
|
||||
@@ -156,12 +156,6 @@ int set_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
|
||||
int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
|
||||
u32 bits, struct extent_state **cached_state, gfp_t mask);
|
||||
|
||||
static inline int set_extent_bits(struct extent_io_tree *tree, u64 start,
|
||||
u64 end, u32 bits)
|
||||
{
|
||||
return set_extent_bit(tree, start, end, bits, NULL, GFP_NOFS);
|
||||
}
|
||||
|
||||
static inline int clear_extent_uptodate(struct extent_io_tree *tree, u64 start,
|
||||
u64 end, struct extent_state **cached_state)
|
||||
{
|
||||
|
||||
@@ -73,8 +73,8 @@ int btrfs_add_excluded_extent(struct btrfs_fs_info *fs_info,
|
||||
u64 start, u64 num_bytes)
|
||||
{
|
||||
u64 end = start + num_bytes - 1;
|
||||
set_extent_bits(&fs_info->excluded_extents, start, end,
|
||||
EXTENT_UPTODATE);
|
||||
set_extent_bit(&fs_info->excluded_extents, start, end,
|
||||
EXTENT_UPTODATE, NULL, GFP_NOFS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -5981,9 +5981,9 @@ static int btrfs_trim_free_extents(struct btrfs_device *device, u64 *trimmed)
|
||||
ret = btrfs_issue_discard(device->bdev, start, len,
|
||||
&bytes);
|
||||
if (!ret)
|
||||
set_extent_bits(&device->alloc_state, start,
|
||||
start + bytes - 1,
|
||||
CHUNK_TRIMMED);
|
||||
set_extent_bit(&device->alloc_state, start,
|
||||
start + bytes - 1,
|
||||
CHUNK_TRIMMED, NULL, GFP_NOFS);
|
||||
mutex_unlock(&fs_info->chunk_mutex);
|
||||
|
||||
if (ret)
|
||||
|
||||
@@ -94,8 +94,8 @@ int btrfs_inode_set_file_extent_range(struct btrfs_inode *inode, u64 start,
|
||||
|
||||
if (btrfs_fs_incompat(inode->root->fs_info, NO_HOLES))
|
||||
return 0;
|
||||
return set_extent_bits(&inode->file_extent_tree, start, start + len - 1,
|
||||
EXTENT_DIRTY);
|
||||
return set_extent_bit(&inode->file_extent_tree, start, start + len - 1,
|
||||
EXTENT_DIRTY, NULL, GFP_NOFS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -438,9 +438,9 @@ blk_status_t btrfs_lookup_bio_sums(struct btrfs_bio *bbio)
|
||||
BTRFS_DATA_RELOC_TREE_OBJECTID) {
|
||||
u64 file_offset = bbio->file_offset + bio_offset;
|
||||
|
||||
set_extent_bits(&inode->io_tree, file_offset,
|
||||
file_offset + sectorsize - 1,
|
||||
EXTENT_NODATASUM);
|
||||
set_extent_bit(&inode->io_tree, file_offset,
|
||||
file_offset + sectorsize - 1,
|
||||
EXTENT_NODATASUM, NULL, GFP_NOFS);
|
||||
} else {
|
||||
btrfs_warn_rl(fs_info,
|
||||
"csum hole found for disk bytenr range [%llu, %llu)",
|
||||
|
||||
@@ -174,8 +174,9 @@ static void mark_block_processed(struct reloc_control *rc,
|
||||
in_range(node->bytenr, rc->block_group->start,
|
||||
rc->block_group->length)) {
|
||||
blocksize = rc->extent_root->fs_info->nodesize;
|
||||
set_extent_bits(&rc->processed_blocks, node->bytenr,
|
||||
node->bytenr + blocksize - 1, EXTENT_DIRTY);
|
||||
set_extent_bit(&rc->processed_blocks, node->bytenr,
|
||||
node->bytenr + blocksize - 1, EXTENT_DIRTY,
|
||||
NULL, GFP_NOFS);
|
||||
}
|
||||
node->processed = 1;
|
||||
}
|
||||
@@ -3051,9 +3052,9 @@ static int relocate_one_page(struct inode *inode, struct file_ra_state *ra,
|
||||
u64 boundary_end = boundary_start +
|
||||
fs_info->sectorsize - 1;
|
||||
|
||||
set_extent_bits(&BTRFS_I(inode)->io_tree,
|
||||
boundary_start, boundary_end,
|
||||
EXTENT_BOUNDARY);
|
||||
set_extent_bit(&BTRFS_I(inode)->io_tree,
|
||||
boundary_start, boundary_end,
|
||||
EXTENT_BOUNDARY, NULL, GFP_NOFS);
|
||||
}
|
||||
unlock_extent(&BTRFS_I(inode)->io_tree, clamped_start, clamped_end,
|
||||
&cached_state);
|
||||
|
||||
@@ -503,8 +503,8 @@ static int test_find_first_clear_extent_bit(void)
|
||||
* Set 1M-4M alloc/discard and 32M-64M thus leaving a hole between
|
||||
* 4M-32M
|
||||
*/
|
||||
set_extent_bits(&tree, SZ_1M, SZ_4M - 1,
|
||||
CHUNK_TRIMMED | CHUNK_ALLOCATED);
|
||||
set_extent_bit(&tree, SZ_1M, SZ_4M - 1,
|
||||
CHUNK_TRIMMED | CHUNK_ALLOCATED, NULL, GFP_NOFS);
|
||||
|
||||
find_first_clear_extent_bit(&tree, SZ_512K, &start, &end,
|
||||
CHUNK_TRIMMED | CHUNK_ALLOCATED);
|
||||
@@ -516,8 +516,8 @@ static int test_find_first_clear_extent_bit(void)
|
||||
}
|
||||
|
||||
/* Now add 32M-64M so that we have a hole between 4M-32M */
|
||||
set_extent_bits(&tree, SZ_32M, SZ_64M - 1,
|
||||
CHUNK_TRIMMED | CHUNK_ALLOCATED);
|
||||
set_extent_bit(&tree, SZ_32M, SZ_64M - 1,
|
||||
CHUNK_TRIMMED | CHUNK_ALLOCATED, NULL, GFP_NOFS);
|
||||
|
||||
/*
|
||||
* Request first hole starting at 12M, we should get 4M-32M
|
||||
@@ -548,7 +548,8 @@ static int test_find_first_clear_extent_bit(void)
|
||||
* Set 64M-72M with CHUNK_ALLOC flag, then search for CHUNK_TRIMMED flag
|
||||
* being unset in this range, we should get the entry in range 64M-72M
|
||||
*/
|
||||
set_extent_bits(&tree, SZ_64M, SZ_64M + SZ_8M - 1, CHUNK_ALLOCATED);
|
||||
set_extent_bit(&tree, SZ_64M, SZ_64M + SZ_8M - 1, CHUNK_ALLOCATED, NULL,
|
||||
GFP_NOFS);
|
||||
find_first_clear_extent_bit(&tree, SZ_64M + SZ_1M, &start, &end,
|
||||
CHUNK_TRIMMED);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user