linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Chandan Babu R <chandan.babu@oracle.com>,
	"Darrick J. Wong" <djwong@kernel.org>,
	Dave Chinner <david@fromorbit.com>,
	Sam Sun <samsun1006219@gmail.com>,
	linux-xfs@vger.kernel.org
Subject: Re: [PATCH 3/3] xfs: clean up buffer allocation in xlog_do_recovery_pass
Date: Mon, 29 Apr 2024 08:18:50 -0400	[thread overview]
Message-ID: <Zi-QKgVdIyQToXpu@bfoster> (raw)
In-Reply-To: <20240429070200.1586537-4-hch@lst.de>

On Mon, Apr 29, 2024 at 09:02:00AM +0200, Christoph Hellwig wrote:
> Merge the initial xlog_alloc_buffer calls, and pass the variable
> designating the length that is initialized to 1 above instead of passing
> the open coded 1 directly.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/xfs/xfs_log_recover.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> index d73bec65f93b46..d2e8b903945741 100644
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -3010,6 +3010,10 @@ xlog_do_recovery_pass(
>  	for (i = 0; i < XLOG_RHASH_SIZE; i++)
>  		INIT_HLIST_HEAD(&rhash[i]);
>  
> +	hbp = xlog_alloc_buffer(log, hblks);
> +	if (!hbp)
> +		return -ENOMEM;
> +
>  	/*
>  	 * Read the header of the tail block and get the iclog buffer size from
>  	 * h_size.  Use this to tell how many sectors make up the log header.
> @@ -3020,10 +3024,6 @@ xlog_do_recovery_pass(
>  		 * iclog header and extract the header size from it.  Get a
>  		 * new hbp that is the correct size.
>  		 */
> -		hbp = xlog_alloc_buffer(log, 1);
> -		if (!hbp)
> -			return -ENOMEM;
> -
>  		error = xlog_bread(log, tail_blk, 1, hbp, &offset);
>  		if (error)
>  			goto bread_err1;
> @@ -3071,16 +3071,15 @@ xlog_do_recovery_pass(
>  			if (hblks > 1) {
>  				kvfree(hbp);
>  				hbp = xlog_alloc_buffer(log, hblks);
> +				if (!hbp)
> +					return -ENOMEM;
>  			}
>  		}
>  	} else {
>  		ASSERT(log->l_sectBBsize == 1);
> -		hbp = xlog_alloc_buffer(log, 1);
>  		h_size = XLOG_BIG_RECORD_BSIZE;
>  	}
>  
> -	if (!hbp)
> -		return -ENOMEM;
>  	dbp = xlog_alloc_buffer(log, BTOBB(h_size));
>  	if (!dbp) {
>  		kvfree(hbp);
> -- 
> 2.39.2
> 
> 


  reply	other threads:[~2024-04-29 12:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-29  7:01 fix h_size validation Christoph Hellwig
2024-04-29  7:01 ` [PATCH 1/3] xfs: fix log recovery buffer allocation for the legacy h_size fixup Christoph Hellwig
2024-04-29 12:18   ` Brian Foster
2024-04-29 17:13     ` Christoph Hellwig
2024-04-29 15:53   ` Darrick J. Wong
2024-04-29  7:01 ` [PATCH 2/3] xfs: restrict the h_size fixup in xlog_do_recovery_pass Christoph Hellwig
2024-04-29 12:18   ` Brian Foster
2024-04-29 17:15     ` Christoph Hellwig
2024-04-30 10:59       ` Brian Foster
2024-05-10 12:34         ` Brian Foster
2024-04-29 15:55   ` Darrick J. Wong
2024-04-29  7:02 ` [PATCH 3/3] xfs: clean up buffer allocation " Christoph Hellwig
2024-04-29 12:18   ` Brian Foster [this message]
2024-04-29 15:56   ` 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=Zi-QKgVdIyQToXpu@bfoster \
    --to=bfoster@redhat.com \
    --cc=chandan.babu@oracle.com \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    --cc=samsun1006219@gmail.com \
    /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).