diff options
author | Josef Bacik <josef@toxicpanda.com> | 2022-09-09 23:53:47 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-09-26 12:28:05 +0200 |
commit | bd015294af4d919f94ede252e035f3c11638ea1f (patch) | |
tree | 8e1aa94701d1921e7721ef58aabf86cb6a55c0fb /fs/btrfs/extent-io-tree.c | |
parent | btrfs: don't clear CTL bits when trying to release extent state (diff) | |
download | linux-bd015294af4d919f94ede252e035f3c11638ea1f.tar.xz linux-bd015294af4d919f94ede252e035f3c11638ea1f.zip |
btrfs: replace delete argument with EXTENT_CLEAR_ALL_BITS
Instead of taking up a whole argument to indicate we're clearing
everything in a range, simply add another EXTENT bit to control this,
and then update all the callers to drop this argument from the
clear_extent_bit variants.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/extent-io-tree.c')
-rw-r--r-- | fs/btrfs/extent-io-tree.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/btrfs/extent-io-tree.c b/fs/btrfs/extent-io-tree.c index c14e13388150..da6eb2dd7377 100644 --- a/fs/btrfs/extent-io-tree.c +++ b/fs/btrfs/extent-io-tree.c @@ -547,8 +547,7 @@ static struct extent_state *clear_state_bit(struct extent_io_tree *tree, * This takes the tree lock, and returns 0 on success and < 0 on error. */ int __clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, - u32 bits, int delete, - struct extent_state **cached_state, + u32 bits, struct extent_state **cached_state, gfp_t mask, struct extent_changeset *changeset) { struct extent_state *state; @@ -557,17 +556,19 @@ int __clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, u64 last_end; int err; int clear = 0; - int wake = (bits & EXTENT_LOCKED) ? 1 : 0; + int wake; + int delete = (bits & EXTENT_CLEAR_ALL_BITS); btrfs_debug_check_extent_io_range(tree, start, end); trace_btrfs_clear_extent_bit(tree, start, end - start + 1, bits); - if (bits & EXTENT_DELALLOC) - bits |= EXTENT_NORESERVE; - if (delete) bits |= ~EXTENT_CTLBITS; + if (bits & EXTENT_DELALLOC) + bits |= EXTENT_NORESERVE; + + wake = (bits & EXTENT_LOCKED) ? 1 : 0; if (bits & (EXTENT_LOCKED | EXTENT_BOUNDARY)) clear = 1; again: @@ -1610,7 +1611,7 @@ int clear_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, */ ASSERT(!(bits & EXTENT_LOCKED)); - return __clear_extent_bit(tree, start, end, bits, 0, NULL, GFP_NOFS, + return __clear_extent_bit(tree, start, end, bits, NULL, GFP_NOFS, changeset); } @@ -1624,7 +1625,7 @@ int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end) if (err == -EEXIST) { if (failed_start > start) clear_extent_bit(tree, start, failed_start - 1, - EXTENT_LOCKED, 0, NULL); + EXTENT_LOCKED, NULL); return 0; } return 1; |