aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-07-25 12:31:35 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-07-25 12:31:35 -0400
commit92fee66d49b812ea57eae53c5baaf8942ac9af06 (patch)
tree48668d45038a0d53a647623b2782e35090d1e7ee /fs/btrfs/inode.c
parent618e21d5957c88c5ea346dfd7d1dbac96410fc5b (diff)
Btrfs: deal with api changes in 2.6.23-rc1
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c50
1 files changed, 26 insertions, 24 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index f95cf5d4a69d..fa9c531c86b7 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -31,6 +31,7 @@
31#include <linux/statfs.h> 31#include <linux/statfs.h>
32#include <linux/compat.h> 32#include <linux/compat.h>
33#include <linux/bit_spinlock.h> 33#include <linux/bit_spinlock.h>
34#include <linux/version.h>
34#include "ctree.h" 35#include "ctree.h"
35#include "disk-io.h" 36#include "disk-io.h"
36#include "transaction.h" 37#include "transaction.h"
@@ -2323,42 +2324,43 @@ void btrfs_destroy_cachep(void)
2323 kmem_cache_destroy(btrfs_path_cachep); 2324 kmem_cache_destroy(btrfs_path_cachep);
2324} 2325}
2325 2326
2327static struct kmem_cache *cache_create(const char *name, size_t size,
2328 unsigned long extra_flags,
2329 void (*ctor)(void *, struct kmem_cache *,
2330 unsigned long))
2331{
2332 return kmem_cache_create(name, size, 0, (SLAB_RECLAIM_ACCOUNT |
2333 SLAB_MEM_SPREAD | extra_flags), ctor
2334#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
2335 ,NULL
2336#endif
2337 );
2338}
2339
2326int btrfs_init_cachep(void) 2340int btrfs_init_cachep(void)
2327{ 2341{
2328 btrfs_inode_cachep = kmem_cache_create("btrfs_inode_cache", 2342 btrfs_inode_cachep = cache_create("btrfs_inode_cache",
2329 sizeof(struct btrfs_inode), 2343 sizeof(struct btrfs_inode),
2330 0, (SLAB_RECLAIM_ACCOUNT| 2344 0, init_once);
2331 SLAB_MEM_SPREAD),
2332 init_once, NULL);
2333 if (!btrfs_inode_cachep) 2345 if (!btrfs_inode_cachep)
2334 goto fail; 2346 goto fail;
2335 btrfs_trans_handle_cachep = kmem_cache_create("btrfs_trans_handle_cache", 2347 btrfs_trans_handle_cachep = cache_create("btrfs_trans_handle_cache",
2336 sizeof(struct btrfs_trans_handle), 2348 sizeof(struct btrfs_trans_handle),
2337 0, (SLAB_RECLAIM_ACCOUNT| 2349 0, NULL);
2338 SLAB_MEM_SPREAD),
2339 NULL, NULL);
2340 if (!btrfs_trans_handle_cachep) 2350 if (!btrfs_trans_handle_cachep)
2341 goto fail; 2351 goto fail;
2342 btrfs_transaction_cachep = kmem_cache_create("btrfs_transaction_cache", 2352 btrfs_transaction_cachep = cache_create("btrfs_transaction_cache",
2343 sizeof(struct btrfs_transaction), 2353 sizeof(struct btrfs_transaction),
2344 0, (SLAB_RECLAIM_ACCOUNT| 2354 0, NULL);
2345 SLAB_MEM_SPREAD),
2346 NULL, NULL);
2347 if (!btrfs_transaction_cachep) 2355 if (!btrfs_transaction_cachep)
2348 goto fail; 2356 goto fail;
2349 btrfs_path_cachep = kmem_cache_create("btrfs_path_cache", 2357 btrfs_path_cachep = cache_create("btrfs_path_cache",
2350 sizeof(struct btrfs_transaction), 2358 sizeof(struct btrfs_transaction),
2351 0, (SLAB_RECLAIM_ACCOUNT| 2359 0, NULL);
2352 SLAB_MEM_SPREAD),
2353 NULL, NULL);
2354 if (!btrfs_path_cachep) 2360 if (!btrfs_path_cachep)
2355 goto fail; 2361 goto fail;
2356 btrfs_bit_radix_cachep = kmem_cache_create("btrfs_radix", 2362 btrfs_bit_radix_cachep = cache_create("btrfs_radix", 256,
2357 256, 2363 SLAB_DESTROY_BY_RCU, NULL);
2358 0, (SLAB_RECLAIM_ACCOUNT|
2359 SLAB_MEM_SPREAD |
2360 SLAB_DESTROY_BY_RCU),
2361 NULL, NULL);
2362 if (!btrfs_bit_radix_cachep) 2364 if (!btrfs_bit_radix_cachep)
2363 goto fail; 2365 goto fail;
2364 return 0; 2366 return 0;