diff mbox series

[10/15] xfs: move invalidate_kernel_vmap_range to xfs_buf_ioend

Message ID 20250106095613.847700-11-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

Commit Message

Christoph Hellwig Jan. 6, 2025, 9:54 a.m. UTC
Invalidating cache lines can be fairly expensive, so don't do it
in interrupt context.  Note that in practice very few setup will
actually do anything here as virtually indexed caches are rather
uncommon, but we might as well move the call to the proper place
while touching this area.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_buf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Darrick J. Wong Jan. 7, 2025, 6:42 a.m. UTC | #1
On Mon, Jan 06, 2025 at 10:54:47AM +0100, Christoph Hellwig wrote:
> Invalidating cache lines can be fairly expensive, so don't do it
> in interrupt context.  Note that in practice very few setup will
> actually do anything here as virtually indexed caches are rather
> uncommon, but we might as well move the call to the proper place
> while touching this area.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Seems fine to me,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_buf.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index 094f16457998..49df4adf0e98 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -1365,6 +1365,9 @@ xfs_buf_ioend(
>  	trace_xfs_buf_iodone(bp, _RET_IP_);
>  
>  	if (bp->b_flags & XBF_READ) {
> +		if (!bp->b_error && xfs_buf_is_vmapped(bp))
> +			invalidate_kernel_vmap_range(bp->b_addr,
> +					xfs_buf_vmap_len(bp));
>  		if (!bp->b_error && bp->b_ops)
>  			bp->b_ops->verify_read(bp);
>  		if (!bp->b_error)
> @@ -1495,9 +1498,6 @@ xfs_buf_bio_end_io(
>  		 XFS_TEST_ERROR(false, bp->b_mount, XFS_ERRTAG_BUF_IOERROR))
>  		xfs_buf_ioerror(bp, -EIO);
>  
> -	if (!bp->b_error && xfs_buf_is_vmapped(bp) && (bp->b_flags & XBF_READ))
> -		invalidate_kernel_vmap_range(bp->b_addr, xfs_buf_vmap_len(bp));
> -
>  	xfs_buf_ioend_async(bp);
>  	bio_put(bio);
>  }
> -- 
> 2.45.2
> 
>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 094f16457998..49df4adf0e98 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -1365,6 +1365,9 @@  xfs_buf_ioend(
 	trace_xfs_buf_iodone(bp, _RET_IP_);
 
 	if (bp->b_flags & XBF_READ) {
+		if (!bp->b_error && xfs_buf_is_vmapped(bp))
+			invalidate_kernel_vmap_range(bp->b_addr,
+					xfs_buf_vmap_len(bp));
 		if (!bp->b_error && bp->b_ops)
 			bp->b_ops->verify_read(bp);
 		if (!bp->b_error)
@@ -1495,9 +1498,6 @@  xfs_buf_bio_end_io(
 		 XFS_TEST_ERROR(false, bp->b_mount, XFS_ERRTAG_BUF_IOERROR))
 		xfs_buf_ioerror(bp, -EIO);
 
-	if (!bp->b_error && xfs_buf_is_vmapped(bp) && (bp->b_flags & XBF_READ))
-		invalidate_kernel_vmap_range(bp->b_addr, xfs_buf_vmap_len(bp));
-
 	xfs_buf_ioend_async(bp);
 	bio_put(bio);
 }