aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index d97b69afbbfb..2d2e079713d7 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -50,6 +50,7 @@
50#include "tree-log.h" 50#include "tree-log.h"
51#include "compression.h" 51#include "compression.h"
52#include "locking.h" 52#include "locking.h"
53#include "free-space-cache.h"
53 54
54struct btrfs_iget_args { 55struct btrfs_iget_args {
55 u64 ino; 56 u64 ino;
@@ -70,6 +71,7 @@ static struct kmem_cache *btrfs_inode_cachep;
70struct kmem_cache *btrfs_trans_handle_cachep; 71struct kmem_cache *btrfs_trans_handle_cachep;
71struct kmem_cache *btrfs_transaction_cachep; 72struct kmem_cache *btrfs_transaction_cachep;
72struct kmem_cache *btrfs_path_cachep; 73struct kmem_cache *btrfs_path_cachep;
74struct kmem_cache *btrfs_free_space_cachep;
73 75
74#define S_SHIFT 12 76#define S_SHIFT 12
75static unsigned char btrfs_type_by_mode[S_IFMT >> S_SHIFT] = { 77static unsigned char btrfs_type_by_mode[S_IFMT >> S_SHIFT] = {
@@ -6761,6 +6763,8 @@ void btrfs_destroy_cachep(void)
6761 kmem_cache_destroy(btrfs_transaction_cachep); 6763 kmem_cache_destroy(btrfs_transaction_cachep);
6762 if (btrfs_path_cachep) 6764 if (btrfs_path_cachep)
6763 kmem_cache_destroy(btrfs_path_cachep); 6765 kmem_cache_destroy(btrfs_path_cachep);
6766 if (btrfs_free_space_cachep)
6767 kmem_cache_destroy(btrfs_free_space_cachep);
6764} 6768}
6765 6769
6766int btrfs_init_cachep(void) 6770int btrfs_init_cachep(void)
@@ -6789,6 +6793,12 @@ int btrfs_init_cachep(void)
6789 if (!btrfs_path_cachep) 6793 if (!btrfs_path_cachep)
6790 goto fail; 6794 goto fail;
6791 6795
6796 btrfs_free_space_cachep = kmem_cache_create("btrfs_free_space_cache",
6797 sizeof(struct btrfs_free_space), 0,
6798 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, NULL);
6799 if (!btrfs_free_space_cachep)
6800 goto fail;
6801
6792 return 0; 6802 return 0;
6793fail: 6803fail:
6794 btrfs_destroy_cachep(); 6804 btrfs_destroy_cachep();