diff options
author | Josef Bacik <jbacik@fusionio.com> | 2012-08-06 15:46:38 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2012-08-28 16:53:34 -0400 |
commit | 6fc823b10f333313deb0b5d9069cbfd3a3f99f3a (patch) | |
tree | 69648399050cf3f23a487efa382907c5b89dec3f | |
parent | 66657b318e0e443ada229fccd40c8be86cfebdbf (diff) |
Btrfs: increase the size of the free space cache
Arne was complaining about the space cache having mismatching generation
numbers when debugging a deadlock. This is because we can run out of space
in our preallocated range for our space cache if you have a pretty
fragmented amount of space in your pinned space. So just increase the
amount of space we preallocate for space cache so we can be sure to have
enough space. This will only really affect data ranges since their the only
chunks that end up larger than 256MB. Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
-rw-r--r-- | fs/btrfs/extent-tree.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index d3df65f83b5c..1bb408f737fb 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -2975,17 +2975,16 @@ again: | |||
2975 | } | 2975 | } |
2976 | spin_unlock(&block_group->lock); | 2976 | spin_unlock(&block_group->lock); |
2977 | 2977 | ||
2978 | num_pages = (int)div64_u64(block_group->key.offset, 1024 * 1024 * 1024); | 2978 | /* |
2979 | * Try to preallocate enough space based on how big the block group is. | ||
2980 | * Keep in mind this has to include any pinned space which could end up | ||
2981 | * taking up quite a bit since it's not folded into the other space | ||
2982 | * cache. | ||
2983 | */ | ||
2984 | num_pages = (int)div64_u64(block_group->key.offset, 256 * 1024 * 1024); | ||
2979 | if (!num_pages) | 2985 | if (!num_pages) |
2980 | num_pages = 1; | 2986 | num_pages = 1; |
2981 | 2987 | ||
2982 | /* | ||
2983 | * Just to make absolutely sure we have enough space, we're going to | ||
2984 | * preallocate 12 pages worth of space for each block group. In | ||
2985 | * practice we ought to use at most 8, but we need extra space so we can | ||
2986 | * add our header and have a terminator between the extents and the | ||
2987 | * bitmaps. | ||
2988 | */ | ||
2989 | num_pages *= 16; | 2988 | num_pages *= 16; |
2990 | num_pages *= PAGE_CACHE_SIZE; | 2989 | num_pages *= PAGE_CACHE_SIZE; |
2991 | 2990 | ||