Skip to content

Commit

Permalink
xfs: rename _zone variables to _cache
Browse files Browse the repository at this point in the history
Now that we've gotten rid of the kmem_zone_t typedef, rename the
variables to _cache since that's what they are.

Signed-off-by: Darrick J. Wong <[email protected]>
Reviewed-by: Chandan Babu R <[email protected]>
  • Loading branch information
Darrick J. Wong committed Oct 22, 2021
1 parent e7720af commit 182696f
Show file tree
Hide file tree
Showing 36 changed files with 215 additions and 216 deletions.
6 changes: 3 additions & 3 deletions fs/xfs/libxfs/xfs_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "xfs_ag_resv.h"
#include "xfs_bmap.h"

extern struct kmem_cache *xfs_bmap_free_item_zone;
extern struct kmem_cache *xfs_bmap_free_item_cache;

struct workqueue_struct *xfs_alloc_wq;

Expand Down Expand Up @@ -2459,10 +2459,10 @@ xfs_defer_agfl_block(
struct xfs_mount *mp = tp->t_mountp;
struct xfs_extent_free_item *new; /* new element */

ASSERT(xfs_bmap_free_item_zone != NULL);
ASSERT(xfs_bmap_free_item_cache != NULL);
ASSERT(oinfo != NULL);

new = kmem_cache_alloc(xfs_bmap_free_item_zone,
new = kmem_cache_alloc(xfs_bmap_free_item_cache,
GFP_KERNEL | __GFP_NOFAIL);
new->xefi_startblock = XFS_AGB_TO_FSB(mp, agno, agbno);
new->xefi_blockcount = 1;
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/libxfs/xfs_attr_leaf.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ xfs_attr_fork_remove(
ASSERT(ip->i_afp->if_nextents == 0);

xfs_idestroy_fork(ip->i_afp);
kmem_cache_free(xfs_ifork_zone, ip->i_afp);
kmem_cache_free(xfs_ifork_cache, ip->i_afp);
ip->i_afp = NULL;
ip->i_forkoff = 0;
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
Expand Down
6 changes: 3 additions & 3 deletions fs/xfs/libxfs/xfs_bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "xfs_iomap.h"


struct kmem_cache *xfs_bmap_free_item_zone;
struct kmem_cache *xfs_bmap_free_item_cache;

/*
* Miscellaneous helper functions
Expand Down Expand Up @@ -555,9 +555,9 @@ __xfs_bmap_add_free(
ASSERT(len < mp->m_sb.sb_agblocks);
ASSERT(agbno + len <= mp->m_sb.sb_agblocks);
#endif
ASSERT(xfs_bmap_free_item_zone != NULL);
ASSERT(xfs_bmap_free_item_cache != NULL);

new = kmem_cache_alloc(xfs_bmap_free_item_zone,
new = kmem_cache_alloc(xfs_bmap_free_item_cache,
GFP_KERNEL | __GFP_NOFAIL);
new->xefi_startblock = bno;
new->xefi_blockcount = (xfs_extlen_t)len;
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/libxfs/xfs_bmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct xfs_inode;
struct xfs_mount;
struct xfs_trans;

extern struct kmem_cache *xfs_bmap_free_item_zone;
extern struct kmem_cache *xfs_bmap_free_item_cache;

/*
* Argument structure for xfs_bmap_alloc.
Expand Down
6 changes: 3 additions & 3 deletions fs/xfs/libxfs/xfs_da_btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ STATIC int xfs_da3_blk_unlink(xfs_da_state_t *state,
xfs_da_state_blk_t *save_blk);


struct kmem_cache *xfs_da_state_zone; /* anchor for state struct zone */
struct kmem_cache *xfs_da_state_cache; /* anchor for dir/attr state */

/*
* Allocate a dir-state structure.
Expand All @@ -84,7 +84,7 @@ xfs_da_state_alloc(
{
struct xfs_da_state *state;

state = kmem_cache_zalloc(xfs_da_state_zone, GFP_NOFS | __GFP_NOFAIL);
state = kmem_cache_zalloc(xfs_da_state_cache, GFP_NOFS | __GFP_NOFAIL);
state->args = args;
state->mp = args->dp->i_mount;
return state;
Expand Down Expand Up @@ -113,7 +113,7 @@ xfs_da_state_free(xfs_da_state_t *state)
#ifdef DEBUG
memset((char *)state, 0, sizeof(*state));
#endif /* DEBUG */
kmem_cache_free(xfs_da_state_zone, state);
kmem_cache_free(xfs_da_state_cache, state);
}

static inline int xfs_dabuf_nfsb(struct xfs_mount *mp, int whichfork)
Expand Down
3 changes: 1 addition & 2 deletions fs/xfs/libxfs/xfs_da_btree.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

struct xfs_inode;
struct xfs_trans;
struct zone;

/*
* Directory/attribute geometry information. There will be one of these for each
Expand Down Expand Up @@ -227,6 +226,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_cache *xfs_da_state_zone;
extern struct kmem_cache *xfs_da_state_cache;

#endif /* __XFS_DA_BTREE_H__ */
8 changes: 4 additions & 4 deletions fs/xfs/libxfs/xfs_inode_fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "xfs_types.h"
#include "xfs_errortag.h"

struct kmem_cache *xfs_ifork_zone;
struct kmem_cache *xfs_ifork_cache;

void
xfs_init_local_fork(
Expand Down Expand Up @@ -284,7 +284,7 @@ xfs_ifork_alloc(
{
struct xfs_ifork *ifp;

ifp = kmem_cache_zalloc(xfs_ifork_zone, GFP_NOFS | __GFP_NOFAIL);
ifp = kmem_cache_zalloc(xfs_ifork_cache, GFP_NOFS | __GFP_NOFAIL);
ifp->if_format = format;
ifp->if_nextents = nextents;
return ifp;
Expand Down Expand Up @@ -325,7 +325,7 @@ xfs_iformat_attr_fork(
}

if (error) {
kmem_cache_free(xfs_ifork_zone, ip->i_afp);
kmem_cache_free(xfs_ifork_cache, ip->i_afp);
ip->i_afp = NULL;
}
return error;
Expand Down Expand Up @@ -676,7 +676,7 @@ xfs_ifork_init_cow(
if (ip->i_cowfp)
return;

ip->i_cowfp = kmem_cache_zalloc(xfs_ifork_zone,
ip->i_cowfp = kmem_cache_zalloc(xfs_ifork_cache,
GFP_NOFS | __GFP_NOFAIL);
ip->i_cowfp->if_format = XFS_DINODE_FMT_EXTENTS;
}
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/libxfs/xfs_inode_fork.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_cache *xfs_ifork_zone;
extern struct kmem_cache *xfs_ifork_cache;

extern void xfs_ifork_init_cow(struct xfs_inode *ip);

Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/xfs_attr_inactive.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ xfs_attr_inactive(
/* kill the in-core attr fork before we drop the inode lock */
if (dp->i_afp) {
xfs_idestroy_fork(dp->i_afp);
kmem_cache_free(xfs_ifork_zone, dp->i_afp);
kmem_cache_free(xfs_ifork_cache, dp->i_afp);
dp->i_afp = NULL;
}
if (lock_mode)
Expand Down
12 changes: 6 additions & 6 deletions fs/xfs/xfs_bmap_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#include "xfs_log_priv.h"
#include "xfs_log_recover.h"

struct kmem_cache *xfs_bui_zone;
struct kmem_cache *xfs_bud_zone;
struct kmem_cache *xfs_bui_cache;
struct kmem_cache *xfs_bud_cache;

static const struct xfs_item_ops xfs_bui_item_ops;

Expand All @@ -39,7 +39,7 @@ STATIC void
xfs_bui_item_free(
struct xfs_bui_log_item *buip)
{
kmem_cache_free(xfs_bui_zone, buip);
kmem_cache_free(xfs_bui_cache, buip);
}

/*
Expand Down Expand Up @@ -138,7 +138,7 @@ xfs_bui_init(
{
struct xfs_bui_log_item *buip;

buip = kmem_cache_zalloc(xfs_bui_zone, GFP_KERNEL | __GFP_NOFAIL);
buip = kmem_cache_zalloc(xfs_bui_cache, GFP_KERNEL | __GFP_NOFAIL);

xfs_log_item_init(mp, &buip->bui_item, XFS_LI_BUI, &xfs_bui_item_ops);
buip->bui_format.bui_nextents = XFS_BUI_MAX_FAST_EXTENTS;
Expand Down Expand Up @@ -198,7 +198,7 @@ xfs_bud_item_release(
struct xfs_bud_log_item *budp = BUD_ITEM(lip);

xfs_bui_release(budp->bud_buip);
kmem_cache_free(xfs_bud_zone, budp);
kmem_cache_free(xfs_bud_cache, budp);
}

static const struct xfs_item_ops xfs_bud_item_ops = {
Expand All @@ -215,7 +215,7 @@ xfs_trans_get_bud(
{
struct xfs_bud_log_item *budp;

budp = kmem_cache_zalloc(xfs_bud_zone, GFP_KERNEL | __GFP_NOFAIL);
budp = kmem_cache_zalloc(xfs_bud_cache, GFP_KERNEL | __GFP_NOFAIL);
xfs_log_item_init(tp->t_mountp, &budp->bud_item, XFS_LI_BUD,
&xfs_bud_item_ops);
budp->bud_buip = buip;
Expand Down
4 changes: 2 additions & 2 deletions fs/xfs/xfs_bmap_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct xfs_bud_log_item {
struct xfs_bud_log_format bud_format;
};

extern struct kmem_cache *xfs_bui_zone;
extern struct kmem_cache *xfs_bud_zone;
extern struct kmem_cache *xfs_bui_cache;
extern struct kmem_cache *xfs_bud_cache;

#endif /* __XFS_BMAP_ITEM_H__ */
14 changes: 7 additions & 7 deletions fs/xfs/xfs_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "xfs_error.h"
#include "xfs_ag.h"

static struct kmem_cache *xfs_buf_zone;
static struct kmem_cache *xfs_buf_cache;

/*
* Locking orders
Expand Down Expand Up @@ -220,7 +220,7 @@ _xfs_buf_alloc(
int i;

*bpp = NULL;
bp = kmem_cache_zalloc(xfs_buf_zone, GFP_NOFS | __GFP_NOFAIL);
bp = kmem_cache_zalloc(xfs_buf_cache, GFP_NOFS | __GFP_NOFAIL);

/*
* We don't want certain flags to appear in b_flags unless they are
Expand All @@ -247,7 +247,7 @@ _xfs_buf_alloc(
*/
error = xfs_buf_get_maps(bp, nmaps);
if (error) {
kmem_cache_free(xfs_buf_zone, bp);
kmem_cache_free(xfs_buf_cache, bp);
return error;
}

Expand Down Expand Up @@ -307,7 +307,7 @@ xfs_buf_free(
kmem_free(bp->b_addr);

xfs_buf_free_maps(bp);
kmem_cache_free(xfs_buf_zone, bp);
kmem_cache_free(xfs_buf_cache, bp);
}

static int
Expand Down Expand Up @@ -2258,12 +2258,12 @@ xfs_buf_delwri_pushbuf(
int __init
xfs_buf_init(void)
{
xfs_buf_zone = kmem_cache_create("xfs_buf", sizeof(struct xfs_buf), 0,
xfs_buf_cache = kmem_cache_create("xfs_buf", sizeof(struct xfs_buf), 0,
SLAB_HWCACHE_ALIGN |
SLAB_RECLAIM_ACCOUNT |
SLAB_MEM_SPREAD,
NULL);
if (!xfs_buf_zone)
if (!xfs_buf_cache)
goto out;

return 0;
Expand All @@ -2275,7 +2275,7 @@ xfs_buf_init(void)
void
xfs_buf_terminate(void)
{
kmem_cache_destroy(xfs_buf_zone);
kmem_cache_destroy(xfs_buf_cache);
}

void xfs_buf_set_ref(struct xfs_buf *bp, int lru_ref)
Expand Down
8 changes: 4 additions & 4 deletions fs/xfs/xfs_buf_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "xfs_log.h"


struct kmem_cache *xfs_buf_item_zone;
struct kmem_cache *xfs_buf_item_cache;

static inline struct xfs_buf_log_item *BUF_ITEM(struct xfs_log_item *lip)
{
Expand Down Expand Up @@ -804,7 +804,7 @@ xfs_buf_item_init(
return 0;
}

bip = kmem_cache_zalloc(xfs_buf_item_zone, GFP_KERNEL | __GFP_NOFAIL);
bip = kmem_cache_zalloc(xfs_buf_item_cache, GFP_KERNEL | __GFP_NOFAIL);
xfs_log_item_init(mp, &bip->bli_item, XFS_LI_BUF, &xfs_buf_item_ops);
bip->bli_buf = bp;

Expand All @@ -825,7 +825,7 @@ xfs_buf_item_init(
map_size = DIV_ROUND_UP(chunks, NBWORD);

if (map_size > XFS_BLF_DATAMAP_SIZE) {
kmem_cache_free(xfs_buf_item_zone, bip);
kmem_cache_free(xfs_buf_item_cache, bip);
xfs_err(mp,
"buffer item dirty bitmap (%u uints) too small to reflect %u bytes!",
map_size,
Expand Down Expand Up @@ -1002,7 +1002,7 @@ xfs_buf_item_free(
{
xfs_buf_item_free_format(bip);
kmem_free(bip->bli_item.li_lv_shadow);
kmem_cache_free(xfs_buf_item_zone, bip);
kmem_cache_free(xfs_buf_item_cache, bip);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/xfs_buf_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ static inline void xfs_buf_dquot_io_fail(struct xfs_buf *bp)
void xfs_buf_iodone(struct xfs_buf *);
bool xfs_buf_log_check_iovec(struct xfs_log_iovec *iovec);

extern struct kmem_cache *xfs_buf_item_zone;
extern struct kmem_cache *xfs_buf_item_cache;

#endif /* __XFS_BUF_ITEM_H__ */
26 changes: 13 additions & 13 deletions fs/xfs/xfs_dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
* otherwise by the lowest id first, see xfs_dqlock2.
*/

struct kmem_cache *xfs_qm_dqtrxzone;
static struct kmem_cache *xfs_qm_dqzone;
struct kmem_cache *xfs_dqtrx_cache;
static struct kmem_cache *xfs_dquot_cache;

static struct lock_class_key xfs_dquot_group_class;
static struct lock_class_key xfs_dquot_project_class;
Expand All @@ -57,7 +57,7 @@ xfs_qm_dqdestroy(
mutex_destroy(&dqp->q_qlock);

XFS_STATS_DEC(dqp->q_mount, xs_qm_dquot);
kmem_cache_free(xfs_qm_dqzone, dqp);
kmem_cache_free(xfs_dquot_cache, dqp);
}

/*
Expand Down Expand Up @@ -458,7 +458,7 @@ xfs_dquot_alloc(
{
struct xfs_dquot *dqp;

dqp = kmem_cache_zalloc(xfs_qm_dqzone, GFP_KERNEL | __GFP_NOFAIL);
dqp = kmem_cache_zalloc(xfs_dquot_cache, GFP_KERNEL | __GFP_NOFAIL);

dqp->q_type = type;
dqp->q_id = id;
Expand Down Expand Up @@ -1363,31 +1363,31 @@ xfs_dqlock2(
int __init
xfs_qm_init(void)
{
xfs_qm_dqzone = kmem_cache_create("xfs_dquot",
xfs_dquot_cache = kmem_cache_create("xfs_dquot",
sizeof(struct xfs_dquot),
0, 0, NULL);
if (!xfs_qm_dqzone)
if (!xfs_dquot_cache)
goto out;

xfs_qm_dqtrxzone = kmem_cache_create("xfs_dqtrx",
xfs_dqtrx_cache = kmem_cache_create("xfs_dqtrx",
sizeof(struct xfs_dquot_acct),
0, 0, NULL);
if (!xfs_qm_dqtrxzone)
goto out_free_dqzone;
if (!xfs_dqtrx_cache)
goto out_free_dquot_cache;

return 0;

out_free_dqzone:
kmem_cache_destroy(xfs_qm_dqzone);
out_free_dquot_cache:
kmem_cache_destroy(xfs_dquot_cache);
out:
return -ENOMEM;
}

void
xfs_qm_exit(void)
{
kmem_cache_destroy(xfs_qm_dqtrxzone);
kmem_cache_destroy(xfs_qm_dqzone);
kmem_cache_destroy(xfs_dqtrx_cache);
kmem_cache_destroy(xfs_dquot_cache);
}

/*
Expand Down
Loading

0 comments on commit 182696f

Please sign in to comment.