Skip to content

Commit 210aa27

Browse files
committed
btrfs: sink gfp parameter to convert_extent_bit
Single caller passes GFP_NOFS. We can get rid of the gfpflags_allow_blocking checks as NOFS can block but does not recurse to filesystem through reclaim. Signed-off-by: David Sterba <[email protected]>
1 parent 059f791 commit 210aa27

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

fs/btrfs/extent_io.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,17 +1078,18 @@ int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
10781078
* @bits: the bits to set in this range
10791079
* @clear_bits: the bits to clear in this range
10801080
* @cached_state: state that we're going to cache
1081-
* @mask: the allocation mask
10821081
*
10831082
* This will go through and set bits for the given range. If any states exist
10841083
* already in this range they are set with the given bit and cleared of the
10851084
* clear_bits. This is only meant to be used by things that are mergeable, ie
10861085
* converting from say DELALLOC to DIRTY. This is not meant to be used with
10871086
* boundary bits like LOCK.
1087+
*
1088+
* All allocations are done with GFP_NOFS.
10881089
*/
10891090
int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
10901091
unsigned bits, unsigned clear_bits,
1091-
struct extent_state **cached_state, gfp_t mask)
1092+
struct extent_state **cached_state)
10921093
{
10931094
struct extent_state *state;
10941095
struct extent_state *prealloc = NULL;
@@ -1103,15 +1104,15 @@ int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
11031104
btrfs_debug_check_extent_io_range(tree, start, end);
11041105

11051106
again:
1106-
if (!prealloc && gfpflags_allow_blocking(mask)) {
1107+
if (!prealloc) {
11071108
/*
11081109
* Best effort, don't worry if extent state allocation fails
11091110
* here for the first iteration. We might have a cached state
11101111
* that matches exactly the target range, in which case no
11111112
* extent state allocations are needed. We'll only know this
11121113
* after locking the tree.
11131114
*/
1114-
prealloc = alloc_extent_state(mask);
1115+
prealloc = alloc_extent_state(GFP_NOFS);
11151116
if (!prealloc && !first_iteration)
11161117
return -ENOMEM;
11171118
}
@@ -1272,8 +1273,7 @@ int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
12721273
if (start > end)
12731274
goto out;
12741275
spin_unlock(&tree->lock);
1275-
if (gfpflags_allow_blocking(mask))
1276-
cond_resched();
1276+
cond_resched();
12771277
first_iteration = false;
12781278
goto again;
12791279

fs/btrfs/extent_io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ static inline int clear_extent_dirty(struct extent_io_tree *tree, u64 start,
287287

288288
int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
289289
unsigned bits, unsigned clear_bits,
290-
struct extent_state **cached_state, gfp_t mask);
290+
struct extent_state **cached_state);
291291

292292
static inline int set_extent_delalloc(struct extent_io_tree *tree, u64 start,
293293
u64 end, struct extent_state **cached_state)

fs/btrfs/transaction.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ int btrfs_write_marked_extents(struct btrfs_root *root,
943943

944944
err = convert_extent_bit(dirty_pages, start, end,
945945
EXTENT_NEED_WAIT,
946-
mark, &cached_state, GFP_NOFS);
946+
mark, &cached_state);
947947
/*
948948
* convert_extent_bit can return -ENOMEM, which is most of the
949949
* time a temporary error. So when it happens, ignore the error

0 commit comments

Comments
 (0)