linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Carlos Maiolino <cmaiolino@redhat.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 3/5] xfs: Modify xlog_ticket_alloc() to use kernel's MM API
Date: Thu, 23 Jul 2020 22:39:47 -0700	[thread overview]
Message-ID: <20200724053947.GS3151642@magnolia> (raw)
In-Reply-To: <20200722090518.214624-4-cmaiolino@redhat.com>

On Wed, Jul 22, 2020 at 11:05:16AM +0200, Carlos Maiolino wrote:
> xlog_ticket_alloc() is always called under NOFS context, except from
> unmount path, which eitherway is holding many FS locks, so, there is no
> need for its callers to keep passing allocation flags into it.
> 
> change xlog_ticket_alloc() to use default kmem_cache_zalloc(), remove
> its alloc_flags argument, and always use GFP_NOFS | __GFP_NOFAIL flags.
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>

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

--D

> ---
> 
> Changelog:
> 	V2:
> 		- Remove alloc_flags argument from xlog_ticket_alloc()
> 		  and update patch description accordingly.
> 
>  fs/xfs/xfs_log.c      | 9 +++------
>  fs/xfs/xfs_log_cil.c  | 3 +--
>  fs/xfs/xfs_log_priv.h | 4 +---
>  3 files changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index 00fda2e8e7380..ad0c69ee89475 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -433,7 +433,7 @@ xfs_log_reserve(
>  	XFS_STATS_INC(mp, xs_try_logspace);
>  
>  	ASSERT(*ticp == NULL);
> -	tic = xlog_ticket_alloc(log, unit_bytes, cnt, client, permanent, 0);
> +	tic = xlog_ticket_alloc(log, unit_bytes, cnt, client, permanent);
>  	*ticp = tic;
>  
>  	xlog_grant_push_ail(log, tic->t_cnt ? tic->t_unit_res * tic->t_cnt
> @@ -3408,15 +3408,12 @@ xlog_ticket_alloc(
>  	int			unit_bytes,
>  	int			cnt,
>  	char			client,
> -	bool			permanent,
> -	xfs_km_flags_t		alloc_flags)
> +	bool			permanent)
>  {
>  	struct xlog_ticket	*tic;
>  	int			unit_res;
>  
> -	tic = kmem_zone_zalloc(xfs_log_ticket_zone, alloc_flags);
> -	if (!tic)
> -		return NULL;
> +	tic = kmem_cache_zalloc(xfs_log_ticket_zone, GFP_NOFS | __GFP_NOFAIL);
>  
>  	unit_res = xfs_log_calc_unit_res(log->l_mp, unit_bytes);
>  
> diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
> index 9ed90368ab311..56c32eecffead 100644
> --- a/fs/xfs/xfs_log_cil.c
> +++ b/fs/xfs/xfs_log_cil.c
> @@ -37,8 +37,7 @@ xlog_cil_ticket_alloc(
>  {
>  	struct xlog_ticket *tic;
>  
> -	tic = xlog_ticket_alloc(log, 0, 1, XFS_TRANSACTION, 0,
> -				KM_NOFS);
> +	tic = xlog_ticket_alloc(log, 0, 1, XFS_TRANSACTION, 0);
>  
>  	/*
>  	 * set the current reservation to zero so we know to steal the basic
> diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
> index 75a62870b63af..1c6fdbf3d5066 100644
> --- a/fs/xfs/xfs_log_priv.h
> +++ b/fs/xfs/xfs_log_priv.h
> @@ -464,9 +464,7 @@ xlog_ticket_alloc(
>  	int		unit_bytes,
>  	int		count,
>  	char		client,
> -	bool		permanent,
> -	xfs_km_flags_t	alloc_flags);
> -
> +	bool		permanent);
>  
>  static inline void
>  xlog_write_adv_cnt(void **ptr, int *len, int *off, size_t bytes)
> -- 
> 2.26.2
> 

  parent reply	other threads:[~2020-07-24  5:39 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22  9:05 [PATCH 0/5] Continue xfs kmem cleanup - V3 Carlos Maiolino
2020-07-22  9:05 ` [PATCH 1/5] xfs: Remove kmem_zone_alloc() usage Carlos Maiolino
2020-07-22 14:13   ` Christoph Hellwig
2020-07-23  9:02     ` Carlos Maiolino
2020-07-24  1:40   ` Dave Chinner
2020-07-24  5:36   ` Darrick J. Wong
2020-07-22  9:05 ` [PATCH 2/5] xfs: Remove kmem_zone_zalloc() usage Carlos Maiolino
2020-07-24  1:41   ` Dave Chinner
2020-07-24  5:39   ` Darrick J. Wong
2020-07-22  9:05 ` [PATCH 3/5] xfs: Modify xlog_ticket_alloc() to use kernel's MM API Carlos Maiolino
2020-07-24  1:41   ` Dave Chinner
2020-07-24  5:39   ` Darrick J. Wong [this message]
2020-07-22  9:05 ` [PATCH 4/5] xfs: remove xfs_zone_{alloc,zalloc} helpers Carlos Maiolino
2020-07-24  5:40   ` Darrick J. Wong
2020-07-22  9:05 ` [PATCH 5/5] xfs: Refactor xfs_da_state_alloc() helper Carlos Maiolino
2020-07-22 14:15   ` Christoph Hellwig
2020-07-24  1:42   ` Dave Chinner
2020-07-24  5:40   ` Darrick J. Wong

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=20200724053947.GS3151642@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;
as well as URLs for NNTP newsgroup(s).