aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-04-26 17:54:39 -0400
committerDavid Sterba <dsterba@suse.com>2016-04-29 07:48:14 -0400
commit210aa27768bec4297a9d6ad0e5cab45935c775e9 (patch)
tree3b1e723a0f4dda6cfe820f20f8d193dc3b4c5100 /fs
parent059f791c6bbaba72dc3c1bd6e2657aacc8552849 (diff)
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 <dsterba@suse.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/extent_io.c12
-rw-r--r--fs/btrfs/extent_io.h2
-rw-r--r--fs/btrfs/transaction.c2
3 files changed, 8 insertions, 8 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 8707bcc615ff..c1139bcf8870 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1078,17 +1078,18 @@ int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
1078 * @bits: the bits to set in this range 1078 * @bits: the bits to set in this range
1079 * @clear_bits: the bits to clear in this range 1079 * @clear_bits: the bits to clear in this range
1080 * @cached_state: state that we're going to cache 1080 * @cached_state: state that we're going to cache
1081 * @mask: the allocation mask
1082 * 1081 *
1083 * This will go through and set bits for the given range. If any states exist 1082 * This will go through and set bits for the given range. If any states exist
1084 * already in this range they are set with the given bit and cleared of the 1083 * already in this range they are set with the given bit and cleared of the
1085 * clear_bits. This is only meant to be used by things that are mergeable, ie 1084 * clear_bits. This is only meant to be used by things that are mergeable, ie
1086 * converting from say DELALLOC to DIRTY. This is not meant to be used with 1085 * converting from say DELALLOC to DIRTY. This is not meant to be used with
1087 * boundary bits like LOCK. 1086 * boundary bits like LOCK.
1087 *
1088 * All allocations are done with GFP_NOFS.
1088 */ 1089 */
1089int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, 1090int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
1090 unsigned bits, unsigned clear_bits, 1091 unsigned bits, unsigned clear_bits,
1091 struct extent_state **cached_state, gfp_t mask) 1092 struct extent_state **cached_state)
1092{ 1093{
1093 struct extent_state *state; 1094 struct extent_state *state;
1094 struct extent_state *prealloc = NULL; 1095 struct extent_state *prealloc = NULL;
@@ -1103,7 +1104,7 @@ int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
1103 btrfs_debug_check_extent_io_range(tree, start, end); 1104 btrfs_debug_check_extent_io_range(tree, start, end);
1104 1105
1105again: 1106again:
1106 if (!prealloc && gfpflags_allow_blocking(mask)) { 1107 if (!prealloc) {
1107 /* 1108 /*
1108 * Best effort, don't worry if extent state allocation fails 1109 * Best effort, don't worry if extent state allocation fails
1109 * here for the first iteration. We might have a cached state 1110 * here for the first iteration. We might have a cached state
@@ -1111,7 +1112,7 @@ again:
1111 * extent state allocations are needed. We'll only know this 1112 * extent state allocations are needed. We'll only know this
1112 * after locking the tree. 1113 * after locking the tree.
1113 */ 1114 */
1114 prealloc = alloc_extent_state(mask); 1115 prealloc = alloc_extent_state(GFP_NOFS);
1115 if (!prealloc && !first_iteration) 1116 if (!prealloc && !first_iteration)
1116 return -ENOMEM; 1117 return -ENOMEM;
1117 } 1118 }
@@ -1272,8 +1273,7 @@ search_again:
1272 if (start > end) 1273 if (start > end)
1273 goto out; 1274 goto out;
1274 spin_unlock(&tree->lock); 1275 spin_unlock(&tree->lock);
1275 if (gfpflags_allow_blocking(mask)) 1276 cond_resched();
1276 cond_resched();
1277 first_iteration = false; 1277 first_iteration = false;
1278 goto again; 1278 goto again;
1279 1279
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 94b376446042..9c1f160c5984 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -287,7 +287,7 @@ static inline int clear_extent_dirty(struct extent_io_tree *tree, u64 start,
287 287
288int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, 288int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
289 unsigned bits, unsigned clear_bits, 289 unsigned bits, unsigned clear_bits,
290 struct extent_state **cached_state, gfp_t mask); 290 struct extent_state **cached_state);
291 291
292static inline int set_extent_delalloc(struct extent_io_tree *tree, u64 start, 292static inline int set_extent_delalloc(struct extent_io_tree *tree, u64 start,
293 u64 end, struct extent_state **cached_state) 293 u64 end, struct extent_state **cached_state)
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 43885e51b882..98b93d9c6213 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -943,7 +943,7 @@ int btrfs_write_marked_extents(struct btrfs_root *root,
943 943
944 err = convert_extent_bit(dirty_pages, start, end, 944 err = convert_extent_bit(dirty_pages, start, end,
945 EXTENT_NEED_WAIT, 945 EXTENT_NEED_WAIT,
946 mark, &cached_state, GFP_NOFS); 946 mark, &cached_state);
947 /* 947 /*
948 * convert_extent_bit can return -ENOMEM, which is most of the 948 * convert_extent_bit can return -ENOMEM, which is most of the
949 * time a temporary error. So when it happens, ignore the error 949 * time a temporary error. So when it happens, ignore the error