Commit 66b0c887 authored by David Sterba's avatar David Sterba

btrfs: prepare to drop gfp mask parameter from clear_extent_bit

Use __clear_extent_bit directly in case we want to pass unknown
gfp flags. Otherwise all clear_extent_bit callers use GFP_NOFS, so we
can sink them to the function and reduce argument count, at the cost
that __clear_extent_bit has to be exported.
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 1538e6c5
...@@ -581,7 +581,7 @@ static void extent_io_tree_panic(struct extent_io_tree *tree, int err) ...@@ -581,7 +581,7 @@ static void extent_io_tree_panic(struct extent_io_tree *tree, int err)
* *
* This takes the tree lock, and returns 0 on success and < 0 on error. * This takes the tree lock, and returns 0 on success and < 0 on error.
*/ */
static int __clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int __clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
unsigned bits, int wake, int delete, unsigned bits, int wake, int delete,
struct extent_state **cached_state, struct extent_state **cached_state,
gfp_t mask, struct extent_changeset *changeset) gfp_t mask, struct extent_changeset *changeset)
...@@ -4232,9 +4232,9 @@ static int try_release_extent_state(struct extent_map_tree *map, ...@@ -4232,9 +4232,9 @@ static int try_release_extent_state(struct extent_map_tree *map,
* at this point we can safely clear everything except the * at this point we can safely clear everything except the
* locked bit and the nodatasum bit * locked bit and the nodatasum bit
*/ */
ret = clear_extent_bit(tree, start, end, ret = __clear_extent_bit(tree, start, end,
~(EXTENT_LOCKED | EXTENT_NODATASUM), ~(EXTENT_LOCKED | EXTENT_NODATASUM),
0, 0, NULL, mask); 0, 0, NULL, mask, NULL);
/* if clear_extent_bit failed for enomem reasons, /* if clear_extent_bit failed for enomem reasons,
* we can't allow the release to continue. * we can't allow the release to continue.
......
...@@ -301,6 +301,10 @@ int clear_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, ...@@ -301,6 +301,10 @@ int clear_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
unsigned bits, int wake, int delete, unsigned bits, int wake, int delete,
struct extent_state **cached, gfp_t mask); struct extent_state **cached, gfp_t mask);
int __clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
unsigned bits, int wake, int delete,
struct extent_state **cached, gfp_t mask,
struct extent_changeset *changeset);
static inline int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end) static inline int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end)
{ {
...@@ -311,8 +315,8 @@ static inline int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end) ...@@ -311,8 +315,8 @@ static inline int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end)
static inline int unlock_extent_cached(struct extent_io_tree *tree, u64 start, static inline int unlock_extent_cached(struct extent_io_tree *tree, u64 start,
u64 end, struct extent_state **cached, gfp_t mask) u64 end, struct extent_state **cached, gfp_t mask)
{ {
return clear_extent_bit(tree, start, end, EXTENT_LOCKED, 1, 0, cached, return __clear_extent_bit(tree, start, end, EXTENT_LOCKED, 1, 0, cached,
mask); mask, NULL);
} }
static inline int clear_extent_bits(struct extent_io_tree *tree, u64 start, static inline int clear_extent_bits(struct extent_io_tree *tree, u64 start,
...@@ -342,8 +346,8 @@ static inline int set_extent_bits(struct extent_io_tree *tree, u64 start, ...@@ -342,8 +346,8 @@ static inline int set_extent_bits(struct extent_io_tree *tree, u64 start,
static inline int clear_extent_uptodate(struct extent_io_tree *tree, u64 start, static inline int clear_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 clear_extent_bit(tree, start, end, EXTENT_UPTODATE, 0, 0, return __clear_extent_bit(tree, start, end, EXTENT_UPTODATE, 0, 0,
cached_state, mask); cached_state, mask, NULL);
} }
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,
......
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