aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/extent_io.c18
-rw-r--r--fs/btrfs/extent_map.c11
-rw-r--r--fs/btrfs/inode.c42
3 files changed, 28 insertions, 43 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 05a1c42e25bf..c33b54029d78 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -17,12 +17,6 @@
17#include "ctree.h" 17#include "ctree.h"
18#include "btrfs_inode.h" 18#include "btrfs_inode.h"
19 19
20/* temporary define until extent_map moves out of btrfs */
21struct kmem_cache *btrfs_cache_create(const char *name, size_t size,
22 unsigned long extra_flags,
23 void (*ctor)(void *, struct kmem_cache *,
24 unsigned long));
25
26static struct kmem_cache *extent_state_cache; 20static struct kmem_cache *extent_state_cache;
27static struct kmem_cache *extent_buffer_cache; 21static struct kmem_cache *extent_buffer_cache;
28 22
@@ -58,15 +52,15 @@ struct extent_page_data {
58 52
59int __init extent_io_init(void) 53int __init extent_io_init(void)
60{ 54{
61 extent_state_cache = btrfs_cache_create("extent_state", 55 extent_state_cache = kmem_cache_create("extent_state",
62 sizeof(struct extent_state), 0, 56 sizeof(struct extent_state), 0,
63 NULL); 57 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, NULL);
64 if (!extent_state_cache) 58 if (!extent_state_cache)
65 return -ENOMEM; 59 return -ENOMEM;
66 60
67 extent_buffer_cache = btrfs_cache_create("extent_buffers", 61 extent_buffer_cache = kmem_cache_create("extent_buffers",
68 sizeof(struct extent_buffer), 0, 62 sizeof(struct extent_buffer), 0,
69 NULL); 63 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, NULL);
70 if (!extent_buffer_cache) 64 if (!extent_buffer_cache)
71 goto free_state_cache; 65 goto free_state_cache;
72 return 0; 66 return 0;
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index 9827fa1de4e1..30c9365861e6 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -6,19 +6,14 @@
6#include <linux/hardirq.h> 6#include <linux/hardirq.h>
7#include "extent_map.h" 7#include "extent_map.h"
8 8
9/* temporary define until extent_map moves out of btrfs */
10struct kmem_cache *btrfs_cache_create(const char *name, size_t size,
11 unsigned long extra_flags,
12 void (*ctor)(void *, struct kmem_cache *,
13 unsigned long));
14 9
15static struct kmem_cache *extent_map_cache; 10static struct kmem_cache *extent_map_cache;
16 11
17int __init extent_map_init(void) 12int __init extent_map_init(void)
18{ 13{
19 extent_map_cache = btrfs_cache_create("extent_map", 14 extent_map_cache = kmem_cache_create("extent_map",
20 sizeof(struct extent_map), 0, 15 sizeof(struct extent_map), 0,
21 NULL); 16 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, NULL);
22 if (!extent_map_cache) 17 if (!extent_map_cache)
23 return -ENOMEM; 18 return -ENOMEM;
24 return 0; 19 return 0;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 65219f6a16a1..176b6cc28b1e 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4640,39 +4640,35 @@ void btrfs_destroy_cachep(void)
4640 kmem_cache_destroy(btrfs_path_cachep); 4640 kmem_cache_destroy(btrfs_path_cachep);
4641} 4641}
4642 4642
4643struct kmem_cache *btrfs_cache_create(const char *name, size_t size,
4644 unsigned long extra_flags,
4645 void (*ctor)(void *))
4646{
4647 return kmem_cache_create(name, size, 0, (SLAB_RECLAIM_ACCOUNT |
4648 SLAB_MEM_SPREAD | extra_flags), ctor);
4649}
4650
4651int btrfs_init_cachep(void) 4643int btrfs_init_cachep(void)
4652{ 4644{
4653 btrfs_inode_cachep = btrfs_cache_create("btrfs_inode_cache", 4645 btrfs_inode_cachep = kmem_cache_create("btrfs_inode_cache",
4654 sizeof(struct btrfs_inode), 4646 sizeof(struct btrfs_inode), 0,
4655 0, init_once); 4647 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, init_once);
4656 if (!btrfs_inode_cachep) 4648 if (!btrfs_inode_cachep)
4657 goto fail; 4649 goto fail;
4658 btrfs_trans_handle_cachep = 4650
4659 btrfs_cache_create("btrfs_trans_handle_cache", 4651 btrfs_trans_handle_cachep = kmem_cache_create("btrfs_trans_handle_cache",
4660 sizeof(struct btrfs_trans_handle), 4652 sizeof(struct btrfs_trans_handle), 0,
4661 0, NULL); 4653 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, NULL);
4662 if (!btrfs_trans_handle_cachep) 4654 if (!btrfs_trans_handle_cachep)
4663 goto fail; 4655 goto fail;
4664 btrfs_transaction_cachep = btrfs_cache_create("btrfs_transaction_cache", 4656
4665 sizeof(struct btrfs_transaction), 4657 btrfs_transaction_cachep = kmem_cache_create("btrfs_transaction_cache",
4666 0, NULL); 4658 sizeof(struct btrfs_transaction), 0,
4659 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, NULL);
4667 if (!btrfs_transaction_cachep) 4660 if (!btrfs_transaction_cachep)
4668 goto fail; 4661 goto fail;
4669 btrfs_path_cachep = btrfs_cache_create("btrfs_path_cache", 4662
4670 sizeof(struct btrfs_path), 4663 btrfs_path_cachep = kmem_cache_create("btrfs_path_cache",
4671 0, NULL); 4664 sizeof(struct btrfs_path), 0,
4665 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, NULL);
4672 if (!btrfs_path_cachep) 4666 if (!btrfs_path_cachep)
4673 goto fail; 4667 goto fail;
4674 btrfs_bit_radix_cachep = btrfs_cache_create("btrfs_radix", 256, 4668
4675 SLAB_DESTROY_BY_RCU, NULL); 4669 btrfs_bit_radix_cachep = kmem_cache_create("btrfs_radix", 256, 0,
4670 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD |
4671 SLAB_DESTROY_BY_RCU, NULL);
4676 if (!btrfs_bit_radix_cachep) 4672 if (!btrfs_bit_radix_cachep)
4677 goto fail; 4673 goto fail;
4678 return 0; 4674 return 0;