Re: [PATCH v9 8/8] xfs: Add dax dedupe support

2021-09-15 Thread Darrick J. Wong
On Thu, Sep 16, 2021 at 12:01:18PM +0800, Shiyang Ruan wrote: > > > On 2021/9/16 8:30, Darrick J. Wong wrote: > > On Wed, Sep 15, 2021 at 06:45:01PM +0800, Shiyang Ruan wrote: > > > Introduce xfs_mmaplock_two_inodes_and_break_dax_layout() for dax files > > > who are going to be deduped. After

Re: [PATCH v9 8/8] xfs: Add dax dedupe support

2021-09-15 Thread Shiyang Ruan
On 2021/9/16 8:30, Darrick J. Wong wrote: On Wed, Sep 15, 2021 at 06:45:01PM +0800, Shiyang Ruan wrote: Introduce xfs_mmaplock_two_inodes_and_break_dax_layout() for dax files who are going to be deduped. After that, call compare range function only when files are both DAX or not.

Re: [PATCH v9 1/8] fsdax: Output address in dax_iomap_pfn() and rename it

2021-09-15 Thread Shiyang Ruan
On 2021/9/16 8:09, Darrick J. Wong wrote: On Wed, Sep 15, 2021 at 06:44:54PM +0800, Shiyang Ruan wrote: Add address output in dax_iomap_pfn() in order to perform a memcpy() in CoW case. Since this function both output address and pfn, rename it to dax_iomap_direct_access(). Signed-off-by:

Re: [PATCH v9 8/8] xfs: Add dax dedupe support

2021-09-15 Thread Darrick J. Wong
On Wed, Sep 15, 2021 at 06:45:01PM +0800, Shiyang Ruan wrote: > Introduce xfs_mmaplock_two_inodes_and_break_dax_layout() for dax files > who are going to be deduped. After that, call compare range function > only when files are both DAX or not. > > Signed-off-by: Shiyang Ruan > Reviewed-by:

Re: [PATCH v9 7/8] xfs: support CoW in fsdax mode

2021-09-15 Thread Darrick J. Wong
On Wed, Sep 15, 2021 at 06:45:00PM +0800, Shiyang Ruan wrote: > In fsdax mode, WRITE and ZERO on a shared extent need CoW performed. > After that, new allocated extents needs to be remapped to the file. > So, add a CoW identification in ->iomap_begin(), and implement > ->iomap_end() to do the

Re: [PATCH v9 4/8] fsdax: Convert dax_iomap_zero to iter model

