Message ID | 20250106095613.847700-9-hch@lst.de (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [01/15] xfs: fix a double completion for buffers on in-memory targets | expand |
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 > >
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:
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> --- fs/xfs/xfs_buf.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)