All of lore.kernel.org
 help / color / mirror / Atom feed
From: Carlos Maiolino <cmaiolino@redhat.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH 5/5] xfs: Remove xfs_da_state_alloc() helper
Date: Fri, 10 Jul 2020 11:15:36 +0200	[thread overview]
Message-ID: <20200710091536.95828-6-cmaiolino@redhat.com> (raw)
In-Reply-To: <20200710091536.95828-1-cmaiolino@redhat.com>

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(-)

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


  parent reply	other threads:[~2020-07-10  9:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-10  9:15 [PATCH 0/5] Continue xfs kmem cleanup - V2 Carlos Maiolino
2020-07-10  9:15 ` [PATCH V2 1/5] xfs: Remove kmem_zone_alloc() usage Carlos Maiolino
2020-07-10 16:08   ` Christoph Hellwig
2020-07-10 22:21     ` Dave Chinner
2020-07-13  9:16       ` Carlos Maiolino
2020-07-13 16:17         ` Darrick J. Wong
2020-07-15 15:06           ` Carlos Maiolino
2020-07-15 15:37             ` Darrick J. Wong
2020-07-15 17:32               ` Christoph Hellwig
2020-07-10  9:15 ` [PATCH V2 2/5] xfs: Remove kmem_zone_zalloc() usage Carlos Maiolino
2020-07-10 16:09   ` Christoph Hellwig
2020-07-10  9:15 ` [PATCH V3 3/5] xfs: Modify xlog_ticket_alloc() to use kernel's MM API Carlos Maiolino
2020-07-10  9:23   ` Carlos Maiolino
2020-07-10 16:09   ` Christoph Hellwig
2020-07-10  9:15 ` [PATCH 4/5] xfs: remove xfs_zone_{alloc,zalloc} helpers Carlos Maiolino
2020-07-10 16:09   ` Christoph Hellwig
2020-07-10  9:15 ` Carlos Maiolino [this message]
2020-07-10 16:11   ` [PATCH 5/5] xfs: Remove xfs_da_state_alloc() helper Christoph Hellwig
2020-07-13  9:17     ` Carlos Maiolino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200710091536.95828-6-cmaiolino@redhat.com \
    --to=cmaiolino@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.