All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Dan Williams <dan.j.williams@intel.com>,
	Mike Snitzer <snitzer@redhat.com>,
	Ira Weiny <ira.weiny@intel.com>,
	dm-devel@redhat.com, linux-xfs@vger.kernel.org,
	nvdimm@lists.linux.dev, linux-s390@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-erofs@lists.ozlabs.org,
	linux-ext4@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 24/29] iomap: add a IOMAP_DAX flag
Date: Tue, 30 Nov 2021 11:02:24 -0800	[thread overview]
Message-ID: <20211130190224.GH8467@magnolia> (raw)
In-Reply-To: <20211129102203.2243509-25-hch@lst.de>

On Mon, Nov 29, 2021 at 11:21:58AM +0100, Christoph Hellwig wrote:
> Add a flag so that the file system can easily detect DAX operations
> based just on the iomap operation requested instead of looking at
> inode state using IS_DAX.  This will be needed to apply the to be
> added partition offset only for operations that actually use DAX,
> but not things like fiemap that are based on the block device.
> In the long run it should also allow turning the bdev, dax_dev
> and inline_data into a union.

Heh. :)

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  fs/dax.c              | 7 ++++---
>  fs/ext4/inode.c       | 4 ++--
>  fs/xfs/xfs_iomap.c    | 7 ++++---
>  fs/xfs/xfs_iomap.h    | 3 ++-
>  fs/xfs/xfs_pnfs.c     | 2 +-
>  include/linux/iomap.h | 5 +++++
>  6 files changed, 18 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/dax.c b/fs/dax.c
> index 43d58b4219fd0..148e8b0967f35 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -1180,7 +1180,7 @@ int dax_zero_range(struct inode *inode, loff_t pos, loff_t len, bool *did_zero,
>  		.inode		= inode,
>  		.pos		= pos,
>  		.len		= len,
> -		.flags		= IOMAP_ZERO,
> +		.flags		= IOMAP_DAX | IOMAP_ZERO,
>  	};
>  	int ret;
>  
> @@ -1308,6 +1308,7 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
>  		.inode		= iocb->ki_filp->f_mapping->host,
>  		.pos		= iocb->ki_pos,
>  		.len		= iov_iter_count(iter),
> +		.flags		= IOMAP_DAX,
>  	};
>  	loff_t done = 0;
>  	int ret;
> @@ -1461,7 +1462,7 @@ static vm_fault_t dax_iomap_pte_fault(struct vm_fault *vmf, pfn_t *pfnp,
>  		.inode		= mapping->host,
>  		.pos		= (loff_t)vmf->pgoff << PAGE_SHIFT,
>  		.len		= PAGE_SIZE,
> -		.flags		= IOMAP_FAULT,
> +		.flags		= IOMAP_DAX | IOMAP_FAULT,
>  	};
>  	vm_fault_t ret = 0;
>  	void *entry;
> @@ -1570,7 +1571,7 @@ static vm_fault_t dax_iomap_pmd_fault(struct vm_fault *vmf, pfn_t *pfnp,
>  	struct iomap_iter iter = {
>  		.inode		= mapping->host,
>  		.len		= PMD_SIZE,
> -		.flags		= IOMAP_FAULT,
> +		.flags		= IOMAP_DAX | IOMAP_FAULT,
>  	};
>  	vm_fault_t ret = VM_FAULT_FALLBACK;
>  	pgoff_t max_pgoff;
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index d316a2009489b..89c4a174bd393 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3349,8 +3349,8 @@ static int ext4_iomap_alloc(struct inode *inode, struct ext4_map_blocks *map,
>  	 * DAX and direct I/O are the only two operations that are currently
>  	 * supported with IOMAP_WRITE.
>  	 */
> -	WARN_ON(!IS_DAX(inode) && !(flags & IOMAP_DIRECT));
> -	if (IS_DAX(inode))
> +	WARN_ON(!(flags & (IOMAP_DAX | IOMAP_DIRECT)));
> +	if (flags & IOMAP_DAX)
>  		m_flags = EXT4_GET_BLOCKS_CREATE_ZERO;
>  	/*
>  	 * We use i_size instead of i_disksize here because delalloc writeback
> diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
> index d6beb1502f8bc..0ed3e7674353b 100644
> --- a/fs/xfs/xfs_iomap.c
> +++ b/fs/xfs/xfs_iomap.c
> @@ -188,6 +188,7 @@ xfs_iomap_write_direct(
>  	struct xfs_inode	*ip,
>  	xfs_fileoff_t		offset_fsb,
>  	xfs_fileoff_t		count_fsb,
> +	unsigned int		flags,
>  	struct xfs_bmbt_irec	*imap)
>  {
>  	struct xfs_mount	*mp = ip->i_mount;
> @@ -229,7 +230,7 @@ xfs_iomap_write_direct(
>  	 * the reserve block pool for bmbt block allocation if there is no space
>  	 * left but we need to do unwritten extent conversion.
>  	 */
> -	if (IS_DAX(VFS_I(ip))) {
> +	if (flags & IOMAP_DAX) {
>  		bmapi_flags = XFS_BMAPI_CONVERT | XFS_BMAPI_ZERO;
>  		if (imap->br_state == XFS_EXT_UNWRITTEN) {
>  			force = true;
> @@ -620,7 +621,7 @@ imap_needs_alloc(
>  	    imap->br_startblock == DELAYSTARTBLOCK)
>  		return true;
>  	/* we convert unwritten extents before copying the data for DAX */
> -	if (IS_DAX(inode) && imap->br_state == XFS_EXT_UNWRITTEN)
> +	if ((flags & IOMAP_DAX) && imap->br_state == XFS_EXT_UNWRITTEN)
>  		return true;
>  	return false;
>  }
> @@ -826,7 +827,7 @@ xfs_direct_write_iomap_begin(
>  	xfs_iunlock(ip, lockmode);
>  
>  	error = xfs_iomap_write_direct(ip, offset_fsb, end_fsb - offset_fsb,
> -			&imap);
> +			flags, &imap);
>  	if (error)
>  		return error;
>  
> diff --git a/fs/xfs/xfs_iomap.h b/fs/xfs/xfs_iomap.h
> index 657cc02290f22..e88dc162c785e 100644
> --- a/fs/xfs/xfs_iomap.h
> +++ b/fs/xfs/xfs_iomap.h
> @@ -12,7 +12,8 @@ struct xfs_inode;
>  struct xfs_bmbt_irec;
>  
>  int xfs_iomap_write_direct(struct xfs_inode *ip, xfs_fileoff_t offset_fsb,
> -		xfs_fileoff_t count_fsb, struct xfs_bmbt_irec *imap);
> +		xfs_fileoff_t count_fsb, unsigned int flags,
> +		struct xfs_bmbt_irec *imap);
>  int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, xfs_off_t, bool);
>  xfs_fileoff_t xfs_iomap_eof_align_last_fsb(struct xfs_inode *ip,
>  		xfs_fileoff_t end_fsb);
> diff --git a/fs/xfs/xfs_pnfs.c b/fs/xfs/xfs_pnfs.c
> index 7ce1ea11fc3f3..d6334abbc0b3e 100644
> --- a/fs/xfs/xfs_pnfs.c
> +++ b/fs/xfs/xfs_pnfs.c
> @@ -155,7 +155,7 @@ xfs_fs_map_blocks(
>  		xfs_iunlock(ip, lock_flags);
>  
>  		error = xfs_iomap_write_direct(ip, offset_fsb,
> -				end_fsb - offset_fsb, &imap);
> +				end_fsb - offset_fsb, 0, &imap);
>  		if (error)
>  			goto out_unlock;
>  
> diff --git a/include/linux/iomap.h b/include/linux/iomap.h
> index 6d1b08d0ae930..5b9432f9f79eb 100644
> --- a/include/linux/iomap.h
> +++ b/include/linux/iomap.h
> @@ -141,6 +141,11 @@ struct iomap_page_ops {
>  #define IOMAP_NOWAIT		(1 << 5) /* do not block */
>  #define IOMAP_OVERWRITE_ONLY	(1 << 6) /* only pure overwrites allowed */
>  #define IOMAP_UNSHARE		(1 << 7) /* unshare_file_range */
> +#ifdef CONFIG_FS_DAX
> +#define IOMAP_DAX		(1 << 8) /* DAX mapping */
> +#else
> +#define IOMAP_DAX		0
> +#endif /* CONFIG_FS_DAX */
>  
>  struct iomap_ops {
>  	/*
> -- 
> 2.30.2
> 

WARNING: multiple messages have this Message-ID (diff)
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: nvdimm@lists.linux.dev, Mike Snitzer <snitzer@redhat.com>,
	linux-s390@vger.kernel.org, linux-erofs@lists.ozlabs.org,
	virtualization@lists.linux-foundation.org,
	linux-xfs@vger.kernel.org, dm-devel@redhat.com,
	linux-fsdevel@vger.kernel.org,
	Dan Williams <dan.j.williams@intel.com>,
	linux-ext4@vger.kernel.org, Ira Weiny <ira.weiny@intel.com>
Subject: Re: [PATCH 24/29] iomap: add a IOMAP_DAX flag
Date: Tue, 30 Nov 2021 11:02:24 -0800	[thread overview]
Message-ID: <20211130190224.GH8467@magnolia> (raw)
In-Reply-To: <20211129102203.2243509-25-hch@lst.de>

On Mon, Nov 29, 2021 at 11:21:58AM +0100, Christoph Hellwig wrote:
> Add a flag so that the file system can easily detect DAX operations
> based just on the iomap operation requested instead of looking at
> inode state using IS_DAX.  This will be needed to apply the to be
> added partition offset only for operations that actually use DAX,
> but not things like fiemap that are based on the block device.
> In the long run it should also allow turning the bdev, dax_dev
> and inline_data into a union.

Heh. :)

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  fs/dax.c              | 7 ++++---
>  fs/ext4/inode.c       | 4 ++--
>  fs/xfs/xfs_iomap.c    | 7 ++++---
>  fs/xfs/xfs_iomap.h    | 3 ++-
>  fs/xfs/xfs_pnfs.c     | 2 +-
>  include/linux/iomap.h | 5 +++++
>  6 files changed, 18 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/dax.c b/fs/dax.c
> index 43d58b4219fd0..148e8b0967f35 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -1180,7 +1180,7 @@ int dax_zero_range(struct inode *inode, loff_t pos, loff_t len, bool *did_zero,
>  		.inode		= inode,
>  		.pos		= pos,
>  		.len		= len,
> -		.flags		= IOMAP_ZERO,
> +		.flags		= IOMAP_DAX | IOMAP_ZERO,
>  	};
>  	int ret;
>  
> @@ -1308,6 +1308,7 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
>  		.inode		= iocb->ki_filp->f_mapping->host,
>  		.pos		= iocb->ki_pos,
>  		.len		= iov_iter_count(iter),
> +		.flags		= IOMAP_DAX,
>  	};
>  	loff_t done = 0;
>  	int ret;
> @@ -1461,7 +1462,7 @@ static vm_fault_t dax_iomap_pte_fault(struct vm_fault *vmf, pfn_t *pfnp,
>  		.inode		= mapping->host,
>  		.pos		= (loff_t)vmf->pgoff << PAGE_SHIFT,
>  		.len		= PAGE_SIZE,
> -		.flags		= IOMAP_FAULT,
> +		.flags		= IOMAP_DAX | IOMAP_FAULT,
>  	};
>  	vm_fault_t ret = 0;
>  	void *entry;
> @@ -1570,7 +1571,7 @@ static vm_fault_t dax_iomap_pmd_fault(struct vm_fault *vmf, pfn_t *pfnp,
>  	struct iomap_iter iter = {
>  		.inode		= mapping->host,
>  		.len		= PMD_SIZE,
> -		.flags		= IOMAP_FAULT,
> +		.flags		= IOMAP_DAX | IOMAP_FAULT,
>  	};
>  	vm_fault_t ret = VM_FAULT_FALLBACK;
>  	pgoff_t max_pgoff;
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index d316a2009489b..89c4a174bd393 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3349,8 +3349,8 @@ static int ext4_iomap_alloc(struct inode *inode, struct ext4_map_blocks *map,
>  	 * DAX and direct I/O are the only two operations that are currently
>  	 * supported with IOMAP_WRITE.
>  	 */
> -	WARN_ON(!IS_DAX(inode) && !(flags & IOMAP_DIRECT));
> -	if (IS_DAX(inode))
> +	WARN_ON(!(flags & (IOMAP_DAX | IOMAP_DIRECT)));
> +	if (flags & IOMAP_DAX)
>  		m_flags = EXT4_GET_BLOCKS_CREATE_ZERO;
>  	/*
>  	 * We use i_size instead of i_disksize here because delalloc writeback
> diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
> index d6beb1502f8bc..0ed3e7674353b 100644
> --- a/fs/xfs/xfs_iomap.c
> +++ b/fs/xfs/xfs_iomap.c
> @@ -188,6 +188,7 @@ xfs_iomap_write_direct(
>  	struct xfs_inode	*ip,
>  	xfs_fileoff_t		offset_fsb,
>  	xfs_fileoff_t		count_fsb,
> +	unsigned int		flags,
>  	struct xfs_bmbt_irec	*imap)
>  {
>  	struct xfs_mount	*mp = ip->i_mount;
> @@ -229,7 +230,7 @@ xfs_iomap_write_direct(
>  	 * the reserve block pool for bmbt block allocation if there is no space
>  	 * left but we need to do unwritten extent conversion.
>  	 */
> -	if (IS_DAX(VFS_I(ip))) {
> +	if (flags & IOMAP_DAX) {
>  		bmapi_flags = XFS_BMAPI_CONVERT | XFS_BMAPI_ZERO;
>  		if (imap->br_state == XFS_EXT_UNWRITTEN) {
>  			force = true;
> @@ -620,7 +621,7 @@ imap_needs_alloc(
>  	    imap->br_startblock == DELAYSTARTBLOCK)
>  		return true;
>  	/* we convert unwritten extents before copying the data for DAX */
> -	if (IS_DAX(inode) && imap->br_state == XFS_EXT_UNWRITTEN)
> +	if ((flags & IOMAP_DAX) && imap->br_state == XFS_EXT_UNWRITTEN)
>  		return true;
>  	return false;
>  }
> @@ -826,7 +827,7 @@ xfs_direct_write_iomap_begin(
>  	xfs_iunlock(ip, lockmode);
>  
>  	error = xfs_iomap_write_direct(ip, offset_fsb, end_fsb - offset_fsb,
> -			&imap);
> +			flags, &imap);
>  	if (error)
>  		return error;
>  
> diff --git a/fs/xfs/xfs_iomap.h b/fs/xfs/xfs_iomap.h
> index 657cc02290f22..e88dc162c785e 100644
> --- a/fs/xfs/xfs_iomap.h
> +++ b/fs/xfs/xfs_iomap.h
> @@ -12,7 +12,8 @@ struct xfs_inode;
>  struct xfs_bmbt_irec;
>  
>  int xfs_iomap_write_direct(struct xfs_inode *ip, xfs_fileoff_t offset_fsb,
> -		xfs_fileoff_t count_fsb, struct xfs_bmbt_irec *imap);
> +		xfs_fileoff_t count_fsb, unsigned int flags,
> +		struct xfs_bmbt_irec *imap);
>  int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, xfs_off_t, bool);
>  xfs_fileoff_t xfs_iomap_eof_align_last_fsb(struct xfs_inode *ip,
>  		xfs_fileoff_t end_fsb);
> diff --git a/fs/xfs/xfs_pnfs.c b/fs/xfs/xfs_pnfs.c
> index 7ce1ea11fc3f3..d6334abbc0b3e 100644
> --- a/fs/xfs/xfs_pnfs.c
> +++ b/fs/xfs/xfs_pnfs.c
> @@ -155,7 +155,7 @@ xfs_fs_map_blocks(
>  		xfs_iunlock(ip, lock_flags);
>  
>  		error = xfs_iomap_write_direct(ip, offset_fsb,
> -				end_fsb - offset_fsb, &imap);
> +				end_fsb - offset_fsb, 0, &imap);
>  		if (error)
>  			goto out_unlock;
>  
> diff --git a/include/linux/iomap.h b/include/linux/iomap.h
> index 6d1b08d0ae930..5b9432f9f79eb 100644
> --- a/include/linux/iomap.h
> +++ b/include/linux/iomap.h
> @@ -141,6 +141,11 @@ struct iomap_page_ops {
>  #define IOMAP_NOWAIT		(1 << 5) /* do not block */
>  #define IOMAP_OVERWRITE_ONLY	(1 << 6) /* only pure overwrites allowed */
>  #define IOMAP_UNSHARE		(1 << 7) /* unshare_file_range */
> +#ifdef CONFIG_FS_DAX
> +#define IOMAP_DAX		(1 << 8) /* DAX mapping */
> +#else
> +#define IOMAP_DAX		0
> +#endif /* CONFIG_FS_DAX */
>  
>  struct iomap_ops {
>  	/*
> -- 
> 2.30.2
> 

WARNING: multiple messages have this Message-ID (diff)
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: nvdimm@lists.linux.dev, Mike Snitzer <snitzer@redhat.com>,
	linux-s390@vger.kernel.org, linux-erofs@lists.ozlabs.org,
	virtualization@lists.linux-foundation.org,
	linux-xfs@vger.kernel.org, dm-devel@redhat.com,
	linux-fsdevel@vger.kernel.org,
	Dan Williams <dan.j.williams@intel.com>,
	linux-ext4@vger.kernel.org, Ira Weiny <ira.weiny@intel.com>
Subject: Re: [dm-devel] [PATCH 24/29] iomap: add a IOMAP_DAX flag
Date: Tue, 30 Nov 2021 11:02:24 -0800	[thread overview]
Message-ID: <20211130190224.GH8467@magnolia> (raw)
In-Reply-To: <20211129102203.2243509-25-hch@lst.de>

On Mon, Nov 29, 2021 at 11:21:58AM +0100, Christoph Hellwig wrote:
> Add a flag so that the file system can easily detect DAX operations
> based just on the iomap operation requested instead of looking at
> inode state using IS_DAX.  This will be needed to apply the to be
> added partition offset only for operations that actually use DAX,
> but not things like fiemap that are based on the block device.
> In the long run it should also allow turning the bdev, dax_dev
> and inline_data into a union.

Heh. :)

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  fs/dax.c              | 7 ++++---
>  fs/ext4/inode.c       | 4 ++--
>  fs/xfs/xfs_iomap.c    | 7 ++++---
>  fs/xfs/xfs_iomap.h    | 3 ++-
>  fs/xfs/xfs_pnfs.c     | 2 +-
>  include/linux/iomap.h | 5 +++++
>  6 files changed, 18 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/dax.c b/fs/dax.c
> index 43d58b4219fd0..148e8b0967f35 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -1180,7 +1180,7 @@ int dax_zero_range(struct inode *inode, loff_t pos, loff_t len, bool *did_zero,
>  		.inode		= inode,
>  		.pos		= pos,
>  		.len		= len,
> -		.flags		= IOMAP_ZERO,
> +		.flags		= IOMAP_DAX | IOMAP_ZERO,
>  	};
>  	int ret;
>  
> @@ -1308,6 +1308,7 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
>  		.inode		= iocb->ki_filp->f_mapping->host,
>  		.pos		= iocb->ki_pos,
>  		.len		= iov_iter_count(iter),
> +		.flags		= IOMAP_DAX,
>  	};
>  	loff_t done = 0;
>  	int ret;
> @@ -1461,7 +1462,7 @@ static vm_fault_t dax_iomap_pte_fault(struct vm_fault *vmf, pfn_t *pfnp,
>  		.inode		= mapping->host,
>  		.pos		= (loff_t)vmf->pgoff << PAGE_SHIFT,
>  		.len		= PAGE_SIZE,
> -		.flags		= IOMAP_FAULT,
> +		.flags		= IOMAP_DAX | IOMAP_FAULT,
>  	};
>  	vm_fault_t ret = 0;
>  	void *entry;
> @@ -1570,7 +1571,7 @@ static vm_fault_t dax_iomap_pmd_fault(struct vm_fault *vmf, pfn_t *pfnp,
>  	struct iomap_iter iter = {
>  		.inode		= mapping->host,
>  		.len		= PMD_SIZE,
> -		.flags		= IOMAP_FAULT,
> +		.flags		= IOMAP_DAX | IOMAP_FAULT,
>  	};
>  	vm_fault_t ret = VM_FAULT_FALLBACK;
>  	pgoff_t max_pgoff;
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index d316a2009489b..89c4a174bd393 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3349,8 +3349,8 @@ static int ext4_iomap_alloc(struct inode *inode, struct ext4_map_blocks *map,
>  	 * DAX and direct I/O are the only two operations that are currently
>  	 * supported with IOMAP_WRITE.
>  	 */
> -	WARN_ON(!IS_DAX(inode) && !(flags & IOMAP_DIRECT));
> -	if (IS_DAX(inode))
> +	WARN_ON(!(flags & (IOMAP_DAX | IOMAP_DIRECT)));
> +	if (flags & IOMAP_DAX)
>  		m_flags = EXT4_GET_BLOCKS_CREATE_ZERO;
>  	/*
>  	 * We use i_size instead of i_disksize here because delalloc writeback
> diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
> index d6beb1502f8bc..0ed3e7674353b 100644
> --- a/fs/xfs/xfs_iomap.c
> +++ b/fs/xfs/xfs_iomap.c
> @@ -188,6 +188,7 @@ xfs_iomap_write_direct(
>  	struct xfs_inode	*ip,
>  	xfs_fileoff_t		offset_fsb,
>  	xfs_fileoff_t		count_fsb,
> +	unsigned int		flags,
>  	struct xfs_bmbt_irec	*imap)
>  {
>  	struct xfs_mount	*mp = ip->i_mount;
> @@ -229,7 +230,7 @@ xfs_iomap_write_direct(
>  	 * the reserve block pool for bmbt block allocation if there is no space
>  	 * left but we need to do unwritten extent conversion.
>  	 */
> -	if (IS_DAX(VFS_I(ip))) {
> +	if (flags & IOMAP_DAX) {
>  		bmapi_flags = XFS_BMAPI_CONVERT | XFS_BMAPI_ZERO;
>  		if (imap->br_state == XFS_EXT_UNWRITTEN) {
>  			force = true;
> @@ -620,7 +621,7 @@ imap_needs_alloc(
>  	    imap->br_startblock == DELAYSTARTBLOCK)
>  		return true;
>  	/* we convert unwritten extents before copying the data for DAX */
> -	if (IS_DAX(inode) && imap->br_state == XFS_EXT_UNWRITTEN)
> +	if ((flags & IOMAP_DAX) && imap->br_state == XFS_EXT_UNWRITTEN)
>  		return true;
>  	return false;
>  }
> @@ -826,7 +827,7 @@ xfs_direct_write_iomap_begin(
>  	xfs_iunlock(ip, lockmode);
>  
>  	error = xfs_iomap_write_direct(ip, offset_fsb, end_fsb - offset_fsb,
> -			&imap);
> +			flags, &imap);
>  	if (error)
>  		return error;
>  
> diff --git a/fs/xfs/xfs_iomap.h b/fs/xfs/xfs_iomap.h
> index 657cc02290f22..e88dc162c785e 100644
> --- a/fs/xfs/xfs_iomap.h
> +++ b/fs/xfs/xfs_iomap.h
> @@ -12,7 +12,8 @@ struct xfs_inode;
>  struct xfs_bmbt_irec;
>  
>  int xfs_iomap_write_direct(struct xfs_inode *ip, xfs_fileoff_t offset_fsb,
> -		xfs_fileoff_t count_fsb, struct xfs_bmbt_irec *imap);
> +		xfs_fileoff_t count_fsb, unsigned int flags,
> +		struct xfs_bmbt_irec *imap);
>  int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, xfs_off_t, bool);
>  xfs_fileoff_t xfs_iomap_eof_align_last_fsb(struct xfs_inode *ip,
>  		xfs_fileoff_t end_fsb);
> diff --git a/fs/xfs/xfs_pnfs.c b/fs/xfs/xfs_pnfs.c
> index 7ce1ea11fc3f3..d6334abbc0b3e 100644
> --- a/fs/xfs/xfs_pnfs.c
> +++ b/fs/xfs/xfs_pnfs.c
> @@ -155,7 +155,7 @@ xfs_fs_map_blocks(
>  		xfs_iunlock(ip, lock_flags);
>  
>  		error = xfs_iomap_write_direct(ip, offset_fsb,
> -				end_fsb - offset_fsb, &imap);
> +				end_fsb - offset_fsb, 0, &imap);
>  		if (error)
>  			goto out_unlock;
>  
> diff --git a/include/linux/iomap.h b/include/linux/iomap.h
> index 6d1b08d0ae930..5b9432f9f79eb 100644
> --- a/include/linux/iomap.h
> +++ b/include/linux/iomap.h
> @@ -141,6 +141,11 @@ struct iomap_page_ops {
>  #define IOMAP_NOWAIT		(1 << 5) /* do not block */
>  #define IOMAP_OVERWRITE_ONLY	(1 << 6) /* only pure overwrites allowed */
>  #define IOMAP_UNSHARE		(1 << 7) /* unshare_file_range */
> +#ifdef CONFIG_FS_DAX
> +#define IOMAP_DAX		(1 << 8) /* DAX mapping */
> +#else
> +#define IOMAP_DAX		0
> +#endif /* CONFIG_FS_DAX */
>  
>  struct iomap_ops {
>  	/*
> -- 
> 2.30.2
> 

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


  reply	other threads:[~2021-11-30 19:02 UTC|newest]

Thread overview: 144+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 10:21 decouple DAX from block devices v2 Christoph Hellwig
2021-11-29 10:21 ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21 ` Christoph Hellwig
2021-11-29 10:21 ` Christoph Hellwig
2021-11-29 10:21 ` [PATCH 01/29] dm: fix alloc_dax error handling in alloc_dev Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21 ` [PATCH 02/29] dm: make the DAX support depend on CONFIG_FS_DAX Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21 ` [PATCH 03/29] dax: remove CONFIG_DAX_DRIVER Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21 ` [PATCH 04/29] dax: simplify the dax_device <-> gendisk association Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-30 17:26   ` Darrick J. Wong
2021-11-30 17:26     ` [dm-devel] " Darrick J. Wong
2021-11-30 17:26     ` Darrick J. Wong
2021-11-29 10:21 ` [PATCH 05/29] dax: remove the pgmap sanity checks in generic_fsdax_supported Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-30 18:50   ` Darrick J. Wong
2021-11-30 18:50     ` [dm-devel] " Darrick J. Wong
2021-11-30 18:50     ` Darrick J. Wong
2021-11-29 10:21 ` [PATCH 06/29] dax: move the partition alignment check into fs_dax_get_by_bdev Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-30 18:51   ` Darrick J. Wong
2021-11-30 18:51     ` [dm-devel] " Darrick J. Wong
2021-11-30 18:51     ` Darrick J. Wong
2021-11-29 10:21 ` [PATCH 07/29] xfs: factor out a xfs_setup_dax_always helper Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21 ` [PATCH 08/29] dax: remove dax_capable Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21 ` [PATCH 09/29] dm-linear: add a linear_dax_pgoff helper Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21 ` [PATCH 10/29] dm-log-writes: add a log_writes_dax_pgoff helper Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21 ` [PATCH 11/29] dm-stripe: add a stripe_dax_pgoff helper Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21 ` [PATCH 12/29] fsdax: remove a pointless __force cast in copy_cow_page_dax Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21 ` [PATCH 13/29] fsdax: use a saner calling convention for copy_cow_page_dax Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21 ` [PATCH 14/29] fsdax: simplify the pgoff calculation Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21 ` [PATCH 15/29] xfs: add xfs_zero_range and xfs_truncate_page helpers Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21 ` [PATCH 16/29] fsdax: simplify the offset check in dax_iomap_zero Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21 ` [PATCH 17/29] fsdax: factor out a dax_memzero helper Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21 ` [PATCH 18/29] fsdax: decouple zeroing from the iomap buffered I/O code Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-30 18:53   ` Darrick J. Wong
2021-11-30 18:53     ` [dm-devel] " Darrick J. Wong
2021-11-30 18:53     ` Darrick J. Wong
2021-11-29 10:21 ` [PATCH 19/29] ext2: cleanup the dax handling in ext2_fill_super Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21 ` [PATCH 20/29] ext4: cleanup the dax handling in ext4_fill_super Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21 ` [PATCH 21/29] xfs: move dax device handling into xfs_{alloc,free}_buftarg Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] [PATCH 21/29] xfs: move dax device handling into xfs_{alloc, free}_buftarg Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21 ` [PATCH 22/29] xfs: use xfs_direct_write_iomap_ops for DAX zeroing Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21 ` [PATCH 23/29] xfs: pass the mapping flags to xfs_bmbt_to_iomap Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-30 18:59   ` Darrick J. Wong
2021-11-30 18:59     ` [dm-devel] " Darrick J. Wong
2021-11-30 18:59     ` Darrick J. Wong
2021-11-29 10:21 ` [PATCH 24/29] iomap: add a IOMAP_DAX flag Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-30 19:02   ` Darrick J. Wong [this message]
2021-11-30 19:02     ` [dm-devel] " Darrick J. Wong
2021-11-30 19:02     ` Darrick J. Wong
2021-11-29 10:21 ` [PATCH 25/29] dax: return the partition offset from fs_dax_get_by_bdev Christoph Hellwig
2021-11-29 10:21   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-29 10:21   ` Christoph Hellwig
2021-11-30 19:04   ` Darrick J. Wong
2021-11-30 19:04     ` [dm-devel] " Darrick J. Wong
2021-11-30 19:04     ` Darrick J. Wong
2021-11-29 10:22 ` [PATCH 26/29] fsdax: shift partition offset handling into the file systems Christoph Hellwig
2021-11-29 10:22   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:22   ` Christoph Hellwig
2021-11-29 10:22   ` Christoph Hellwig
2021-11-30 19:06   ` Darrick J. Wong
2021-11-30 19:06     ` [dm-devel] " Darrick J. Wong
2021-11-30 19:06     ` Darrick J. Wong
2021-11-29 10:22 ` [PATCH 27/29] dax: fix up some of the block device related ifdefs Christoph Hellwig
2021-11-29 10:22   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:22   ` Christoph Hellwig
2021-11-29 10:22   ` Christoph Hellwig
2021-11-29 10:22 ` [PATCH 28/29] iomap: build the block based code conditionally Christoph Hellwig
2021-11-29 10:22   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:22   ` Christoph Hellwig
2021-11-29 10:22   ` Christoph Hellwig
2021-11-29 10:22 ` [PATCH 29/29] fsdax: don't require CONFIG_BLOCK Christoph Hellwig
2021-11-29 10:22   ` [dm-devel] " Christoph Hellwig
2021-11-29 10:22   ` Christoph Hellwig
2021-11-29 10:22   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211130190224.GH8467@magnolia \
    --to=djwong@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=dm-devel@redhat.com \
    --cc=hch@lst.de \
    --cc=ira.weiny@intel.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=snitzer@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.