aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_map.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-09-10 19:58:16 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-09-10 19:58:16 -0400
commit86479a04eef8f304a13aeb8b64bcc8e506a68268 (patch)
treecda7e66d469bcdc2f41144ea91405aeb96d1f777 /fs/btrfs/extent_map.c
parent8e21528f87854314792aaef4d279bc9e5a9be997 (diff)
Add support for defragging files via btrfsctl -d. Avoid OOM on extent tree
defrag. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_map.c')
-rw-r--r--fs/btrfs/extent_map.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index 8ad6f8efc5a0..33f7a18dddf7 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -10,6 +10,12 @@
10#include <linux/blkdev.h> 10#include <linux/blkdev.h>
11#include "extent_map.h" 11#include "extent_map.h"
12 12
13/* temporary define until extent_map moves out of btrfs */
14struct kmem_cache *btrfs_cache_create(const char *name, size_t size,
15 unsigned long extra_flags,
16 void (*ctor)(void *, struct kmem_cache *,
17 unsigned long));
18
13static struct kmem_cache *extent_map_cache; 19static struct kmem_cache *extent_map_cache;
14static struct kmem_cache *extent_state_cache; 20static struct kmem_cache *extent_state_cache;
15 21
@@ -32,14 +38,12 @@ struct tree_entry {
32 38
33void __init extent_map_init(void) 39void __init extent_map_init(void)
34{ 40{
35 extent_map_cache = kmem_cache_create("extent_map", 41 extent_map_cache = btrfs_cache_create("extent_map",
36 sizeof(struct extent_map), 0, 42 sizeof(struct extent_map),
37 SLAB_RECLAIM_ACCOUNT |
38 SLAB_DESTROY_BY_RCU, 43 SLAB_DESTROY_BY_RCU,
39 NULL); 44 NULL);
40 extent_state_cache = kmem_cache_create("extent_state", 45 extent_state_cache = btrfs_cache_create("extent_state",
41 sizeof(struct extent_state), 0, 46 sizeof(struct extent_state),
42 SLAB_RECLAIM_ACCOUNT |
43 SLAB_DESTROY_BY_RCU, 47 SLAB_DESTROY_BY_RCU,
44 NULL); 48 NULL);
45} 49}