Re: [PATCH v2 8/8] xfs: remove restrictions for fsdax and reflink

2022-12-01 Thread Darrick J. Wong
On Thu, Dec 01, 2022 at 03:32:53PM +, Shiyang Ruan wrote: > Since the basic function for fsdax and reflink has been implemented, > remove the restrictions of them for widly test. > > Signed-off-by: Shiyang Ruan Looks ok, Reviewed-by: Darrick J. Wong --D > --- > fs/xfs/xfs_ioctl.c | 4

Re: [PATCH v2 3/8] fsdax: zero the edges if source is HOLE or UNWRITTEN

2022-12-01 Thread Darrick J. Wong
On Thu, Dec 01, 2022 at 03:28:53PM +, Shiyang Ruan wrote: > If srcmap contains invalid data, such as HOLE and UNWRITTEN, the dest > page should be zeroed. Otherwise, since it's a pmem, old data may > remains on the dest page, the result of CoW will be incorrect. > > The function name is also

Re: [PATCH v2 3/8] fsdax: zero the edges if source is HOLE or UNWRITTEN

2022-12-01 Thread Andrew Morton
On Thu, 1 Dec 2022 15:58:11 -0800 "Darrick J. Wong" wrote: > > --- a/fs/dax.c > > +++ b/fs/dax.c > > @@ -1092,7 +1092,7 @@ static int dax_iomap_direct_access(const struct iomap > > *iomap, loff_t pos, > > } > > > > /** > > - * dax_iomap_cow_copy - Copy the data from source to destination

Re: [PATCH v2 4/8] fsdax,xfs: set the shared flag when file extent is shared

2022-12-01 Thread Darrick J. Wong
On Thu, Dec 01, 2022 at 03:28:54PM +, Shiyang Ruan wrote: > If a dax page is shared, mapread at different offsets can also trigger > page fault on same dax page. So, change the flag from "cow" to > "shared". And get the shared flag from filesystem when read. > > Signed-off-by: Shiyang Ruan

Re: [PATCH v2 5/8] fsdax: dedupe: iter two files at the same time

2022-12-01 Thread Darrick J. Wong
On Thu, Dec 01, 2022 at 03:31:41PM +, Shiyang Ruan wrote: > The iomap_iter() on a range of one file may loop more than once. In > this case, the inner dst_iter can update its iomap but the outer > src_iter can't. This may cause the wrong remapping in filesystem. Let > them called at the

Re: [PATCH v2 6/8] xfs: use dax ops for zero and truncate in fsdax mode

2022-12-01 Thread Darrick J. Wong
On Thu, Dec 01, 2022 at 03:32:10PM +, Shiyang Ruan wrote: > Zero and truncate on a dax file may execute CoW. So use dax ops which > contains end work for CoW. > > Signed-off-by: Shiyang Ruan LGTM Reviewed-by: Darrick J. Wong --D > --- > fs/xfs/xfs_iomap.c | 4 ++-- > 1 file changed, 2

[PATCH v2 0/8] fsdax,xfs: fix warning messages

2022-12-01 Thread Shiyang Ruan
Changes since v1: 1. Added a snippet of the warning message and some of the failed cases 2. Separated the patch for easily review 3. Added page->share and its helper functions 4. Included the patch[1] that removes the restrictions of fsdax and reflink [1]

Re: [PATCH v2 1/8] fsdax: introduce page->share for fsdax in reflink mode

2022-12-01 Thread Darrick J. Wong
On Thu, Dec 01, 2022 at 03:28:51PM +, Shiyang Ruan wrote: > fsdax page is used not only when CoW, but also mapread. To make the it > easily understood, use 'share' to indicate that the dax page is shared > by more than one extent. And add helper functions to use it. > > Also, the flag needs

Re: [PATCH v2 2/8] fsdax: invalidate pages when CoW

2022-12-01 Thread Darrick J. Wong
On Thu, Dec 01, 2022 at 03:28:52PM +, Shiyang Ruan wrote: > CoW changes the share state of a dax page, but the share count of the > page isn't updated. The next time access this page, it should have been > a newly accessed, but old association exists. So, we need to clear the > share state

[PATCH v2 5/8] fsdax: dedupe: iter two files at the same time

2022-12-01 Thread Shiyang Ruan
The iomap_iter() on a range of one file may loop more than once. In this case, the inner dst_iter can update its iomap but the outer src_iter can't. This may cause the wrong remapping in filesystem. Let them called at the same time. Signed-off-by: Shiyang Ruan --- fs/dax.c | 16

[PATCH v2 6/8] xfs: use dax ops for zero and truncate in fsdax mode

2022-12-01 Thread Shiyang Ruan
Zero and truncate on a dax file may execute CoW. So use dax ops which contains end work for CoW. Signed-off-by: Shiyang Ruan --- fs/xfs/xfs_iomap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 881de99766ca..d9401d0300ad

[PATCH v2 7/8] fsdax,xfs: port unshare to fsdax

2022-12-01 Thread Shiyang Ruan
Implement unshare in fsdax mode: copy data from srcmap to iomap. Signed-off-by: Shiyang Ruan Reviewed-by: Darrick J. Wong --- fs/dax.c | 52 fs/xfs/xfs_reflink.c | 8 +-- include/linux/dax.h | 2 ++ 3 files changed, 60

[PATCH v2 8/8] xfs: remove restrictions for fsdax and reflink

2022-12-01 Thread Shiyang Ruan
Since the basic function for fsdax and reflink has been implemented, remove the restrictions of them for widly test. Signed-off-by: Shiyang Ruan --- fs/xfs/xfs_ioctl.c | 4 fs/xfs/xfs_iops.c | 4 2 files changed, 8 deletions(-) diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c

[PATCH v2 3/8] fsdax: zero the edges if source is HOLE or UNWRITTEN

2022-12-01 Thread Shiyang Ruan
If srcmap contains invalid data, such as HOLE and UNWRITTEN, the dest page should be zeroed. Otherwise, since it's a pmem, old data may remains on the dest page, the result of CoW will be incorrect. The function name is also not easy to understand, rename it to "dax_iomap_copy_around()", which

[PATCH v2 1/8] fsdax: introduce page->share for fsdax in reflink mode

2022-12-01 Thread Shiyang Ruan
fsdax page is used not only when CoW, but also mapread. To make the it easily understood, use 'share' to indicate that the dax page is shared by more than one extent. And add helper functions to use it. Also, the flag needs to be renamed to PAGE_MAPPING_DAX_SHARED. Signed-off-by: Shiyang Ruan

[PATCH v2 2/8] fsdax: invalidate pages when CoW

2022-12-01 Thread Shiyang Ruan
CoW changes the share state of a dax page, but the share count of the page isn't updated. The next time access this page, it should have been a newly accessed, but old association exists. So, we need to clear the share state when CoW happens, in both dax_iomap_rw() and dax_zero_iter().

[PATCH v2 4/8] fsdax,xfs: set the shared flag when file extent is shared

2022-12-01 Thread Shiyang Ruan
If a dax page is shared, mapread at different offsets can also trigger page fault on same dax page. So, change the flag from "cow" to "shared". And get the shared flag from filesystem when read. Signed-off-by: Shiyang Ruan --- fs/dax.c | 19 +++ fs/xfs/xfs_iomap.c |

Re: [PATCH 0/2] fsdax,xfs: fix warning messages

2022-12-01 Thread Shiyang Ruan
在 2022/12/1 5:08, Darrick J. Wong 写道: On Tue, Nov 29, 2022 at 11:05:30PM -0800, Dan Williams wrote: Darrick J. Wong wrote: On Tue, Nov 29, 2022 at 07:59:14PM -0800, Dan Williams wrote: [ add Andrew ] Shiyang Ruan wrote: Many testcases failed in dax+reflink mode with warning message in

Re: [PATCH 0/2] fsdax,xfs: fix warning messages

2022-12-01 Thread Darrick J. Wong
On Thu, Dec 01, 2022 at 11:39:12PM +0800, Shiyang Ruan wrote: > > > 在 2022/12/1 5:08, Darrick J. Wong 写道: > > On Tue, Nov 29, 2022 at 11:05:30PM -0800, Dan Williams wrote: > > > Darrick J. Wong wrote: > > > > On Tue, Nov 29, 2022 at 07:59:14PM -0800, Dan Williams wrote: > > > > > [ add Andrew ]