diff mbox series

[10/12] iomap: warn on inline maps in iomap_writepage_map

Message ID 20191015154345.13052-11-hch@lst.de (mailing list archive)
State Superseded
Headers show
Series [01/12] xfs: initialize iomap->flags in xfs_bmbt_to_iomap | expand

Commit Message

Christoph Hellwig Oct. 15, 2019, 3:43 p.m. UTC
And inline mapping should never mark the page dirty and thus never end up
in writepages.  Add a check for that condition and warn if it happens.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/iomap/buffered-io.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Dave Chinner Oct. 15, 2019, 10:08 p.m. UTC | #1
On Tue, Oct 15, 2019 at 05:43:43PM +0200, Christoph Hellwig wrote:
> And inline mapping should never mark the page dirty and thus never end up
> in writepages.  Add a check for that condition and warn if it happens.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  fs/iomap/buffered-io.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
> index 00af08006cd3..76e72576f307 100644
> --- a/fs/iomap/buffered-io.c
> +++ b/fs/iomap/buffered-io.c
> @@ -1421,6 +1421,8 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc,
>  		error = wpc->ops->map_blocks(wpc, inode, file_offset);
>  		if (error)
>  			break;
> +		if (WARN_ON_ONCE(wpc->iomap.type == IOMAP_INLINE))
> +			continue;
>  		if (wpc->iomap.type == IOMAP_HOLE)
>  			continue;
>  		iomap_add_to_ioend(inode, file_offset, page, iop, wpc, wbc,

looks fine.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
diff mbox series

Patch

diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 00af08006cd3..76e72576f307 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -1421,6 +1421,8 @@  iomap_writepage_map(struct iomap_writepage_ctx *wpc,
 		error = wpc->ops->map_blocks(wpc, inode, file_offset);
 		if (error)
 			break;
+		if (WARN_ON_ONCE(wpc->iomap.type == IOMAP_INLINE))
+			continue;
 		if (wpc->iomap.type == IOMAP_HOLE)
 			continue;
 		iomap_add_to_ioend(inode, file_offset, page, iop, wpc, wbc,