public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Carlos Maiolino <cem@kernel.org>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 08/15] xfs: move in-memory buftarg handling out of _xfs_buf_ioapply
Date: Mon, 6 Jan 2025 22:34:23 -0800	[thread overview]
Message-ID: <20250107063423.GZ6174@frogsfrogsfrogs> (raw)
In-Reply-To: <20250106095613.847700-9-hch@lst.de>

On Mon, Jan 06, 2025 at 10:54:45AM +0100, Christoph Hellwig wrote:
> No I/O to apply for in-memory buffers, so skip the function call
> entirely.  Clean up the b_io_error initialization logic to allow
> for this.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Nice cleanup!
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_buf.c | 20 +++++++++-----------
>  1 file changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index 18e830c4e990..e886605b5721 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -1607,12 +1607,6 @@ _xfs_buf_ioapply(
>  	int		size;
>  	int		i;
>  
> -	/*
> -	 * Make sure we capture only current IO errors rather than stale errors
> -	 * left over from previous use of the buffer (e.g. failed readahead).
> -	 */
> -	bp->b_error = 0;
> -
>  	if (bp->b_flags & XBF_WRITE) {
>  		op = REQ_OP_WRITE;
>  	} else {
> @@ -1624,10 +1618,6 @@ _xfs_buf_ioapply(
>  	/* we only use the buffer cache for meta-data */
>  	op |= REQ_META;
>  
> -	/* in-memory targets are directly mapped, no IO required. */
> -	if (xfs_buftarg_is_mem(bp->b_target))
> -		return;
> -
>  	/*
>  	 * Walk all the vectors issuing IO on them. Set up the initial offset
>  	 * into the buffer and the desired IO size before we start -
> @@ -1740,7 +1730,11 @@ xfs_buf_submit(
>  	if (bp->b_flags & XBF_WRITE)
>  		xfs_buf_wait_unpin(bp);
>  
> -	/* clear the internal error state to avoid spurious errors */
> +	/*
> +	 * Make sure we capture only current IO errors rather than stale errors
> +	 * left over from previous use of the buffer (e.g. failed readahead).
> +	 */
> +	bp->b_error = 0;
>  	bp->b_io_error = 0;
>  
>  	/*
> @@ -1757,6 +1751,10 @@ xfs_buf_submit(
>  		goto done;
>  	}
>  
> +	/* In-memory targets are directly mapped, no I/O required. */
> +	if (xfs_buftarg_is_mem(bp->b_target))
> +		goto done;
> +
>  	_xfs_buf_ioapply(bp);
>  
>  done:
> -- 
> 2.45.2
> 
> 

  reply	other threads:[~2025-01-07  6:34 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-06  9:54 buffer cache cleanups Christoph Hellwig
2025-01-06  9:54 ` [PATCH 01/15] xfs: fix a double completion for buffers on in-memory targets Christoph Hellwig
2025-01-07  2:00   ` Darrick J. Wong
2025-01-07  6:05     ` Christoph Hellwig
2025-01-06  9:54 ` [PATCH 02/15] xfs: remove the incorrect comment above xfs_buf_free_maps Christoph Hellwig
2025-01-07  2:00   ` Darrick J. Wong
2025-01-06  9:54 ` [PATCH 03/15] xfs: remove the incorrect comment about the b_pag field Christoph Hellwig
2025-01-07  2:01   ` Darrick J. Wong
2025-01-06  9:54 ` [PATCH 04/15] xfs: move xfs_buf_iowait out of (__)xfs_buf_submit Christoph Hellwig
2025-01-07  2:02   ` Darrick J. Wong
2025-01-06  9:54 ` [PATCH 05/15] xfs: simplify xfs_buf_delwri_pushbuf Christoph Hellwig
2025-01-07  2:08   ` Darrick J. Wong
2025-01-07  6:06     ` Christoph Hellwig
2025-01-13  7:12       ` Darrick J. Wong
2025-01-06  9:54 ` [PATCH 06/15] xfs: remove xfs_buf_delwri_submit_buffers Christoph Hellwig
2025-01-07  6:31   ` Darrick J. Wong
2025-01-07  6:33     ` Christoph Hellwig
2025-01-06  9:54 ` [PATCH 07/15] xfs: move write verification out of _xfs_buf_ioapply Christoph Hellwig
2025-01-07  6:33   ` Darrick J. Wong
2025-01-06  9:54 ` [PATCH 08/15] xfs: move in-memory buftarg handling " Christoph Hellwig
2025-01-07  6:34   ` Darrick J. Wong [this message]
2025-01-06  9:54 ` [PATCH 09/15] xfs: simplify buffer I/O submission Christoph Hellwig
2025-01-07  6:42   ` Darrick J. Wong
2025-01-07  6:46     ` Christoph Hellwig
2025-01-07  6:57       ` Darrick J. Wong
2025-01-06  9:54 ` [PATCH 10/15] xfs: move invalidate_kernel_vmap_range to xfs_buf_ioend Christoph Hellwig
2025-01-07  6:42   ` Darrick J. Wong
2025-01-06  9:54 ` [PATCH 11/15] xfs: remove the extra buffer reference in xfs_buf_submit Christoph Hellwig
2025-01-13  7:13   ` Darrick J. Wong
2025-01-06  9:54 ` [PATCH 12/15] xfs: always complete the buffer inline " Christoph Hellwig
2025-01-07  6:46   ` Darrick J. Wong
2025-01-06  9:54 ` [PATCH 13/15] xfs: simplify xfsaild_resubmit_item Christoph Hellwig
2025-01-07  6:49   ` Darrick J. Wong
2025-01-06  9:54 ` [PATCH 14/15] xfs: move b_li_list based retry handling to common code Christoph Hellwig
2025-01-07  6:55   ` Darrick J. Wong
2025-01-07  7:03     ` Christoph Hellwig
2025-01-13  7:18       ` Darrick J. Wong
2025-01-06  9:54 ` [PATCH 15/15] xfs: add a b_iodone callback to struct xfs_buf Christoph Hellwig
2025-01-07  6:58   ` Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2025-01-13 14:12 buffer cache cleanups v2 Christoph Hellwig
2025-01-13 14:12 ` [PATCH 08/15] xfs: move in-memory buftarg handling out of _xfs_buf_ioapply Christoph Hellwig

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=20250107063423.GZ6174@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=cem@kernel.org \
    --cc=hch@lst.de \
    --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