From: Darrick J. Wong Date: Thu, 6 Jan 2022 22:13:23 +0000 (-0800) Subject: libxfs: remove kmem_zone_init X-Git-Tag: libxfs-5.16-sync_2022-03-17~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8ba4fefa5ee92d96c4882b605ec8c7ae4b98d9d5;p=thirdparty%2Fxfsprogs-dev.git libxfs: remove kmem_zone_init Port all callers to kmem_cache_create, to sync with kernel API. Signed-off-by: Darrick J. Wong --- diff --git a/include/kmem.h b/include/kmem.h index 53a2b37a7..36acd20dd 100644 --- a/include/kmem.h +++ b/include/kmem.h @@ -34,13 +34,6 @@ typedef unsigned int __bitwise gfp_t; kmem_zone_t * kmem_cache_create(const char *name, unsigned int size, unsigned int align, unsigned int slab_flags, void (*ctor)(void *)); - -static inline kmem_zone_t * -kmem_zone_init(unsigned int size, const char *name) -{ - return kmem_cache_create(name, size, 0, 0, NULL); -} - void kmem_cache_destroy(kmem_zone_t *); extern void *kmem_cache_alloc(kmem_zone_t *, gfp_t); diff --git a/libxfs/init.c b/libxfs/init.c index 95a861d81..b957c2590 100644 --- a/libxfs/init.c +++ b/libxfs/init.c @@ -234,25 +234,29 @@ init_zones(void) int error; /* initialise zone allocation */ - xfs_buf_zone = kmem_zone_init(sizeof(struct xfs_buf), "xfs_buffer"); - xfs_inode_zone = kmem_zone_init(sizeof(struct xfs_inode), "xfs_inode"); - xfs_ifork_zone = kmem_zone_init(sizeof(struct xfs_ifork), "xfs_ifork"); - xfs_ili_zone = kmem_zone_init( - sizeof(struct xfs_inode_log_item),"xfs_inode_log_item"); - xfs_buf_item_zone = kmem_zone_init( - sizeof(struct xfs_buf_log_item), "xfs_buf_log_item"); - xfs_da_state_zone = kmem_zone_init( - sizeof(struct xfs_da_state), "xfs_da_state"); + xfs_buf_zone = kmem_cache_create("xfs_buffer", + sizeof(struct xfs_buf), 0, 0, NULL); + xfs_inode_zone = kmem_cache_create("xfs_inode", + sizeof(struct xfs_inode), 0, 0, NULL); + xfs_ifork_zone = kmem_cache_create("xfs_ifork", + sizeof(struct xfs_ifork), 0, 0, NULL); + xfs_ili_zone = kmem_cache_create("xfs_inode_log_item", + sizeof(struct xfs_inode_log_item), 0, 0, NULL); + xfs_buf_item_zone = kmem_cache_create("xfs_buf_log_item", + sizeof(struct xfs_buf_log_item), 0, 0, NULL); + xfs_da_state_zone = kmem_cache_create("xfs_da_state", + sizeof(struct xfs_da_state), 0, 0, NULL); + error = xfs_btree_init_cur_caches(); if (error) { fprintf(stderr, "Could not allocate btree cursor caches.\n"); abort(); } - xfs_bmap_free_item_zone = kmem_zone_init( - sizeof(struct xfs_extent_free_item), - "xfs_bmap_free_item"); - xfs_trans_zone = kmem_zone_init( - sizeof(struct xfs_trans), "xfs_trans"); + + xfs_bmap_free_item_zone = kmem_cache_create("xfs_bmap_free_item", + sizeof(struct xfs_extent_free_item), 0, 0, NULL); + xfs_trans_zone = kmem_cache_create("xfs_trans", + sizeof(struct xfs_trans), 0, 0, NULL); } static void