@@ -750,7 +750,7 @@ xfs_attr_node_addname(
dp = args->dp;
mp = dp->i_mount;
restart:
- state = xfs_da_state_alloc();
+ state = kmem_cache_zalloc(xfs_da_state_zone, GFP_NOFS | __GFP_NOFAIL);
state->args = args;
state->mp = mp;
@@ -899,7 +899,8 @@ xfs_attr_node_addname(
* attr, not the "new" one.
*/
args->attr_filter |= XFS_ATTR_INCOMPLETE;
- state = xfs_da_state_alloc();
+ state = kmem_cache_zalloc(xfs_da_state_zone,
+ GFP_NOFS | __GFP_NOFAIL);
state->args = args;
state->mp = mp;
state->inleaf = 0;
@@ -975,7 +976,7 @@ xfs_attr_node_removename(
* Tie a string around our finger to remind us where we are.
*/
dp = args->dp;
- state = xfs_da_state_alloc();
+ state = kmem_cache_zalloc(xfs_da_state_zone, GFP_NOFS | __GFP_NOFAIL);
state->args = args;
state->mp = dp->i_mount;
@@ -1207,7 +1208,7 @@ xfs_attr_node_get(xfs_da_args_t *args)
trace_xfs_attr_node_get(args);
- state = xfs_da_state_alloc();
+ state = kmem_cache_zalloc(xfs_da_state_zone, GFP_NOFS | __GFP_NOFAIL);
state->args = args;
state->mp = args->dp->i_mount;
@@ -74,16 +74,6 @@ STATIC int xfs_da3_blk_unlink(xfs_da_state_t *state,
kmem_zone_t *xfs_da_state_zone; /* anchor for state struct zone */
-/*
- * Allocate a dir-state structure.
- * We don't put them on the stack since they're large.
- */
-xfs_da_state_t *
-xfs_da_state_alloc(void)
-{
- return kmem_cache_zalloc(xfs_da_state_zone, GFP_NOFS | __GFP_NOFAIL);
-}
-
/*
* Kill the altpath contents of a da-state structure.
*/
@@ -219,7 +219,6 @@ enum xfs_dacmp xfs_da_compname(struct xfs_da_args *args,
const unsigned char *name, int len);
-xfs_da_state_t *xfs_da_state_alloc(void);
void xfs_da_state_free(xfs_da_state_t *state);
void xfs_da3_node_hdr_from_disk(struct xfs_mount *mp,
@@ -2015,7 +2015,7 @@ xfs_dir2_node_addname(
/*
* Allocate and initialize the state (btree cursor).
*/
- state = xfs_da_state_alloc();
+ state = kmem_cache_zalloc(xfs_da_state_zone, GFP_NOFS | __GFP_NOFAIL);
state->args = args;
state->mp = args->dp->i_mount;
/*
@@ -2086,7 +2086,7 @@ xfs_dir2_node_lookup(
/*
* Allocate and initialize the btree cursor.
*/
- state = xfs_da_state_alloc();
+ state = kmem_cache_zalloc(xfs_da_state_zone, GFP_NOFS | __GFP_NOFAIL);
state->args = args;
state->mp = args->dp->i_mount;
/*
@@ -2139,7 +2139,7 @@ xfs_dir2_node_removename(
/*
* Allocate and initialize the btree cursor.
*/
- state = xfs_da_state_alloc();
+ state = kmem_cache_zalloc(xfs_da_state_zone, GFP_NOFS | __GFP_NOFAIL);
state->args = args;
state->mp = args->dp->i_mount;
@@ -2206,7 +2206,7 @@ xfs_dir2_node_replace(
/*
* Allocate and initialize the btree cursor.
*/
- state = xfs_da_state_alloc();
+ state = kmem_cache_zalloc(xfs_da_state_zone, GFP_NOFS | __GFP_NOFAIL);
state->args = args;
state->mp = args->dp->i_mount;
@@ -476,7 +476,8 @@ xchk_da_btree(
ds.dargs.whichfork = whichfork;
ds.dargs.trans = sc->tp;
ds.dargs.op_flags = XFS_DA_OP_OKNOENT;
- ds.state = xfs_da_state_alloc();
+ ds.state = kmem_cache_zalloc(xfs_da_state_zone,
+ GFP_NOFS | __GFP_NOFAIL);
ds.state->args = &ds.dargs;
ds.state->mp = mp;
ds.sc = sc;
xfs_da_state_alloc() can simply be replaced by kmem_cache_zalloc() calls directly. No need to keep this helper around. Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com> --- fs/xfs/libxfs/xfs_attr.c | 9 +++++---- fs/xfs/libxfs/xfs_da_btree.c | 10 ---------- fs/xfs/libxfs/xfs_da_btree.h | 1 - fs/xfs/libxfs/xfs_dir2_node.c | 8 ++++---- fs/xfs/scrub/dabtree.c | 3 ++- 5 files changed, 11 insertions(+), 20 deletions(-)