#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;
#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);
/*
* 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);
}
}
int
-kmem_zone_destroy(kmem_zone_t *zone)
+kmem_zone_destroy(struct kmem_cache *zone)
{
int leaked = 0;
}
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);
}
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);
#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
#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
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},
* 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(
* Simple transaction interface
*/
-kmem_zone_t *xfs_trans_zone;
+struct kmem_cache *xfs_trans_zone;
/*
* Initialize the precomputed transaction reservation values
{
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);
#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;
#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(
#include "xfs_refcount.h"
-kmem_zone_t *xfs_bmap_free_item_zone;
+struct kmem_cache *xfs_bmap_free_item_zone;
/*
* Miscellaneous helper functions
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.
#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.
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 */
struct xfs_trans *tp,
xfs_btnum_t btnum,
uint8_t maxlevels,
- kmem_zone_t *cache)
+ struct kmem_cache *cache)
{
struct xfs_btree_cur *cur;
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.
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__ */
#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(
#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(
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);
#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(
#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.