summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-04-27 01:03:45 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-06-07 18:18:56 -0700
commitc396d335d89fc0fc21032b478ef610fdd0b08906 (patch)
treeb4a4e6d846d3bd85085327e97c592f20e2c68de4
parentf8f2b9dd9ccb165fa472855ef98e624e3173f8dd (diff)
downloadlinux-stable-c396d335d89fc0fc21032b478ef610fdd0b08906.tar.gz
linux-stable-c396d335d89fc0fc21032b478ef610fdd0b08906.tar.bz2
linux-stable-c396d335d89fc0fc21032b478ef610fdd0b08906.zip
btrfs: make state preallocation more speculative in __set_extent_bit
commit 059f791c6bbaba72dc3c1bd6e2657aacc8552849 upstream. Similar to __clear_extent_bit, do not fail if the state preallocation fails as we might not need it. One less BUG_ON. Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/btrfs/extent_io.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 57fccc420697..b5ff48d6a0c5 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -875,8 +875,14 @@ __set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
bits |= EXTENT_FIRST_DELALLOC;
again:
if (!prealloc && gfpflags_allow_blocking(mask)) {
+ /*
+ * Don't care for allocation failure here because we might end
+ * up not needing the pre-allocated extent state at all, which
+ * is the case if we only have in the tree extent states that
+ * cover our input range and don't cover too any other range.
+ * If we end up needing a new extent state we allocate it later.
+ */
prealloc = alloc_extent_state(mask);
- BUG_ON(!prealloc);
}
spin_lock(&tree->lock);