2021-09-15 Thread Darrick J. Wong
On Wed, Sep 15, 2021 at 06:44:57PM +0800, Shiyang Ruan wrote: > Let dax_iomap_zero() support iter model. > > Signed-off-by: Shiyang Ruan Oops, I guess we forgot this one when we did the iter conversion last cycle. :( Reviewed-by: Darrick J. Wong --D > --- > fs/dax.c | 3 ++- >

Re: [PATCH v9 1/8] fsdax: Output address in dax_iomap_pfn() and rename it

2021-09-15 Thread Darrick J. Wong
On Wed, Sep 15, 2021 at 06:44:54PM +0800, Shiyang Ruan wrote: > Add address output in dax_iomap_pfn() in order to perform a memcpy() in > CoW case. Since this function both output address and pfn, rename it to > dax_iomap_direct_access(). > > Signed-off-by: Shiyang Ruan > Reviewed-by: Christoph

Re: [PATCH 0/3] dax: clear poison on the fly along pwrite

2021-09-15 Thread Darrick J. Wong
On Wed, Sep 15, 2021 at 01:27:47PM -0700, Dan Williams wrote: > On Wed, Sep 15, 2021 at 9:15 AM Darrick J. Wong wrote: > > > > On Wed, Sep 15, 2021 at 12:22:05AM -0700, Jane Chu wrote: > > > Hi, Dan, > > > > > > On 9/14/2021 9:44 PM, Dan Williams wrote: > > > > On Tue, Sep 14, 2021 at 4:32 PM

Re: [PATCH 0/3] dax: clear poison on the fly along pwrite

2021-09-15 Thread Dan Williams
On Wed, Sep 15, 2021 at 9:15 AM Darrick J. Wong wrote: > > On Wed, Sep 15, 2021 at 12:22:05AM -0700, Jane Chu wrote: > > Hi, Dan, > > > > On 9/14/2021 9:44 PM, Dan Williams wrote: > > > On Tue, Sep 14, 2021 at 4:32 PM Jane Chu wrote: > > > > > > > > If pwrite(2) encounters poison in a pmem

Re: [PATCH v2] device-dax: use fallback nid when numa node is invalid

2021-09-15 Thread Dan Williams
On Tue, Sep 14, 2021 at 11:51 PM Justin He wrote: [..] > > > diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c > > > index fb775b967c52..d3a0cec635b1 100644 > > > --- a/drivers/acpi/nfit/core.c > > > +++ b/drivers/acpi/nfit/core.c > > > @@ -3005,15 +3005,8 @@ static int

Re: [PATCH 0/3] dax: clear poison on the fly along pwrite

2021-09-15 Thread Darrick J. Wong
On Wed, Sep 15, 2021 at 12:22:05AM -0700, Jane Chu wrote: > Hi, Dan, > > On 9/14/2021 9:44 PM, Dan Williams wrote: > > On Tue, Sep 14, 2021 at 4:32 PM Jane Chu wrote: > > > > > > If pwrite(2) encounters poison in a pmem range, it fails with EIO. > > > This is unecessary if hardware is capable

[PATCH v9 2/8] fsdax: Introduce dax_iomap_cow_copy()

2021-09-15 Thread Shiyang Ruan
In the case where the iomap is a write operation and iomap is not equal to srcmap after iomap_begin, we consider it is a CoW operation. In this case, the destination (iomap->addr) points to a newly allocated extent. It is needed to copy the data from srcmap to the extent. In theory, it is

[PATCH v9 0/8] fsdax,xfs: Add reflink support for fsdax

2021-09-15 Thread Shiyang Ruan
This patchset is attempt to add CoW support for fsdax, and take XFS, which has both reflink and fsdax feature, as an example. Changes from V8: - Rebased on v5.15-rc1 - Patch 4: Add a pre patch to convert dax_iomap_zero to iter model[1] - Patch 6&7: Remove EXPORT_SYMBOL - Patch 8: Solve the

[PATCH v9 1/8] fsdax: Output address in dax_iomap_pfn() and rename it

2021-09-15 Thread Shiyang Ruan
Add address output in dax_iomap_pfn() in order to perform a memcpy() in CoW case. Since this function both output address and pfn, rename it to dax_iomap_direct_access(). Signed-off-by: Shiyang Ruan Reviewed-by: Christoph Hellwig Reviewed-by: Ritesh Harjani Reviewed-by: Dan Williams ---

[PATCH v9 7/8] xfs: support CoW in fsdax mode

2021-09-15 Thread Shiyang Ruan
In fsdax mode, WRITE and ZERO on a shared extent need CoW performed. After that, new allocated extents needs to be remapped to the file. So, add a CoW identification in ->iomap_begin(), and implement ->iomap_end() to do the remapping work. Signed-off-by: Shiyang Ruan --- fs/xfs/xfs_bmap_util.c

[PATCH v9 8/8] xfs: Add dax dedupe support

2021-09-15 Thread Shiyang Ruan
Introduce xfs_mmaplock_two_inodes_and_break_dax_layout() for dax files who are going to be deduped. After that, call compare range function only when files are both DAX or not. Signed-off-by: Shiyang Ruan Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/xfs/xfs_file.c|

[PATCH v9 6/8] fsdax: Dedup file range to use a compare function

2021-09-15 Thread Shiyang Ruan
With dax we cannot deal with readpage() etc. So, we create a dax comparison function which is similar with vfs_dedupe_file_range_compare(). And introduce dax_remap_file_range_prep() for filesystem use. Signed-off-by: Goldwyn Rodrigues Signed-off-by: Shiyang Ruan Reviewed-by: Darrick J. Wong

[PATCH v9 5/8] fsdax: Add dax_iomap_cow_copy() for dax_iomap_zero

2021-09-15 Thread Shiyang Ruan
Punch hole on a reflinked file needs dax_iomap_cow_copy() too. Otherwise, data in not aligned area will be not correct. So, add the CoW operation for not aligned case in dax_iomap_zero(). Signed-off-by: Shiyang Ruan Reviewed-by: Ritesh Harjani Reviewed-by: Darrick J. Wong --- fs/dax.c | 27

[PATCH v9 4/8] fsdax: Convert dax_iomap_zero to iter model

2021-09-15 Thread Shiyang Ruan
Let dax_iomap_zero() support iter model. Signed-off-by: Shiyang Ruan --- fs/dax.c | 3 ++- fs/iomap/buffered-io.c | 3 +-- include/linux/dax.h| 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 41c93929f20b..4f346e25e488 100644 ---

[PATCH v9 3/8] fsdax: Replace mmap entry in case of CoW

2021-09-15 Thread Shiyang Ruan
Replace the existing entry to the newly allocated one in case of CoW. Also, we mark the entry as PAGECACHE_TAG_TOWRITE so writeback marks this entry as writeprotected. This helps us snapshots so new write pagefaults after snapshots trigger a CoW. Signed-off-by: Goldwyn Rodrigues Signed-off-by:

Re: [PATCH 0/3] dax: clear poison on the fly along pwrite

2021-09-15 Thread Jane Chu
Hi, Dan, On 9/14/2021 9:44 PM, Dan Williams wrote: On Tue, Sep 14, 2021 at 4:32 PM Jane Chu wrote: If pwrite(2) encounters poison in a pmem range, it fails with EIO. This is unecessary if hardware is capable of clearing the poison. Though not all dax backend hardware has the capability of

RE: [PATCH v2] device-dax: use fallback nid when numa node is invalid

2021-09-15 Thread Justin He
> -Original Message- > From: Dan Williams > Sent: Wednesday, September 15, 2021 1:16 PM > To: Justin He > Cc: Vishal Verma ; Dave Jiang > ; David Hildenbrand ; Linux NVDIMM > ; Linux Kernel Mailing List ker...@vger.kernel.org>; nd > Subject: Re: [PATCH v2] device-dax: use fallback