diff options
author | Josef Bacik <josef@redhat.com> | 2011-01-28 17:05:48 -0500 |
---|---|---|
committer | Josef Bacik <josef@redhat.com> | 2011-03-17 14:21:20 -0400 |
commit | dc89e9824464e91fa0b06267864ceabe3186fd8b (patch) | |
tree | 82952195464518dce48cb613c74d2326f228669b /fs/btrfs/inode.c | |
parent | 57a45ced94fe48a701361d64230fc16eefa189dd (diff) |
Btrfs: use a slab for the free space entries
Since we alloc/free free space entries a whole lot, lets use a slab to keep
track of them. This makes some of my tests slightly faster. Thanks,
Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 10 |
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 | ||
54 | struct btrfs_iget_args { | 55 | struct btrfs_iget_args { |
55 | u64 ino; | 56 | u64 ino; |
@@ -70,6 +71,7 @@ static struct kmem_cache *btrfs_inode_cachep; | |||
70 | struct kmem_cache *btrfs_trans_handle_cachep; | 71 | struct kmem_cache *btrfs_trans_handle_cachep; |
71 | struct kmem_cache *btrfs_transaction_cachep; | 72 | struct kmem_cache *btrfs_transaction_cachep; |
72 | struct kmem_cache *btrfs_path_cachep; | 73 | struct kmem_cache *btrfs_path_cachep; |
74 | struct kmem_cache *btrfs_free_space_cachep; | ||
73 | 75 | ||
74 | #define S_SHIFT 12 | 76 | #define S_SHIFT 12 |
75 | static unsigned char btrfs_type_by_mode[S_IFMT >> S_SHIFT] = { | 77 | static 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 | ||
6766 | int btrfs_init_cachep(void) | 6770 | int 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; |
6793 | fail: | 6803 | fail: |
6794 | btrfs_destroy_cachep(); | 6804 | btrfs_destroy_cachep(); |