Skip to content

Commit 8db65d3

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
xfs: move in-memory buftarg handling out of _xfs_buf_ioapply
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 <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Acked-by: Dave Chinner <[email protected]> Signed-off-by: Carlos Maiolino <[email protected]>
1 parent 0195647 commit 8db65d3

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

fs/xfs/xfs_buf.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,12 +1604,6 @@ _xfs_buf_ioapply(
16041604
int size;
16051605
int i;
16061606

1607-
/*
1608-
* Make sure we capture only current IO errors rather than stale errors
1609-
* left over from previous use of the buffer (e.g. failed readahead).
1610-
*/
1611-
bp->b_error = 0;
1612-
16131607
if (bp->b_flags & XBF_WRITE) {
16141608
op = REQ_OP_WRITE;
16151609
} else {
@@ -1621,10 +1615,6 @@ _xfs_buf_ioapply(
16211615
/* we only use the buffer cache for meta-data */
16221616
op |= REQ_META;
16231617

1624-
/* in-memory targets are directly mapped, no IO required. */
1625-
if (xfs_buftarg_is_mem(bp->b_target))
1626-
return;
1627-
16281618
/*
16291619
* Walk all the vectors issuing IO on them. Set up the initial offset
16301620
* into the buffer and the desired IO size before we start -
@@ -1734,7 +1724,11 @@ xfs_buf_submit(
17341724
if (bp->b_flags & XBF_WRITE)
17351725
xfs_buf_wait_unpin(bp);
17361726

1737-
/* clear the internal error state to avoid spurious errors */
1727+
/*
1728+
* Make sure we capture only current IO errors rather than stale errors
1729+
* left over from previous use of the buffer (e.g. failed readahead).
1730+
*/
1731+
bp->b_error = 0;
17381732
bp->b_io_error = 0;
17391733

17401734
/*
@@ -1751,6 +1745,10 @@ xfs_buf_submit(
17511745
goto done;
17521746
}
17531747

1748+
/* In-memory targets are directly mapped, no I/O required. */
1749+
if (xfs_buftarg_is_mem(bp->b_target))
1750+
goto done;
1751+
17541752
_xfs_buf_ioapply(bp);
17551753

17561754
done:

0 commit comments

Comments
 (0)