]>
Commit | Line | Data |
---|---|---|
9c28119d GKH |
1 | From 059f791c6bbaba72dc3c1bd6e2657aacc8552849 Mon Sep 17 00:00:00 2001 |
2 | From: David Sterba <dsterba@suse.com> | |
3 | Date: Wed, 27 Apr 2016 01:03:45 +0200 | |
4 | Subject: btrfs: make state preallocation more speculative in __set_extent_bit | |
5 | ||
6 | From: David Sterba <dsterba@suse.com> | |
7 | ||
8 | commit 059f791c6bbaba72dc3c1bd6e2657aacc8552849 upstream. | |
9 | ||
10 | Similar to __clear_extent_bit, do not fail if the state preallocation | |
11 | fails as we might not need it. One less BUG_ON. | |
12 | ||
13 | Signed-off-by: David Sterba <dsterba@suse.com> | |
14 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
15 | ||
16 | --- | |
17 | fs/btrfs/extent_io.c | 8 +++++++- | |
18 | 1 file changed, 7 insertions(+), 1 deletion(-) | |
19 | ||
20 | --- a/fs/btrfs/extent_io.c | |
21 | +++ b/fs/btrfs/extent_io.c | |
22 | @@ -875,8 +875,14 @@ __set_extent_bit(struct extent_io_tree * | |
23 | bits |= EXTENT_FIRST_DELALLOC; | |
24 | again: | |
25 | if (!prealloc && gfpflags_allow_blocking(mask)) { | |
26 | + /* | |
27 | + * Don't care for allocation failure here because we might end | |
28 | + * up not needing the pre-allocated extent state at all, which | |
29 | + * is the case if we only have in the tree extent states that | |
30 | + * cover our input range and don't cover too any other range. | |
31 | + * If we end up needing a new extent state we allocate it later. | |
32 | + */ | |
33 | prealloc = alloc_extent_state(mask); | |
34 | - BUG_ON(!prealloc); | |
35 | } | |
36 | ||
37 | spin_lock(&tree->lock); |