public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 5/8] libxfs: use a memory zone for log items
Date: Thu, 11 Jan 2018 11:49:16 -0800	[thread overview]
Message-ID: <20180111194916.GE5602@magnolia> (raw)
In-Reply-To: <1515699458-6925-6-git-send-email-sandeen@sandeen.net>

On Thu, Jan 11, 2018 at 01:37:35PM -0600, Eric Sandeen wrote:
> In addition to more closely matching the kernel, this will
> help us catch any leaks from these allocations.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

> ---
>  libxfs/trans.c | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/libxfs/trans.c b/libxfs/trans.c
> index 035cc22..f79fae9 100644
> --- a/libxfs/trans.c
> +++ b/libxfs/trans.c
> @@ -65,13 +65,7 @@ libxfs_trans_add_item(
>  	ASSERT(lip->li_mountp == tp->t_mountp);
>  	ASSERT(lip->li_ailp == tp->t_mountp->m_ail);
>  
> -	lidp = calloc(sizeof(struct xfs_log_item_desc), 1);
> -	if (!lidp) {
> -		fprintf(stderr, _("%s: lidp calloc failed (%d bytes): %s\n"),
> -			progname, (int)sizeof(struct xfs_log_item_desc),
> -			strerror(errno));
> -		exit(1);
> -	}
> +	lidp = kmem_zone_zalloc(xfs_log_item_desc_zone, KM_SLEEP | KM_NOFS);
>  
>  	lidp->lid_item = lip;
>  	lidp->lid_flags = 0;
> @@ -80,6 +74,14 @@ libxfs_trans_add_item(
>  	lip->li_desc = lidp;
>  }
>  
> +static void
> +libxfs_trans_free_item_desc(
> +        struct xfs_log_item_desc *lidp)
> +{
> +	list_del_init(&lidp->lid_trans);
> +	kmem_zone_free(xfs_log_item_desc_zone, lidp);
> +}
> +
>  /*
>   * Unlink and free the given descriptor.
>   */
> @@ -87,8 +89,7 @@ void
>  libxfs_trans_del_item(
>  	struct xfs_log_item	*lip)
>  {
> -	list_del_init(&lip->li_desc->lid_trans);
> -	free(lip->li_desc);
> +	libxfs_trans_free_item_desc(lip->li_desc);
>  	lip->li_desc = NULL;
>  }
>  
> -- 
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2018-01-11 19:49 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11 19:37 [PATCH 0/8] libxfs: cleanup & leak detection Eric Sandeen
2018-01-11 19:37 ` [PATCH 1/8] xfs: remove wrappers around b_fspriv Eric Sandeen
2018-01-11 19:42   ` Darrick J. Wong
2018-01-11 19:37 ` [PATCH 2/8] xfs: add a proper transaction pointer to struct xfs_buf Eric Sandeen
2018-01-11 19:43   ` Darrick J. Wong
2018-01-11 19:37 ` [PATCH 3/8] xfs: remove unused buf_fsprivate3 Eric Sandeen
2018-01-11 19:44   ` Darrick J. Wong
2018-01-11 19:37 ` [PATCH 4/8] libxfs: use a memory zone for transactions Eric Sandeen
2018-01-11 19:48   ` Darrick J. Wong
2018-01-25 19:01   ` [PATCH 4/8 V2] " Eric Sandeen
2018-01-25 19:22     ` Darrick J. Wong
2018-01-11 19:37 ` [PATCH 5/8] libxfs: use a memory zone for log items Eric Sandeen
2018-01-11 19:49   ` Darrick J. Wong [this message]
2018-01-11 19:37 ` [PATCH 6/8] libxfs: manage xfs_buf_zone count within cache Eric Sandeen
2018-01-11 20:20   ` Darrick J. Wong
2018-01-11 20:48     ` Eric Sandeen
2018-01-11 22:09       ` Dave Chinner
2018-01-11 19:37 ` [PATCH 7/8] libxfs: add function to free all bufferse in bcache Eric Sandeen
2018-01-11 20:05   ` Darrick J. Wong
2018-01-11 20:11     ` Eric Sandeen
2018-01-11 20:22       ` Darrick J. Wong
2018-01-11 19:37 ` [PATCH 8/8] libxfs: Catch non-empty zones on destroy Eric Sandeen
2018-01-11 20:29   ` Darrick J. Wong
2018-01-11 23:42     ` Eric Sandeen

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=20180111194916.GE5602@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /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