]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: remove kmem_zone typedef
authorDarrick J. Wong <djwong@kernel.org>
Thu, 28 Apr 2022 19:39:04 +0000 (15:39 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Thu, 28 Apr 2022 19:39:04 +0000 (15:39 -0400)
Source kernel commit: e7720afad068a6729d9cd3aaa08212f2f5a7ceff

Remove these typedefs by referencing kmem_cache directly.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
19 files changed:
include/kmem.h
libxfs/kmem.c
libxfs/libxfs_priv.h
libxfs/logitem.c
libxfs/rdwr.c
libxfs/trans.c
libxfs/xfs_alloc.c
libxfs/xfs_alloc_btree.c
libxfs/xfs_bmap.c
libxfs/xfs_bmap.h
libxfs/xfs_bmap_btree.c
libxfs/xfs_btree.h
libxfs/xfs_da_btree.c
libxfs/xfs_da_btree.h
libxfs/xfs_ialloc_btree.c
libxfs/xfs_inode_fork.c
libxfs/xfs_inode_fork.h
libxfs/xfs_refcount_btree.c
libxfs/xfs_rmap_btree.c

index 2a0acf93398ff5efc4c1dba6bfd42922e3195acd..e330e0e883d69486bd878d721a57077e7e348882 100644 (file)
 #define KM_LARGE       0x0010u
 #define KM_NOLOCKDEP   0x0020u
 
-typedef struct kmem_zone {
+struct kmem_cache {
        int             zone_unitsize;  /* Size in bytes of zone unit */
        int             allocated;      /* debug: How many allocated? */
        unsigned int    align;
        const char      *zone_name;     /* tag name */
        void            (*ctor)(void *);
-} kmem_zone_t;
+};
 
 typedef unsigned int __bitwise gfp_t;
 
@@ -28,28 +28,28 @@ typedef unsigned int __bitwise gfp_t;
 
 #define __GFP_ZERO     (__force gfp_t)1
 
-kmem_zone_t * kmem_cache_create(const char *name, unsigned int size,
+struct kmem_cache * kmem_cache_create(const char *name, unsigned int size,
                unsigned int align, unsigned int slab_flags,
                void (*ctor)(void *));
 
-static inline kmem_zone_t *
+static inline struct kmem_cache *
 kmem_zone_init(unsigned int size, const char *name)
 {
        return kmem_cache_create(name, size, 0, 0, NULL);
 }
 
-extern void    *kmem_cache_alloc(kmem_zone_t *, gfp_t);
-extern void    *kmem_cache_zalloc(kmem_zone_t *, gfp_t);
-extern int     kmem_zone_destroy(kmem_zone_t *);
+extern void    *kmem_cache_alloc(struct kmem_cache *, gfp_t);
+extern void    *kmem_cache_zalloc(struct kmem_cache *, gfp_t);
+extern int     kmem_zone_destroy(struct kmem_cache *);
 
 static inline void
-kmem_cache_destroy(kmem_zone_t *zone)
+kmem_cache_destroy(struct kmem_cache *zone)
 {
        kmem_zone_destroy(zone);
 }
 
 static inline void
-kmem_cache_free(kmem_zone_t *zone, void *ptr)
+kmem_cache_free(struct kmem_cache *zone, void *ptr)
 {
        zone->allocated--;
        free(ptr);
index c4c57670d22b3bd8525869cbe29cfad8f25aa0c9..daacd2c6bbe49332c33b34a6b2c2945963721cf1 100644 (file)
@@ -6,15 +6,15 @@
 /*
  * Simple memory interface
  */
-kmem_zone_t *
+struct kmem_cache *
 kmem_cache_create(const char *name, unsigned int size, unsigned int align,
                unsigned int slab_flags, void (*ctor)(void *))
 {
-       kmem_zone_t     *ptr = malloc(sizeof(kmem_zone_t));
+       struct kmem_cache       *ptr = malloc(sizeof(struct kmem_cache));
 
        if (ptr == NULL) {
                fprintf(stderr, _("%s: zone init failed (%s, %d bytes): %s\n"),
-                       progname, name, (int)sizeof(kmem_zone_t),
+                       progname, name, (int)sizeof(struct kmem_cache),
                        strerror(errno));
                exit(1);
        }
@@ -28,7 +28,7 @@ kmem_cache_create(const char *name, unsigned int size, unsigned int align,
 }
 
 int
-kmem_zone_destroy(kmem_zone_t *zone)
+kmem_zone_destroy(struct kmem_cache *zone)
 {
        int     leaked = 0;
 
@@ -42,7 +42,7 @@ kmem_zone_destroy(kmem_zone_t *zone)
 }
 
 void *
-kmem_cache_alloc(kmem_zone_t *zone, gfp_t flags)
+kmem_cache_alloc(struct kmem_cache *zone, gfp_t flags)
 {
        void    *ptr = malloc(zone->zone_unitsize);
 
@@ -57,7 +57,7 @@ kmem_cache_alloc(kmem_zone_t *zone, gfp_t flags)
 }
 
 void *
-kmem_cache_zalloc(kmem_zone_t *zone, gfp_t flags)
+kmem_cache_zalloc(struct kmem_cache *zone, gfp_t flags)
 {
        void    *ptr = kmem_cache_alloc(zone, flags);
 
index 49ecbca0048f2c57e33446e30dc02ce515e33f77..2c888fb74600befeff5a93efca5554ea565799c5 100644 (file)
 #include <sys/xattr.h>
 
 /* Zones used in libxfs allocations that aren't in shared header files */
-extern kmem_zone_t *xfs_buf_item_zone;
-extern kmem_zone_t *xfs_ili_zone;
-extern kmem_zone_t *xfs_buf_zone;
-extern kmem_zone_t *xfs_inode_zone;
-extern kmem_zone_t *xfs_trans_zone;
+extern struct kmem_cache *xfs_buf_item_zone;
+extern struct kmem_cache *xfs_ili_zone;
+extern struct kmem_cache *xfs_buf_zone;
+extern struct kmem_cache *xfs_inode_zone;
+extern struct kmem_cache *xfs_trans_zone;
 
 /* fake up iomap, (not) used in xfs_bmap.[ch] */
 #define IOMAP_F_SHARED                 0x04
index e6debb6d782c744d190a029ad83c36d7301f062a..dde90502cff2d2edca997da76fbe0cbad499c091 100644 (file)
@@ -16,8 +16,8 @@
 #include "xfs_inode.h"
 #include "xfs_trans.h"
 
-kmem_zone_t    *xfs_buf_item_zone;
-kmem_zone_t    *xfs_ili_zone;          /* inode log item zone */
+struct kmem_cache      *xfs_buf_item_zone;
+struct kmem_cache      *xfs_ili_zone;          /* inode log item zone */
 
 /*
  * Following functions from fs/xfs/xfs_trans_buf.c
index 4f1f5f10b9da5df8062666aeaf79f473984e8917..d23827158b73c8336b8bf6fc7c37f406af8d3d80 100644 (file)
@@ -161,7 +161,7 @@ libxfs_getsb(
        return bp;
 }
 
-kmem_zone_t                    *xfs_buf_zone;
+struct kmem_cache                      *xfs_buf_zone;
 
 static struct cache_mru                xfs_buf_freelist =
        {{&xfs_buf_freelist.cm_list, &xfs_buf_freelist.cm_list},
@@ -1056,8 +1056,8 @@ xfs_verify_magic16(
  * Inode cache stubs.
  */
 
-kmem_zone_t            *xfs_inode_zone;
-extern kmem_zone_t     *xfs_ili_zone;
+struct kmem_cache              *xfs_inode_zone;
+extern struct kmem_cache       *xfs_ili_zone;
 
 int
 libxfs_iget(
index 8c16cb8d98a661fa1542cd6da4e1cac61926bed6..f87a65c573c920c9e6bbd5e6f4571bc471c0ff99 100644 (file)
@@ -30,7 +30,7 @@ static int __xfs_trans_commit(struct xfs_trans *tp, bool regrant);
  * Simple transaction interface
  */
 
-kmem_zone_t    *xfs_trans_zone;
+struct kmem_cache      *xfs_trans_zone;
 
 /*
  * Initialize the precomputed transaction reservation values
@@ -868,7 +868,7 @@ buf_item_done(
 {
        struct xfs_buf          *bp;
        int                     hold;
-       extern kmem_zone_t      *xfs_buf_item_zone;
+       extern struct kmem_cache        *xfs_buf_item_zone;
 
        bp = bip->bli_buf;
        ASSERT(bp != NULL);
index 7d304160d3543b7c5c0a9b84d07bcac7273dd7d7..c99497fd94651ff72f9297d0304e3bc7d987c504 100644 (file)
@@ -23,7 +23,7 @@
 #include "xfs_ag_resv.h"
 #include "xfs_bmap.h"
 
-extern kmem_zone_t     *xfs_bmap_free_item_zone;
+extern struct kmem_cache       *xfs_bmap_free_item_zone;
 
 struct workqueue_struct *xfs_alloc_wq;
 
index 2176a923a1c11d5a18cd028796381334c68e8a1b..2ba6d44af47709b1e6f9d559a74c589f951bc6aa 100644 (file)
@@ -18,7 +18,7 @@
 #include "xfs_trans.h"
 #include "xfs_ag.h"
 
-static kmem_zone_t     *xfs_allocbt_cur_cache;
+static struct kmem_cache       *xfs_allocbt_cur_cache;
 
 STATIC struct xfs_btree_cur *
 xfs_allocbt_dup_cursor(
index bc8a2033d8f58286a95c18b7b0034d90c56e2b85..ecf79e2447838a32e4817fb774d5d0737a22796f 100644 (file)
@@ -31,7 +31,7 @@
 #include "xfs_refcount.h"
 
 
-kmem_zone_t            *xfs_bmap_free_item_zone;
+struct kmem_cache              *xfs_bmap_free_item_zone;
 
 /*
  * Miscellaneous helper functions
index 67641f669918f36e07019642ef212b16d5ba2f3e..171a72ee9f3194baff44ba5d3f24ff2a87822d56 100644 (file)
@@ -13,7 +13,7 @@ struct xfs_inode;
 struct xfs_mount;
 struct xfs_trans;
 
-extern kmem_zone_t     *xfs_bmap_free_item_zone;
+extern struct kmem_cache       *xfs_bmap_free_item_zone;
 
 /*
  * Argument structure for xfs_bmap_alloc.
index cde313d7c699004fa9cd771ebf9eca721593c71f..8e850751034e0c9b3b3f1302c5ccbfa25834df35 100644 (file)
@@ -20,7 +20,7 @@
 #include "xfs_trace.h"
 #include "xfs_rmap.h"
 
-static kmem_zone_t     *xfs_bmbt_cur_cache;
+static struct kmem_cache       *xfs_bmbt_cur_cache;
 
 /*
  * Convert on-disk form of btree root to in-memory form.
index 7bc5a379605212159d295331250c511ddd75e7f6..22d9f411fde6ff0dcb48d89be4f4a45912a1a1cb 100644 (file)
@@ -230,7 +230,7 @@ struct xfs_btree_cur
        struct xfs_trans        *bc_tp; /* transaction we're in, if any */
        struct xfs_mount        *bc_mp; /* file system mount struct */
        const struct xfs_btree_ops *bc_ops;
-       kmem_zone_t             *bc_cache; /* cursor cache */
+       struct kmem_cache       *bc_cache; /* cursor cache */
        unsigned int            bc_flags; /* btree features - below */
        xfs_btnum_t             bc_btnum; /* identifies which btree type */
        union xfs_btree_irec    bc_rec; /* current insert/search record value */
@@ -586,7 +586,7 @@ xfs_btree_alloc_cursor(
        struct xfs_trans        *tp,
        xfs_btnum_t             btnum,
        uint8_t                 maxlevels,
-       kmem_zone_t             *cache)
+       struct kmem_cache       *cache)
 {
        struct xfs_btree_cur    *cur;
 
index 0e504d2d241c4b5262c0ac885ddbb22ae01f063a..f1ae5d4d749dadb75523b5227657f92b682e4702 100644 (file)
@@ -69,7 +69,7 @@ STATIC int    xfs_da3_blk_unlink(xfs_da_state_t *state,
                                  xfs_da_state_blk_t *save_blk);
 
 
-kmem_zone_t *xfs_da_state_zone;        /* anchor for state struct zone */
+struct kmem_cache *xfs_da_state_zone;  /* anchor for state struct zone */
 
 /*
  * Allocate a dir-state structure.
index ad5dd324631aba4c31cb67bc2951b2315e17c3d7..da845e32a678276b9340be0d14c09c391a591a80 100644 (file)
@@ -227,6 +227,6 @@ void        xfs_da3_node_hdr_from_disk(struct xfs_mount *mp,
 void   xfs_da3_node_hdr_to_disk(struct xfs_mount *mp,
                struct xfs_da_intnode *to, struct xfs_da3_icnode_hdr *from);
 
-extern struct kmem_zone *xfs_da_state_zone;
+extern struct kmem_cache *xfs_da_state_zone;
 
 #endif /* __XFS_DA_BTREE_H__ */
index 539e7c03e1d0eea43a483c1e1e5a95cb26e54b60..1dbb536089107995be448c621faaafaaa6187889 100644 (file)
@@ -21,7 +21,7 @@
 #include "xfs_rmap.h"
 #include "xfs_ag.h"
 
-static kmem_zone_t     *xfs_inobt_cur_cache;
+static struct kmem_cache       *xfs_inobt_cur_cache;
 
 STATIC int
 xfs_inobt_get_minrecs(
index bd581fe8257aefcc71d16c7a483275de755446c2..c80b4066190e7a4ed05537d47f85abe92cc9cecf 100644 (file)
@@ -24,7 +24,7 @@
 #include "xfs_types.h"
 #include "xfs_errortag.h"
 
-kmem_zone_t *xfs_ifork_zone;
+struct kmem_cache *xfs_ifork_zone;
 
 void
 xfs_init_local_fork(
index a6f7897b6887b1f83a0f8b162a64c778ecb89a31..cb296bd5baae0f0d40825d5eb42b32806e3089a4 100644 (file)
@@ -221,7 +221,7 @@ static inline bool xfs_iext_peek_prev_extent(struct xfs_ifork *ifp,
             xfs_iext_get_extent((ifp), (ext), (got));  \
             xfs_iext_next((ifp), (ext)))
 
-extern struct kmem_zone        *xfs_ifork_zone;
+extern struct kmem_cache       *xfs_ifork_zone;
 
 extern void xfs_ifork_init_cow(struct xfs_inode *ip);
 
index 2c02e33e367e20ee45115dc8d35c653ba6de08d4..19ead6a2d03a9734a841add8c5fb5ef198210e19 100644 (file)
@@ -20,7 +20,7 @@
 #include "xfs_rmap.h"
 #include "xfs_ag.h"
 
-static kmem_zone_t     *xfs_refcountbt_cur_cache;
+static struct kmem_cache       *xfs_refcountbt_cur_cache;
 
 static struct xfs_btree_cur *
 xfs_refcountbt_dup_cursor(
index ae3329b5d3b4d44812c438843e260f2540f0a3f8..f0fe78d3623e93b3541884e34f53b2ccfb6a8656 100644 (file)
@@ -20,7 +20,7 @@
 #include "xfs_ag.h"
 #include "xfs_ag_resv.h"
 
-static kmem_zone_t     *xfs_rmapbt_cur_cache;
+static struct kmem_cache       *xfs_rmapbt_cur_cache;
 
 /*
  * Reverse map btree.