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@xxxxxxxxxx> --- 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(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 3b1bd6e112f89..a9499b2fdfb83 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -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; diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c index a4e1f01daf3d8..a704c1a91bece 100644 --- a/fs/xfs/libxfs/xfs_da_btree.c +++ b/fs/xfs/libxfs/xfs_da_btree.c @@ -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. */ diff --git a/fs/xfs/libxfs/xfs_da_btree.h b/fs/xfs/libxfs/xfs_da_btree.h index 6e25de6621e4f..50c803ffb80d8 100644 --- a/fs/xfs/libxfs/xfs_da_btree.h +++ b/fs/xfs/libxfs/xfs_da_btree.h @@ -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, diff --git a/fs/xfs/libxfs/xfs_dir2_node.c b/fs/xfs/libxfs/xfs_dir2_node.c index 6ac4aad98cd76..8d9c0df5b0836 100644 --- a/fs/xfs/libxfs/xfs_dir2_node.c +++ b/fs/xfs/libxfs/xfs_dir2_node.c @@ -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; diff --git a/fs/xfs/scrub/dabtree.c b/fs/xfs/scrub/dabtree.c index 44b15015021f3..cf454957db1f8 100644 --- a/fs/xfs/scrub/dabtree.c +++ b/fs/xfs/scrub/dabtree.c @@ -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; -- 2.26.2