Commit c07d1004 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: drop exclusive_bits from set_extent_bit

This is only ever set if we have EXTENT_LOCKED set, so simply push this
into the function itself and remove the function argument.
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent d6f65c27
...@@ -953,8 +953,8 @@ bool btrfs_find_delalloc_range(struct extent_io_tree *tree, u64 *start, ...@@ -953,8 +953,8 @@ bool btrfs_find_delalloc_range(struct extent_io_tree *tree, u64 *start,
* *
* [start, end] is inclusive This takes the tree lock. * [start, end] is inclusive This takes the tree lock.
*/ */
int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, u32 bits, int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
u32 exclusive_bits, u64 *failed_start, u32 bits, u64 *failed_start,
struct extent_state **cached_state, gfp_t mask, struct extent_state **cached_state, gfp_t mask,
struct extent_changeset *changeset) struct extent_changeset *changeset)
{ {
...@@ -965,6 +965,7 @@ int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, u32 bits, ...@@ -965,6 +965,7 @@ int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, u32 bits,
int err = 0; int err = 0;
u64 last_start; u64 last_start;
u64 last_end; u64 last_end;
u32 exclusive_bits = (bits & EXTENT_LOCKED);
btrfs_debug_check_extent_io_range(tree, start, end); btrfs_debug_check_extent_io_range(tree, start, end);
trace_btrfs_set_extent_bit(tree, start, end - start + 1, bits); trace_btrfs_set_extent_bit(tree, start, end - start + 1, bits);
...@@ -1603,7 +1604,7 @@ int set_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, ...@@ -1603,7 +1604,7 @@ int set_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
*/ */
ASSERT(!(bits & EXTENT_LOCKED)); ASSERT(!(bits & EXTENT_LOCKED));
return set_extent_bit(tree, start, end, bits, 0, NULL, NULL, GFP_NOFS, return set_extent_bit(tree, start, end, bits, NULL, NULL, GFP_NOFS,
changeset); changeset);
} }
...@@ -1625,8 +1626,8 @@ int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end) ...@@ -1625,8 +1626,8 @@ int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end)
int err; int err;
u64 failed_start; u64 failed_start;
err = set_extent_bit(tree, start, end, EXTENT_LOCKED, EXTENT_LOCKED, err = set_extent_bit(tree, start, end, EXTENT_LOCKED, &failed_start,
&failed_start, NULL, GFP_NOFS, NULL); NULL, GFP_NOFS, NULL);
if (err == -EEXIST) { if (err == -EEXIST) {
if (failed_start > start) if (failed_start > start)
clear_extent_bit(tree, start, failed_start - 1, clear_extent_bit(tree, start, failed_start - 1,
...@@ -1648,8 +1649,8 @@ int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, ...@@ -1648,8 +1649,8 @@ int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
while (1) { while (1) {
err = set_extent_bit(tree, start, end, EXTENT_LOCKED, err = set_extent_bit(tree, start, end, EXTENT_LOCKED,
EXTENT_LOCKED, &failed_start, &failed_start, cached_state, GFP_NOFS,
cached_state, GFP_NOFS, NULL); NULL);
if (err == -EEXIST) { if (err == -EEXIST) {
wait_extent_bit(tree, failed_start, end, EXTENT_LOCKED); wait_extent_bit(tree, failed_start, end, EXTENT_LOCKED);
start = failed_start; start = failed_start;
......
...@@ -166,21 +166,21 @@ static inline int clear_extent_bits(struct extent_io_tree *tree, u64 start, ...@@ -166,21 +166,21 @@ static inline int clear_extent_bits(struct extent_io_tree *tree, u64 start,
int set_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, int set_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
u32 bits, struct extent_changeset *changeset); u32 bits, struct extent_changeset *changeset);
int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
u32 bits, unsigned exclusive_bits, u64 *failed_start, u32 bits, u64 *failed_start,
struct extent_state **cached_state, gfp_t mask, struct extent_state **cached_state, gfp_t mask,
struct extent_changeset *changeset); struct extent_changeset *changeset);
static inline int set_extent_bits_nowait(struct extent_io_tree *tree, u64 start, static inline int set_extent_bits_nowait(struct extent_io_tree *tree, u64 start,
u64 end, u32 bits) u64 end, u32 bits)
{ {
return set_extent_bit(tree, start, end, bits, 0, NULL, NULL, return set_extent_bit(tree, start, end, bits, NULL, NULL, GFP_NOWAIT,
GFP_NOWAIT, NULL); NULL);
} }
static inline int set_extent_bits(struct extent_io_tree *tree, u64 start, static inline int set_extent_bits(struct extent_io_tree *tree, u64 start,
u64 end, u32 bits) u64 end, u32 bits)
{ {
return set_extent_bit(tree, start, end, bits, 0, NULL, NULL, GFP_NOFS, return set_extent_bit(tree, start, end, bits, NULL, NULL, GFP_NOFS,
NULL); NULL);
} }
...@@ -194,8 +194,8 @@ static inline int clear_extent_uptodate(struct extent_io_tree *tree, u64 start, ...@@ -194,8 +194,8 @@ static inline int clear_extent_uptodate(struct extent_io_tree *tree, u64 start,
static inline int set_extent_dirty(struct extent_io_tree *tree, u64 start, static inline int set_extent_dirty(struct extent_io_tree *tree, u64 start,
u64 end, gfp_t mask) u64 end, gfp_t mask)
{ {
return set_extent_bit(tree, start, end, EXTENT_DIRTY, 0, NULL, NULL, return set_extent_bit(tree, start, end, EXTENT_DIRTY, NULL, NULL, mask,
mask, NULL); NULL);
} }
static inline int clear_extent_dirty(struct extent_io_tree *tree, u64 start, static inline int clear_extent_dirty(struct extent_io_tree *tree, u64 start,
...@@ -216,7 +216,7 @@ static inline int set_extent_delalloc(struct extent_io_tree *tree, u64 start, ...@@ -216,7 +216,7 @@ static inline int set_extent_delalloc(struct extent_io_tree *tree, u64 start,
{ {
return set_extent_bit(tree, start, end, return set_extent_bit(tree, start, end,
EXTENT_DELALLOC | extra_bits, EXTENT_DELALLOC | extra_bits,
0, NULL, cached_state, GFP_NOFS, NULL); NULL, cached_state, GFP_NOFS, NULL);
} }
static inline int set_extent_defrag(struct extent_io_tree *tree, u64 start, static inline int set_extent_defrag(struct extent_io_tree *tree, u64 start,
...@@ -224,20 +224,20 @@ static inline int set_extent_defrag(struct extent_io_tree *tree, u64 start, ...@@ -224,20 +224,20 @@ static inline int set_extent_defrag(struct extent_io_tree *tree, u64 start,
{ {
return set_extent_bit(tree, start, end, return set_extent_bit(tree, start, end,
EXTENT_DELALLOC | EXTENT_DEFRAG, EXTENT_DELALLOC | EXTENT_DEFRAG,
0, NULL, cached_state, GFP_NOFS, NULL); NULL, cached_state, GFP_NOFS, NULL);
} }
static inline int set_extent_new(struct extent_io_tree *tree, u64 start, static inline int set_extent_new(struct extent_io_tree *tree, u64 start,
u64 end) u64 end)
{ {
return set_extent_bit(tree, start, end, EXTENT_NEW, 0, NULL, NULL, return set_extent_bit(tree, start, end, EXTENT_NEW, NULL, NULL,
GFP_NOFS, NULL); GFP_NOFS, NULL);
} }
static inline int set_extent_uptodate(struct extent_io_tree *tree, u64 start, static inline int set_extent_uptodate(struct extent_io_tree *tree, u64 start,
u64 end, struct extent_state **cached_state, gfp_t mask) u64 end, struct extent_state **cached_state, gfp_t mask)
{ {
return set_extent_bit(tree, start, end, EXTENT_UPTODATE, 0, NULL, return set_extent_bit(tree, start, end, EXTENT_UPTODATE, NULL,
cached_state, mask, NULL); cached_state, mask, NULL);
} }
......
...@@ -2815,7 +2815,7 @@ static int btrfs_find_new_delalloc_bytes(struct btrfs_inode *inode, ...@@ -2815,7 +2815,7 @@ static int btrfs_find_new_delalloc_bytes(struct btrfs_inode *inode,
ret = set_extent_bit(&inode->io_tree, search_start, ret = set_extent_bit(&inode->io_tree, search_start,
search_start + em_len - 1, search_start + em_len - 1,
EXTENT_DELALLOC_NEW, 0, NULL, cached_state, EXTENT_DELALLOC_NEW, NULL, cached_state,
GFP_NOFS, NULL); GFP_NOFS, NULL);
next: next:
search_start = extent_map_end(em); search_start = extent_map_end(em);
...@@ -4963,7 +4963,7 @@ int btrfs_truncate_block(struct btrfs_inode *inode, loff_t from, loff_t len, ...@@ -4963,7 +4963,7 @@ int btrfs_truncate_block(struct btrfs_inode *inode, loff_t from, loff_t len,
if (only_release_metadata) if (only_release_metadata)
set_extent_bit(&inode->io_tree, block_start, block_end, set_extent_bit(&inode->io_tree, block_start, block_end,
EXTENT_NORESERVE, 0, NULL, NULL, GFP_NOFS, NULL); EXTENT_NORESERVE, NULL, NULL, GFP_NOFS, NULL);
out_unlock: out_unlock:
if (ret) { if (ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment