From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Carlos Maiolino <cmaiolino@redhat.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 03/11] xfs: Remove kmem_zone_free() wrapper
Date: Wed, 13 Nov 2019 09:08:10 -0800 [thread overview]
Message-ID: <20191113170810.GZ6219@magnolia> (raw)
In-Reply-To: <20191113142335.1045631-4-cmaiolino@redhat.com>
On Wed, Nov 13, 2019 at 03:23:27PM +0100, Carlos Maiolino wrote:
> We can remove it now, without needing to rework the KM_ flags.
>
> Use kmem_cache_free() directly.
>
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> ---
> fs/xfs/kmem.h | 6 ------
> fs/xfs/libxfs/xfs_btree.c | 2 +-
> fs/xfs/libxfs/xfs_da_btree.c | 2 +-
> fs/xfs/libxfs/xfs_inode_fork.c | 8 ++++----
> fs/xfs/xfs_bmap_item.c | 4 ++--
> fs/xfs/xfs_buf.c | 6 +++---
> fs/xfs/xfs_buf_item.c | 4 ++--
> fs/xfs/xfs_dquot.c | 2 +-
> fs/xfs/xfs_extfree_item.c | 4 ++--
> fs/xfs/xfs_icache.c | 4 ++--
> fs/xfs/xfs_icreate_item.c | 2 +-
> fs/xfs/xfs_inode_item.c | 2 +-
> fs/xfs/xfs_log.c | 2 +-
> fs/xfs/xfs_refcount_item.c | 4 ++--
> fs/xfs/xfs_rmap_item.c | 4 ++--
> fs/xfs/xfs_trans.c | 2 +-
> fs/xfs/xfs_trans_dquot.c | 2 +-
> 17 files changed, 27 insertions(+), 33 deletions(-)
>
> diff --git a/fs/xfs/kmem.h b/fs/xfs/kmem.h
> index 70ed74c7f37e..6143117770e9 100644
> --- a/fs/xfs/kmem.h
> +++ b/fs/xfs/kmem.h
> @@ -81,12 +81,6 @@ kmem_zalloc_large(size_t size, xfs_km_flags_t flags)
> #define kmem_zone kmem_cache
> #define kmem_zone_t struct kmem_cache
>
> -static inline void
> -kmem_zone_free(kmem_zone_t *zone, void *ptr)
> -{
> - kmem_cache_free(zone, ptr);
> -}
> -
> extern void *kmem_zone_alloc(kmem_zone_t *, xfs_km_flags_t);
>
> static inline void *
> diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
> index 98843f1258b8..ac0b78ea417b 100644
> --- a/fs/xfs/libxfs/xfs_btree.c
> +++ b/fs/xfs/libxfs/xfs_btree.c
> @@ -384,7 +384,7 @@ xfs_btree_del_cursor(
> /*
> * Free the cursor.
> */
> - kmem_zone_free(xfs_btree_cur_zone, cur);
> + kmem_cache_free(xfs_btree_cur_zone, cur);
> }
>
> /*
> diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
> index 46b1c3fb305c..c5c0b73febae 100644
> --- a/fs/xfs/libxfs/xfs_da_btree.c
> +++ b/fs/xfs/libxfs/xfs_da_btree.c
> @@ -107,7 +107,7 @@ xfs_da_state_free(xfs_da_state_t *state)
> #ifdef DEBUG
> memset((char *)state, 0, sizeof(*state));
> #endif /* DEBUG */
> - kmem_zone_free(xfs_da_state_zone, state);
> + kmem_cache_free(xfs_da_state_zone, state);
> }
>
> void
> diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c
> index 15d6f947620f..ad2b9c313fd2 100644
> --- a/fs/xfs/libxfs/xfs_inode_fork.c
> +++ b/fs/xfs/libxfs/xfs_inode_fork.c
> @@ -120,10 +120,10 @@ xfs_iformat_fork(
> break;
> }
> if (error) {
> - kmem_zone_free(xfs_ifork_zone, ip->i_afp);
> + kmem_cache_free(xfs_ifork_zone, ip->i_afp);
> ip->i_afp = NULL;
> if (ip->i_cowfp)
> - kmem_zone_free(xfs_ifork_zone, ip->i_cowfp);
> + kmem_cache_free(xfs_ifork_zone, ip->i_cowfp);
> ip->i_cowfp = NULL;
> xfs_idestroy_fork(ip, XFS_DATA_FORK);
> }
> @@ -531,10 +531,10 @@ xfs_idestroy_fork(
> }
>
> if (whichfork == XFS_ATTR_FORK) {
> - kmem_zone_free(xfs_ifork_zone, ip->i_afp);
> + kmem_cache_free(xfs_ifork_zone, ip->i_afp);
> ip->i_afp = NULL;
> } else if (whichfork == XFS_COW_FORK) {
> - kmem_zone_free(xfs_ifork_zone, ip->i_cowfp);
> + kmem_cache_free(xfs_ifork_zone, ip->i_cowfp);
> ip->i_cowfp = NULL;
> }
> }
> diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c
> index 243e5e0f82a3..ee6f4229cebc 100644
> --- a/fs/xfs/xfs_bmap_item.c
> +++ b/fs/xfs/xfs_bmap_item.c
> @@ -35,7 +35,7 @@ void
> xfs_bui_item_free(
> struct xfs_bui_log_item *buip)
> {
> - kmem_zone_free(xfs_bui_zone, buip);
> + kmem_cache_free(xfs_bui_zone, buip);
> }
>
> /*
> @@ -201,7 +201,7 @@ xfs_bud_item_release(
> struct xfs_bud_log_item *budp = BUD_ITEM(lip);
>
> xfs_bui_release(budp->bud_buip);
> - kmem_zone_free(xfs_bud_zone, budp);
> + kmem_cache_free(xfs_bud_zone, budp);
> }
>
> static const struct xfs_item_ops xfs_bud_item_ops = {
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index ccccfb792ff8..a0229c368e78 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -238,7 +238,7 @@ _xfs_buf_alloc(
> */
> error = xfs_buf_get_maps(bp, nmaps);
> if (error) {
> - kmem_zone_free(xfs_buf_zone, bp);
> + kmem_cache_free(xfs_buf_zone, bp);
> return NULL;
> }
>
> @@ -328,7 +328,7 @@ xfs_buf_free(
> kmem_free(bp->b_addr);
> _xfs_buf_free_pages(bp);
> xfs_buf_free_maps(bp);
> - kmem_zone_free(xfs_buf_zone, bp);
> + kmem_cache_free(xfs_buf_zone, bp);
> }
>
> /*
> @@ -949,7 +949,7 @@ xfs_buf_get_uncached(
> _xfs_buf_free_pages(bp);
> fail_free_buf:
> xfs_buf_free_maps(bp);
> - kmem_zone_free(xfs_buf_zone, bp);
> + kmem_cache_free(xfs_buf_zone, bp);
> fail:
> return NULL;
> }
> diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
> index 6b69e6137b2b..3458a1264a3f 100644
> --- a/fs/xfs/xfs_buf_item.c
> +++ b/fs/xfs/xfs_buf_item.c
> @@ -763,7 +763,7 @@ xfs_buf_item_init(
> error = xfs_buf_item_get_format(bip, bp->b_map_count);
> ASSERT(error == 0);
> if (error) { /* to stop gcc throwing set-but-unused warnings */
> - kmem_zone_free(xfs_buf_item_zone, bip);
> + kmem_cache_free(xfs_buf_item_zone, bip);
> return error;
> }
>
> @@ -939,7 +939,7 @@ xfs_buf_item_free(
> {
> xfs_buf_item_free_format(bip);
> kmem_free(bip->bli_item.li_lv_shadow);
> - kmem_zone_free(xfs_buf_item_zone, bip);
> + kmem_cache_free(xfs_buf_item_zone, bip);
> }
>
> /*
> diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
> index 4f969d94fb74..153815bf18fc 100644
> --- a/fs/xfs/xfs_dquot.c
> +++ b/fs/xfs/xfs_dquot.c
> @@ -56,7 +56,7 @@ xfs_qm_dqdestroy(
> mutex_destroy(&dqp->q_qlock);
>
> XFS_STATS_DEC(dqp->q_mount, xs_qm_dquot);
> - kmem_zone_free(xfs_qm_dqzone, dqp);
> + kmem_cache_free(xfs_qm_dqzone, dqp);
> }
>
> /*
> diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c
> index a05a1074e8f8..6ea847f6e298 100644
> --- a/fs/xfs/xfs_extfree_item.c
> +++ b/fs/xfs/xfs_extfree_item.c
> @@ -39,7 +39,7 @@ xfs_efi_item_free(
> if (efip->efi_format.efi_nextents > XFS_EFI_MAX_FAST_EXTENTS)
> kmem_free(efip);
> else
> - kmem_zone_free(xfs_efi_zone, efip);
> + kmem_cache_free(xfs_efi_zone, efip);
> }
>
> /*
> @@ -244,7 +244,7 @@ xfs_efd_item_free(struct xfs_efd_log_item *efdp)
> if (efdp->efd_format.efd_nextents > XFS_EFD_MAX_FAST_EXTENTS)
> kmem_free(efdp);
> else
> - kmem_zone_free(xfs_efd_zone, efdp);
> + kmem_cache_free(xfs_efd_zone, efdp);
> }
>
> /*
> diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
> index 944add5ff8e0..950e8a51ec66 100644
> --- a/fs/xfs/xfs_icache.c
> +++ b/fs/xfs/xfs_icache.c
> @@ -44,7 +44,7 @@ xfs_inode_alloc(
> if (!ip)
> return NULL;
> if (inode_init_always(mp->m_super, VFS_I(ip))) {
> - kmem_zone_free(xfs_inode_zone, ip);
> + kmem_cache_free(xfs_inode_zone, ip);
> return NULL;
> }
>
> @@ -104,7 +104,7 @@ xfs_inode_free_callback(
> ip->i_itemp = NULL;
> }
>
> - kmem_zone_free(xfs_inode_zone, ip);
> + kmem_cache_free(xfs_inode_zone, ip);
> }
>
> static void
> diff --git a/fs/xfs/xfs_icreate_item.c b/fs/xfs/xfs_icreate_item.c
> index 3ebd1b7f49d8..490fee22b878 100644
> --- a/fs/xfs/xfs_icreate_item.c
> +++ b/fs/xfs/xfs_icreate_item.c
> @@ -55,7 +55,7 @@ STATIC void
> xfs_icreate_item_release(
> struct xfs_log_item *lip)
> {
> - kmem_zone_free(xfs_icreate_zone, ICR_ITEM(lip));
> + kmem_cache_free(xfs_icreate_zone, ICR_ITEM(lip));
> }
>
> static const struct xfs_item_ops xfs_icreate_item_ops = {
> diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
> index 726aa3bfd6e8..3a62976291a1 100644
> --- a/fs/xfs/xfs_inode_item.c
> +++ b/fs/xfs/xfs_inode_item.c
> @@ -667,7 +667,7 @@ xfs_inode_item_destroy(
> xfs_inode_t *ip)
> {
> kmem_free(ip->i_itemp->ili_item.li_lv_shadow);
> - kmem_zone_free(xfs_ili_zone, ip->i_itemp);
> + kmem_cache_free(xfs_ili_zone, ip->i_itemp);
> }
>
>
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index 3806674090ed..6a147c63a8a6 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -3468,7 +3468,7 @@ xfs_log_ticket_put(
> {
> ASSERT(atomic_read(&ticket->t_ref) > 0);
> if (atomic_dec_and_test(&ticket->t_ref))
> - kmem_zone_free(xfs_log_ticket_zone, ticket);
> + kmem_cache_free(xfs_log_ticket_zone, ticket);
> }
>
> xlog_ticket_t *
> diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c
> index d5708d40ad87..8eeed73928cd 100644
> --- a/fs/xfs/xfs_refcount_item.c
> +++ b/fs/xfs/xfs_refcount_item.c
> @@ -34,7 +34,7 @@ xfs_cui_item_free(
> if (cuip->cui_format.cui_nextents > XFS_CUI_MAX_FAST_EXTENTS)
> kmem_free(cuip);
> else
> - kmem_zone_free(xfs_cui_zone, cuip);
> + kmem_cache_free(xfs_cui_zone, cuip);
> }
>
> /*
> @@ -206,7 +206,7 @@ xfs_cud_item_release(
> struct xfs_cud_log_item *cudp = CUD_ITEM(lip);
>
> xfs_cui_release(cudp->cud_cuip);
> - kmem_zone_free(xfs_cud_zone, cudp);
> + kmem_cache_free(xfs_cud_zone, cudp);
> }
>
> static const struct xfs_item_ops xfs_cud_item_ops = {
> diff --git a/fs/xfs/xfs_rmap_item.c b/fs/xfs/xfs_rmap_item.c
> index 02f84d9a511c..4911b68f95dd 100644
> --- a/fs/xfs/xfs_rmap_item.c
> +++ b/fs/xfs/xfs_rmap_item.c
> @@ -34,7 +34,7 @@ xfs_rui_item_free(
> if (ruip->rui_format.rui_nextents > XFS_RUI_MAX_FAST_EXTENTS)
> kmem_free(ruip);
> else
> - kmem_zone_free(xfs_rui_zone, ruip);
> + kmem_cache_free(xfs_rui_zone, ruip);
> }
>
> /*
> @@ -229,7 +229,7 @@ xfs_rud_item_release(
> struct xfs_rud_log_item *rudp = RUD_ITEM(lip);
>
> xfs_rui_release(rudp->rud_ruip);
> - kmem_zone_free(xfs_rud_zone, rudp);
> + kmem_cache_free(xfs_rud_zone, rudp);
> }
>
> static const struct xfs_item_ops xfs_rud_item_ops = {
> diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
> index f4795fdb7389..3b208f9a865c 100644
> --- a/fs/xfs/xfs_trans.c
> +++ b/fs/xfs/xfs_trans.c
> @@ -71,7 +71,7 @@ xfs_trans_free(
> if (!(tp->t_flags & XFS_TRANS_NO_WRITECOUNT))
> sb_end_intwrite(tp->t_mountp->m_super);
> xfs_trans_free_dqinfo(tp);
> - kmem_zone_free(xfs_trans_zone, tp);
> + kmem_cache_free(xfs_trans_zone, tp);
> }
>
> /*
> diff --git a/fs/xfs/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c
> index 16457465833b..ff1c326826d3 100644
> --- a/fs/xfs/xfs_trans_dquot.c
> +++ b/fs/xfs/xfs_trans_dquot.c
> @@ -872,6 +872,6 @@ xfs_trans_free_dqinfo(
> {
> if (!tp->t_dqinfo)
> return;
> - kmem_zone_free(xfs_qm_dqtrxzone, tp->t_dqinfo);
> + kmem_cache_free(xfs_qm_dqtrxzone, tp->t_dqinfo);
> tp->t_dqinfo = NULL;
> }
> --
> 2.23.0
>
next prev parent reply other threads:[~2019-11-13 17:08 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-13 14:23 [PATCH 00/11] Use generic memory API instead of a custom one Carlos Maiolino
2019-11-13 14:23 ` [PATCH 01/11] xfs: Remove slab init wrappers Carlos Maiolino
2019-11-13 17:06 ` Darrick J. Wong
2019-11-13 14:23 ` [PATCH 02/11] xfs: Remove kmem_zone_destroy() wrapper Carlos Maiolino
2019-11-13 17:06 ` Darrick J. Wong
2019-11-13 14:23 ` [PATCH 03/11] xfs: Remove kmem_zone_free() wrapper Carlos Maiolino
2019-11-13 17:08 ` Darrick J. Wong [this message]
2019-11-13 14:23 ` [PATCH 04/11] xfs: remove kmem_zone_zalloc() Carlos Maiolino
2019-11-13 17:18 ` Darrick J. Wong
2019-11-13 20:27 ` Carlos Maiolino
2019-11-13 14:23 ` [PATCH 05/11] xfs: Remove kmem_zone_alloc() wrapper Carlos Maiolino
2019-11-13 17:28 ` Darrick J. Wong
2019-11-13 18:12 ` Darrick J. Wong
2019-11-13 14:23 ` [PATCH 06/11] xfs: remove kmem_zalloc() wrapper Carlos Maiolino
2019-11-13 17:34 ` Darrick J. Wong
2019-11-13 14:23 ` [PATCH 07/11] xfs: Remove kmem_realloc Carlos Maiolino
2019-11-13 17:40 ` Darrick J. Wong
2019-11-13 18:10 ` Darrick J. Wong
2019-11-13 14:23 ` [PATCH 08/11] xfs: Convert kmem_alloc() users Carlos Maiolino
2019-11-13 17:49 ` Darrick J. Wong
2019-11-13 14:23 ` [PATCH 09/11] xfs: rework kmem_alloc_{io,large} to use GFP_* flags Carlos Maiolino
2019-11-13 18:08 ` Darrick J. Wong
2019-11-13 19:56 ` Dave Chinner
2019-11-14 9:40 ` Carlos Maiolino
2019-11-14 10:31 ` Carlos Maiolino
2019-11-13 14:23 ` [PATCH 10/11] xfs: Remove KM_* flags Carlos Maiolino
2019-11-13 18:14 ` Darrick J. Wong
2019-11-13 14:23 ` [PATCH 11/11] xfs: Remove kmem_alloc_{io, large} and kmem_zalloc_large Carlos Maiolino
2019-11-13 18:23 ` Darrick J. Wong
2019-11-13 20:06 ` Dave Chinner
2019-11-13 20:43 ` Eric Sandeen
2019-11-14 9:46 ` 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=20191113170810.GZ6219@magnolia \
--to=darrick.wong@oracle.com \
--cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox