inode.c (416dfdcdb894432547ead4fcb9fa6a36b396059e) | inode.c (9601e3f6336f6ca66929f451b1f66085e68e36e3) |
---|---|
1/* 2 * Copyright (C) 2007 Oracle. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public 6 * License v2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, --- 4626 unchanged lines hidden (view full) --- 4635 if (btrfs_transaction_cachep) 4636 kmem_cache_destroy(btrfs_transaction_cachep); 4637 if (btrfs_bit_radix_cachep) 4638 kmem_cache_destroy(btrfs_bit_radix_cachep); 4639 if (btrfs_path_cachep) 4640 kmem_cache_destroy(btrfs_path_cachep); 4641} 4642 | 1/* 2 * Copyright (C) 2007 Oracle. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public 6 * License v2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, --- 4626 unchanged lines hidden (view full) --- 4635 if (btrfs_transaction_cachep) 4636 kmem_cache_destroy(btrfs_transaction_cachep); 4637 if (btrfs_bit_radix_cachep) 4638 kmem_cache_destroy(btrfs_bit_radix_cachep); 4639 if (btrfs_path_cachep) 4640 kmem_cache_destroy(btrfs_path_cachep); 4641} 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) 4652{ | 4643int btrfs_init_cachep(void) 4644{ |
4653 btrfs_inode_cachep = btrfs_cache_create("btrfs_inode_cache", 4654 sizeof(struct btrfs_inode), 4655 0, init_once); | 4645 btrfs_inode_cachep = kmem_cache_create("btrfs_inode_cache", 4646 sizeof(struct btrfs_inode), 0, 4647 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, init_once); |
4656 if (!btrfs_inode_cachep) 4657 goto fail; | 4648 if (!btrfs_inode_cachep) 4649 goto fail; |
4658 btrfs_trans_handle_cachep = 4659 btrfs_cache_create("btrfs_trans_handle_cache", 4660 sizeof(struct btrfs_trans_handle), 4661 0, NULL); | 4650 4651 btrfs_trans_handle_cachep = kmem_cache_create("btrfs_trans_handle_cache", 4652 sizeof(struct btrfs_trans_handle), 0, 4653 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, NULL); |
4662 if (!btrfs_trans_handle_cachep) 4663 goto fail; | 4654 if (!btrfs_trans_handle_cachep) 4655 goto fail; |
4664 btrfs_transaction_cachep = btrfs_cache_create("btrfs_transaction_cache", 4665 sizeof(struct btrfs_transaction), 4666 0, NULL); | 4656 4657 btrfs_transaction_cachep = kmem_cache_create("btrfs_transaction_cache", 4658 sizeof(struct btrfs_transaction), 0, 4659 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, NULL); |
4667 if (!btrfs_transaction_cachep) 4668 goto fail; | 4660 if (!btrfs_transaction_cachep) 4661 goto fail; |
4669 btrfs_path_cachep = btrfs_cache_create("btrfs_path_cache", 4670 sizeof(struct btrfs_path), 4671 0, NULL); | 4662 4663 btrfs_path_cachep = kmem_cache_create("btrfs_path_cache", 4664 sizeof(struct btrfs_path), 0, 4665 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, NULL); |
4672 if (!btrfs_path_cachep) 4673 goto fail; | 4666 if (!btrfs_path_cachep) 4667 goto fail; |
4674 btrfs_bit_radix_cachep = btrfs_cache_create("btrfs_radix", 256, 4675 SLAB_DESTROY_BY_RCU, NULL); | 4668 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) 4677 goto fail; 4678 return 0; 4679fail: 4680 btrfs_destroy_cachep(); 4681 return -ENOMEM; 4682} 4683 --- 553 unchanged lines hidden --- | 4672 if (!btrfs_bit_radix_cachep) 4673 goto fail; 4674 return 0; 4675fail: 4676 btrfs_destroy_cachep(); 4677 return -ENOMEM; 4678} 4679 --- 553 unchanged lines hidden --- |