summaryrefslogtreecommitdiff
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)
downloadlwn-86479a04eef8f304a13aeb8b64bcc8e506a68268.tar.gz
lwn-86479a04eef8f304a13aeb8b64bcc8e506a68268.zip
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 @@
#include <linux/blkdev.h>
#include "extent_map.h"
+/* temporary define until extent_map moves out of btrfs */
+struct kmem_cache *btrfs_cache_create(const char *name, size_t size,
+ unsigned long extra_flags,
+ void (*ctor)(void *, struct kmem_cache *,
+ unsigned long));
+
static struct kmem_cache *extent_map_cache;
static struct kmem_cache *extent_state_cache;
@@ -32,14 +38,12 @@ struct tree_entry {
void __init extent_map_init(void)
{
- extent_map_cache = kmem_cache_create("extent_map",
- sizeof(struct extent_map), 0,
- SLAB_RECLAIM_ACCOUNT |
+ extent_map_cache = btrfs_cache_create("extent_map",
+ sizeof(struct extent_map),
SLAB_DESTROY_BY_RCU,
NULL);
- extent_state_cache = kmem_cache_create("extent_state",
- sizeof(struct extent_state), 0,
- SLAB_RECLAIM_ACCOUNT |
+ extent_state_cache = btrfs_cache_create("extent_state",
+ sizeof(struct extent_state),
SLAB_DESTROY_BY_RCU,
NULL);
}