Re: [PATCH 3/5] xfs: fix zoned write iomap flags assignments

"Darrick J. Wong" <[email protected]>
Newsgroups org.kernel.vger.linux-xfs
Message-ID <20260810181105.GU3556460@frogsfrogsfrogs>
On Mon, Aug 10, 2026 at 08:37:44AM -0700, Christoph Hellwig wrote:
> Don't overwrite IOMAP_F_DIRTY with IOMAP_F_ANON_WRITE, but ensure both
> flags are set instead.
> 
> Note that in practice this is harmless as all zoned writes force a metadata
> transaction anyway, but incorrectly assigned flags are still a landmine
> that will cause problems at some point.
> 
> Fixes: 058dd70c65ab ("xfs: implement buffered writes to zoned RT devices")
> Fixes: 2e2383405824 ("xfs: implement direct writes to zoned RT devices")
> Signed-off-by: Christoph Hellwig <[email protected]>

Looks good,

Cc: <[email protected]> # v6.15
Reviewed-by: "Darrick J. Wong" <[email protected]>

--D

> ---
>  fs/xfs/xfs_aops.c  | 3 +--
>  fs/xfs/xfs_iomap.c | 3 +--
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
> index c80f05507373..9506cd8d15e6 100644
> --- a/fs/xfs/xfs_aops.c
> +++ b/fs/xfs/xfs_aops.c
> @@ -634,11 +634,10 @@ xfs_zoned_map_blocks(
>  	xfs_iunlock(ip, XFS_ILOCK_EXCL);
>  
>  	wpc->iomap.type = IOMAP_MAPPED;
> -	wpc->iomap.flags = IOMAP_F_DIRTY;
>  	wpc->iomap.bdev = mp->m_rtdev_targp->bt_bdev;
>  	wpc->iomap.offset = offset;
>  	wpc->iomap.length = XFS_FSB_TO_B(mp, count_fsb);
> -	wpc->iomap.flags = IOMAP_F_ANON_WRITE;
> +	wpc->iomap.flags = IOMAP_F_ANON_WRITE | IOMAP_F_DIRTY;
>  
>  	trace_xfs_zoned_map_blocks(ip, offset, wpc->iomap.length);
>  	return 0;
> diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
> index 225c3de88d03..9fa9aa33745f 100644
> --- a/fs/xfs/xfs_iomap.c
> +++ b/fs/xfs/xfs_iomap.c
> @@ -1081,11 +1081,10 @@ xfs_zoned_direct_write_iomap_begin(
>  	}
>  
>  	iomap->type = IOMAP_MAPPED;
> -	iomap->flags = IOMAP_F_DIRTY;
>  	iomap->bdev = ip->i_mount->m_rtdev_targp->bt_bdev;
>  	iomap->offset = offset;
>  	iomap->length = length;
> -	iomap->flags = IOMAP_F_ANON_WRITE;
> +	iomap->flags = IOMAP_F_ANON_WRITE | IOMAP_F_DIRTY;
>  	return 0;
>  }
>  
> -- 
> 2.53.0
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.