diff mbox series

[36/48] libxfs: remove kmem_zone_init

Message ID 164263839036.865554.118213994124696686.stgit@magnolia (mailing list archive)
State New, archived
Headers show
Series xfsprogs: sync libxfs with 5.16 | expand

Commit Message

Darrick J. Wong Jan. 20, 2022, 12:26 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Port all callers to kmem_cache_create, to sync with kernel API.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 include/kmem.h |    7 -------
 libxfs/init.c  |   32 ++++++++++++++++++--------------
 2 files changed, 18 insertions(+), 21 deletions(-)
diff mbox series

Patch

diff --git a/include/kmem.h b/include/kmem.h
index 53a2b37a..36acd20d 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 0d693848..155b12fa 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