All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH 16/16] btrfs: sink gfp parameter to convert_extent_bit
Date: Fri, 29 Apr 2016 11:21:07 +0200	[thread overview]
Message-ID: <5c73331ee86270cf6316a58136c17deb49455ccd.1461920675.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1461920675.git.dsterba@suse.com>

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>
---
 fs/btrfs/extent_io.c   | 14 +++++++-------
 fs/btrfs/extent_io.h   |  2 +-
 fs/btrfs/transaction.c |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 092f697470d8..58483f928000 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1092,17 +1092,18 @@ int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
  * @bits:	the bits to set in this range
  * @clear_bits:	the bits to clear in this range
  * @cached_state:	state that we're going to cache
- * @mask:	the allocation mask
  *
  * This will go through and set bits for the given range.  If any states exist
  * already in this range they are set with the given bit and cleared of the
  * clear_bits.  This is only meant to be used by things that are mergeable, ie
  * converting from say DELALLOC to DIRTY.  This is not meant to be used with
  * boundary bits like LOCK.
+ *
+ * All allocations are done with GFP_NOFS.
  */
 int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
 		       unsigned bits, unsigned clear_bits,
-		       struct extent_state **cached_state, gfp_t mask)
+		       struct extent_state **cached_state)
 {
 	struct extent_state *state;
 	struct extent_state *prealloc = NULL;
@@ -1117,7 +1118,7 @@ int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
 	btrfs_debug_check_extent_io_range(tree, start, end);
 
 again:
-	if (!prealloc && gfpflags_allow_blocking(mask)) {
+	if (!prealloc) {
 		/*
 		 * Best effort, don't worry if extent state allocation fails
 		 * here for the first iteration. We might have a cached state
@@ -1125,7 +1126,7 @@ int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
 		 * extent state allocations are needed. We'll only know this
 		 * after locking the tree.
 		 */
-		prealloc = alloc_extent_state(mask);
+		prealloc = alloc_extent_state(GFP_NOFS);
 		if (!prealloc && !first_iteration)
 			return -ENOMEM;
 	}
@@ -1286,15 +1287,14 @@ int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
 	if (start > end)
 		goto out;
 	spin_unlock(&tree->lock);
-	if (gfpflags_allow_blocking(mask))
-		cond_resched();
+	cond_resched();
 	/*
 	 * If we used the preallocated state, try again here out of the
 	 * locked section so we can avoid GFP_ATOMIC. No error checking
 	 * as we might not need it in the end.
 	 */
 	if (!prealloc)
-		prealloc = alloc_extent_state(mask);
+		prealloc = alloc_extent_state(GFP_NOFS);
 	first_iteration = false;
 	goto again;
 
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,
 
 int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
 		       unsigned bits, unsigned clear_bits,
-		       struct extent_state **cached_state, gfp_t mask);
+		       struct extent_state **cached_state);
 
 static inline int set_extent_delalloc(struct extent_io_tree *tree, u64 start,
 		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,
 
 		err = convert_extent_bit(dirty_pages, start, end,
 					 EXTENT_NEED_WAIT,
-					 mark, &cached_state, GFP_NOFS);
+					 mark, &cached_state);
 		/*
 		 * convert_extent_bit can return -ENOMEM, which is most of the
 		 * time a temporary error. So when it happens, ignore the error
-- 
2.7.1


      parent reply	other threads:[~2016-04-29  9:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-29  9:20 [PATCH 00/16] Minor cleanups in GFP_NOFS flags use David Sterba
2016-04-29  9:20 ` [PATCH 01/16] btrfs: sink gfp parameter to set_extent_bits David Sterba
2016-04-29  9:20 ` [PATCH 02/16] btrfs: sink gfp parameter to clear_extent_bits David Sterba
2016-04-29  9:20 ` [PATCH 03/16] btrfs: sink gfp parameter to clear_record_extent_bits David Sterba
2016-04-29  9:20 ` [PATCH 04/16] btrfs: sink gfp parameter to clear_extent_dirty David Sterba
2016-04-29  9:20 ` [PATCH 05/16] btrfs: sink gfp parameter to set_extent_delalloc David Sterba
2016-04-29  9:20 ` [PATCH 06/16] btrfs: sink gfp parameter to set_extent_defrag David Sterba
2016-04-29  9:20 ` [PATCH 07/16] btrfs: sink gfp parameter to set_extent_new David Sterba
2016-04-29  9:20 ` [PATCH 08/16] btrfs: sink gfp parameter to set_record_extent_bits David Sterba
2016-04-29  9:20 ` [PATCH 09/16] btrfs: untangle gotos a bit in __set_extent_bit David Sterba
2016-04-29  9:20 ` [PATCH 10/16] btrfs: untangle gotos a bit in __clear_extent_bit David Sterba
2016-04-29  9:20 ` [PATCH 11/16] btrfs: untangle gotos a bit in convert_extent_bit David Sterba
2016-04-29  9:20 ` [PATCH 12/16] btrfs: make state preallocation more speculative in __set_extent_bit David Sterba
2016-04-29  9:20 ` [PATCH 13/16] btrfs: __set_extent_bit, try preallocation out of locked section with lighter gfp flags David Sterba
2016-04-29 10:00   ` Filipe Manana
2016-04-29 11:46     ` David Sterba
2016-04-29  9:21 ` [PATCH 14/16] btrfs: __clear_extent_bit, " David Sterba
2016-04-29  9:21 ` [PATCH 15/16] btrfs: convert_extent_bit, " David Sterba
2016-04-29  9:21 ` David Sterba [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5c73331ee86270cf6316a58136c17deb49455ccd.1461920675.git.dsterba@suse.com \
    --to=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.