[PATCH v6 7/7] fs/xfs: Add dax dedupe support

2021-05-19 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 --- fs/xfs/xfs_file.c| 2 +- fs/xfs/xfs_inode.c | 57

[PATCH v6 6/7] fs/xfs: Handle CoW for fsdax write() path

2021-05-19 Thread Shiyang Ruan
In fsdax mode, WRITE and ZERO on a shared extent need CoW performed. After CoW, new allocated extents needs to be remapped to the file. So, add an iomap_end for dax write ops to do the remapping work. Signed-off-by: Shiyang Ruan --- fs/xfs/xfs_bmap_util.c | 3 +-- fs/xfs/xfs_file.c | 9

[PATCH v6 4/7] iomap: Introduce iomap_apply2() for operations on two files

2021-05-19 Thread Shiyang Ruan
Some operations, such as comparing a range of data in two files under fsdax mode, requires nested iomap_open()/iomap_end() on two file. Thus, we introduce iomap_apply2() to accept arguments from two files and iomap_actor2_t for actions on two files. Signed-off-by: Shiyang Ruan Reviewed

[PATCH v6 5/7] fsdax: Dedup file range to use a compare function

2021-05-19 Thread Shiyang Ruan
With dax we cannot deal with readpage() etc. So, we create a dax comparison funciton 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 --- fs/dax.c | 66

[PATCH v6 3/7] fsdax: Add dax_iomap_cow_copy() for dax_iomap_zero

2021-05-19 Thread Shiyang Ruan
Punch hole on a reflinked file needs dax_copy_edge() too. Otherwise, data in not aligned area will be not correct. So, add the srcmap to dax_iomap_zero() and replace memset() as dax_copy_edge(). Signed-off-by: Shiyang Ruan Reviewed-by: Ritesh Harjani --- fs/dax.c | 25

[PATCH v6 2/7] fsdax: Replace mmap entry in case of CoW

2021-05-19 Thread Shiyang Ruan
-by: Shiyang Ruan Reviewed-by: Christoph Hellwig Reviewed-by: Ritesh Harjani Reviewed-by: Darrick J. Wong --- fs/dax.c | 39 --- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 6396f091e60b..98531c53d613 100644 --- a/fs

[PATCH v6 1/7] fsdax: Introduce dax_iomap_cow_copy()

2021-05-19 Thread Shiyang Ruan
to copy the head and tail ranges which is outside of the non-aligned area instead of copying the whole aligned range. But in dax page fault, it will always be an aligned range. So, we have to copy the whole range in this case. Signed-off-by: Shiyang Ruan Reviewed-by: Christoph Hellwig Reviewed

[PATCH v6 0/7] fsdax,xfs: Add reflink support for fsdax

2021-05-19 Thread Shiyang Ruan
to adapt to this patchset. (Rebased on v5.13-rc2 and patchset[1]) [1]: https://lkml.org/lkml/2021/4/22/575 Shiyang Ruan (7): fsdax: Introduce dax_iomap_cow_copy() fsdax: Replace mmap entry in case of CoW fsdax: Add dax_iomap_cow_copy() for dax_iomap_zero iomap: Introduce iomap_apply2

[PATCH v5 7/7] fs/xfs: Add dax dedupe support

2021-05-10 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 --- fs/xfs/xfs_file.c| 2 +- fs/xfs/xfs_inode.c | 66

[PATCH v5 6/7] fs/xfs: Handle CoW for fsdax write() path

2021-05-10 Thread Shiyang Ruan
In fsdax mode, WRITE and ZERO on a shared extent need CoW performed. After CoW, new allocated extents needs to be remapped to the file. So, add an iomap_end for dax write ops to do the remapping work. Signed-off-by: Shiyang Ruan --- fs/xfs/xfs_bmap_util.c | 3 +-- fs/xfs/xfs_file.c | 9

[PATCH v5 5/7] fsdax: Dedup file range to use a compare function

2021-05-10 Thread Shiyang Ruan
With dax we cannot deal with readpage() etc. So, we create a dax comparison funciton 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 --- fs/dax.c | 56

[PATCH v5 4/7] iomap: Introduce iomap_apply2() for operations on two files

2021-05-10 Thread Shiyang Ruan
Some operations, such as comparing a range of data in two files under fsdax mode, requires nested iomap_open()/iomap_end() on two file. Thus, we introduce iomap_apply2() to accept arguments from two files and iomap_actor2_t for actions on two files. Signed-off-by: Shiyang Ruan Reviewed

[PATCH v5 3/7] fsdax: Add dax_iomap_cow_copy() for dax_iomap_zero

2021-05-10 Thread Shiyang Ruan
Punch hole on a reflinked file needs dax_copy_edge() too. Otherwise, data in not aligned area will be not correct. So, add the srcmap to dax_iomap_zero() and replace memset() as dax_copy_edge(). Signed-off-by: Shiyang Ruan Reviewed-by: Ritesh Harjani --- fs/dax.c | 25

[PATCH v5 2/7] fsdax: Replace mmap entry in case of CoW

2021-05-10 Thread Shiyang Ruan
-by: Shiyang Ruan Reviewed-by: Christoph Hellwig Reviewed-by: Ritesh Harjani --- fs/dax.c | 39 --- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index f0249bb1d46a..ef0e564e7904 100644 --- a/fs/dax.c +++ b/fs/dax.c

[PATCH v5 1/7] fsdax: Introduce dax_iomap_cow_copy()

2021-05-10 Thread Shiyang Ruan
to copy the head and tail ranges which is outside of the non-aligned area instead of copying the whole aligned range. But in dax page fault, it will always be an aligned range. So, we have to copy the whole range in this case. Signed-off-by: Shiyang Ruan Reviewed-by: Christoph Hellwig --- fs

[PATCH v5 0/7] fsdax,xfs: Add reflink support for fsdax

2021-05-10 Thread Shiyang Ruan
to adapt to this patchset. (Rebased on v5.13-rc1 and patchset[1]) [1]: https://lkml.org/lkml/2021/4/22/575 Shiyang Ruan (7): fsdax: Introduce dax_iomap_cow_copy() fsdax: Replace mmap entry in case of CoW fsdax: Add dax_iomap_cow_copy() for dax_iomap_zero iomap: Introduce iomap_apply2

[PATCH v3 3/3] fsdax: Output address in dax_iomap_pfn() and rename it

2021-04-22 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 --- fs/dax.c | 16

[PATCH v3 1/3] fsdax: Factor helpers to simplify dax fault code

2021-04-22 Thread Shiyang Ruan
The dax page fault code is too long and a bit difficult to read. And it is hard to understand when we trying to add new features. Some of the PTE/PMD codes have similar logic. So, factor them as helper functions to simplify the code. Signed-off-by: Shiyang Ruan Reviewed-by: Christoph Hellwig

[PATCH v3 2/3] fsdax: Factor helper: dax_fault_actor()

2021-04-22 Thread Shiyang Ruan
The core logic in the two dax page fault functions is similar. So, move the logic into a common helper function. Also, to facilitate the addition of new features, such as CoW, switch-case is no longer used to handle different iomap types. Signed-off-by: Shiyang Ruan Reviewed-by: Christoph

[PATCH v3 0/3] fsdax: Factor helper functions to simplify the code

2021-04-22 Thread Shiyang Ruan
From: Shiyang Ruan The page fault part of fsdax code is little complex. In order to add CoW feature and make it easy to understand, I was suggested to factor some helper functions to simplify the current dax code. This is separated from the previous patchset called "V3 fsdax,xfs: Add re

[PATCH v4 7/7] fs/xfs: Add dedupe support for fsdax

2021-04-08 Thread Shiyang Ruan
Add xfs_break_two_dax_layouts() to break layout for tow dax files. Then call compare range function only when files are both DAX or not. Signed-off-by: Shiyang Ruan --- fs/xfs/xfs_file.c| 20 fs/xfs/xfs_inode.c | 8 +++- fs/xfs/xfs_inode.h | 1 + fs/xfs

[PATCH v4 6/7] fs/xfs: Handle CoW for fsdax write() path

2021-04-08 Thread Shiyang Ruan
In fsdax mode, WRITE and ZERO on a shared extent need CoW performed. After CoW, new allocated extents needs to be remapped to the file. So, add an iomap_end for dax write ops to do the remapping work. Signed-off-by: Shiyang Ruan --- fs/xfs/xfs_bmap_util.c | 3 +-- fs/xfs/xfs_file.c | 9

[PATCH v4 5/7] fsdax: Dedup file range to use a compare function

2021-04-08 Thread Shiyang Ruan
With dax we cannot deal with readpage() etc. So, we create a dax comparison funciton 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 --- fs/dax.c | 56

[PATCH v4 4/7] iomap: Introduce iomap_apply2() for operations on two files

2021-04-08 Thread Shiyang Ruan
Some operations, such as comparing a range of data in two files under fsdax mode, requires nested iomap_open()/iomap_end() on two file. Thus, we introduce iomap_apply2() to accept arguments from two files and iomap_actor2_t for actions on two files. Signed-off-by: Shiyang Ruan --- fs/iomap

[PATCH v4 3/7] fsdax: Add dax_iomap_cow_copy() for dax_iomap_zero

2021-04-08 Thread Shiyang Ruan
Punch hole on a reflinked file needs dax_copy_edge() too. Otherwise, data in not aligned area will be not correct. So, add the srcmap to dax_iomap_zero() and replace memset() as dax_copy_edge(). Signed-off-by: Shiyang Ruan Reviewed-by: Ritesh Harjani --- fs/dax.c | 25

[PATCH v4 2/7] fsdax: Replace mmap entry in case of CoW

2021-04-08 Thread Shiyang Ruan
-by: Shiyang Ruan Reviewed-by: Christoph Hellwig Reviewed-by: Ritesh Harjani --- fs/dax.c | 39 --- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index b4fd3813457a..e6c1354b27a8 100644 --- a/fs/dax.c +++ b/fs/dax.c

[PATCH v4 1/7] fsdax: Introduce dax_iomap_cow_copy()

2021-04-08 Thread Shiyang Ruan
to copy the head and tail ranges which is outside of the non-aligned area instead of copying the whole aligned range. But in dax page fault, it will always be an aligned range. So, we have to copy the whole range in this case. Signed-off-by: Shiyang Ruan Reviewed-by: Christoph Hellwig --- fs

[PATCH v4 0/7] fsdax,xfs: Add reflink support for fsdax

2021-04-08 Thread Shiyang Ruan
/20210407133823.828176-1-ruansy.f...@fujitsu.com/ == Shiyang Ruan (7): fsdax: Introduce dax_iomap_cow_copy() fsdax: Replace mmap entry in case of CoW fsdax: Add dax_iomap_cow_copy() for dax_iomap_zero iomap: Introduce iomap_apply2() for operations on two files fsdax: Dedup file range to use

[PATCH v2 3/3] fsdax: Output address in dax_iomap_pfn() and rename it

2021-04-07 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 --- fs/dax.c | 16

[PATCH v2 2/3] fsdax: Factor helper: dax_fault_actor()

2021-04-07 Thread Shiyang Ruan
The core logic in the two dax page fault functions is similar. So, move the logic into a common helper function. Also, to facilitate the addition of new features, such as CoW, switch-case is no longer used to handle different iomap types. Signed-off-by: Shiyang Ruan Reviewed-by: Christoph

[PATCH v2 0/3] fsdax: Factor helper functions to simplify the code

2021-04-07 Thread Shiyang Ruan
fsdax", and the previous comments are here[1]. [1]: https://patchwork.kernel.org/project/linux-nvdimm/patch/20210319015237.993880-3-ruansy.f...@fujitsu.com/ Changes from V1: - fix Ritesh's email address - simplify return logic in dax_fault_cow_page() (Rebased on v5.12-rc5) == Shiyang Ruan (3

[PATCH v2 1/3] fsdax: Factor helpers to simplify dax fault code

2021-04-07 Thread Shiyang Ruan
The dax page fault code is too long and a bit difficult to read. And it is hard to understand when we trying to add new features. Some of the PTE/PMD codes have similar logic. So, factor them as helper functions to simplify the code. Signed-off-by: Shiyang Ruan Reviewed-by: Christoph Hellwig

[PATCH 3/3] fsdax: Output address in dax_iomap_pfn() and rename it

2021-04-07 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 --- fs/dax.c | 16

[PATCH 2/3] fsdax: Factor helper: dax_fault_actor()

2021-04-07 Thread Shiyang Ruan
The core logic in the two dax page fault functions is similar. So, move the logic into a common helper function. Also, to facilitate the addition of new features, such as CoW, switch-case is no longer used to handle different iomap types. Signed-off-by: Shiyang Ruan Reviewed-by: Christoph

[PATCH 1/3] fsdax: Factor helpers to simplify dax fault code

2021-04-07 Thread Shiyang Ruan
The dax page fault code is too long and a bit difficult to read. And it is hard to understand when we trying to add new features. Some of the PTE/PMD codes have similar logic. So, factor them as helper functions to simplify the code. Signed-off-by: Shiyang Ruan Reviewed-by: Christoph Hellwig

[PATCH 0/3] fsdax: Factor helper functions to simplify the code

2021-04-07 Thread Shiyang Ruan
The page fault part of fsdax code is little complex. In order to add CoW feature and make it easy to understand, I was suggested to factor some helper functions to simplify the current dax code. (Rebased on v5.12-rc5) == Shiyang Ruan (3): fsdax: Factor helpers to simplify dax fault code

[PATCH v3 10/10] fs/xfs: Add dedupe support for fsdax

2021-03-18 Thread Shiyang Ruan
Add xfs_break_two_dax_layouts() to break layout for tow dax files. Then call compare range function only when files are both DAX or not. Signed-off-by: Shiyang Ruan --- fs/xfs/xfs_file.c| 20 fs/xfs/xfs_inode.c | 8 +++- fs/xfs/xfs_inode.h | 1 + fs/xfs

[PATCH v3 09/10] fs/xfs: Handle CoW for fsdax write() path

2021-03-18 Thread Shiyang Ruan
In fsdax mode, WRITE and ZERO on a shared extent need CoW performed. After CoW, new allocated extents needs to be remapped to the file. So, add an iomap_end for dax write ops to do the remapping work. Signed-off-by: Shiyang Ruan --- fs/xfs/xfs_bmap_util.c | 3 +-- fs/xfs/xfs_file.c | 9

[PATCH v3 08/10] fsdax: Dedup file range to use a compare function

2021-03-18 Thread Shiyang Ruan
With dax we cannot deal with readpage() etc. So, we create a dax comparison funciton 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 --- fs/dax.c | 56

[PATCH v3 07/10] iomap: Introduce iomap_apply2() for operations on two files

2021-03-18 Thread Shiyang Ruan
Some operations, such as comparing a range of data in two files under fsdax mode, requires nested iomap_open()/iomap_end() on two file. Thus, we introduce iomap_apply2() to accept arguments from two files and iomap_actor2_t for actions on two files. Signed-off-by: Shiyang Ruan --- fs/iomap

[PATCH v3 05/10] fsdax: Replace mmap entry in case of CoW

2021-03-18 Thread Shiyang Ruan
-by: Shiyang Ruan Reviewed-by: Christoph Hellwig --- fs/dax.c | 37 ++--- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 181aad97136a..cfe513eb111e 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -722,6 +722,9 @@ static int

[PATCH v3 06/10] fsdax: Add dax_iomap_cow_copy() for dax_iomap_zero

2021-03-18 Thread Shiyang Ruan
Punch hole on a reflinked file needs dax_copy_edge() too. Otherwise, data in not aligned area will be not correct. So, add the srcmap to dax_iomap_zero() and replace memset() as dax_copy_edge(). Signed-off-by: Shiyang Ruan --- fs/dax.c | 9 +++-- fs/iomap/buffered-io.c | 2

[PATCH v3 04/10] fsdax: Introduce dax_iomap_cow_copy()

2021-03-18 Thread Shiyang Ruan
to copy the head and tail ranges which is outside of the non-aligned area instead of copying the whole aligned range. But in dax page fault, it will always be an aligned range. So, we have to copy the whole range in this case. Signed-off-by: Shiyang Ruan Reviewed-by: Christoph Hellwig --- fs

[PATCH v3 03/10] fsdax: Output address in dax_iomap_pfn() and rename it

2021-03-18 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 --- fs/dax.c | 16 1 file changed, 12

[PATCH v3 02/10] fsdax: Factor helper: dax_fault_actor()

2021-03-18 Thread Shiyang Ruan
The core logic in the two dax page fault functions is similar. So, move the logic into a common helper function. Also, to facilitate the addition of new features, such as CoW, switch-case is no longer used to handle different iomap types. Signed-off-by: Shiyang Ruan --- fs/dax.c | 291

[PATCH v3 00/10] fsdax,xfs: Add reflink support for fsdax

2021-03-18 Thread Shiyang Ruan
From: 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 V2: - Fix the mistake in iomap_apply2() and dax_dedupe_file_range_compare() - Add CoW judgement in dax_iomap_zero() - Fix other code

[PATCH v3 01/10] fsdax: Factor helpers to simplify dax fault code

2021-03-18 Thread Shiyang Ruan
The dax page fault code is too long and a bit difficult to read. And it is hard to understand when we trying to add new features. Some of the PTE/PMD codes have similar logic. So, factor them as helper functions to simplify the code. Signed-off-by: Shiyang Ruan Reviewed-by: Christoph Hellwig

[RESEND PATCH v2.1 08/10] fsdax: Dedup file range to use a compare function

2021-03-03 Thread Shiyang Ruan
With dax we cannot deal with readpage() etc. So, we create a dax comparison funciton 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 --- fs/dax.c | 56

[RESEND PATCH v2.1 07/10] iomap: Introduce iomap_apply2() for operations on two files

2021-03-03 Thread Shiyang Ruan
Some operations, such as comparing a range of data in two files under fsdax mode, requires nested iomap_open()/iomap_end() on two file. Thus, we introduce iomap_apply2() to accept arguments from two files and iomap_actor2_t for actions on two files. Signed-off-by: Shiyang Ruan --- fs/iomap

[PATCH v2 08/10] fsdax: Dedup file range to use a compare function

2021-02-26 Thread Shiyang Ruan
With dax we cannot deal with readpage() etc. So, we create a dax comparison funciton 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 --- fs/dax.c | 56

[PATCH v2 07/10] iomap: Introduce iomap_apply2() for operations on two files

2021-02-26 Thread Shiyang Ruan
Some operations, such as comparing a range of data in two files under fsdax mode, requires nested iomap_open()/iomap_end() on two file. Thus, we introduce iomap_apply2() to accept arguments from two files and iomap_actor2_t for actions on two files. Signed-off-by: Shiyang Ruan --- fs/iomap

[PATCH v2 09/10] fs/xfs: Handle CoW for fsdax write() path

2021-02-25 Thread Shiyang Ruan
In fsdax mode, WRITE and ZERO on a shared extent need CoW performed. After CoW, new allocated extents needs to be remapped to the file. So, add an iomap_end for dax write ops to do the remapping work. Signed-off-by: Shiyang Ruan --- fs/xfs/xfs_bmap_util.c | 3 ++- fs/xfs/xfs_file.c | 9

[PATCH v2 10/10] fs/xfs: Add dedupe support for fsdax

2021-02-25 Thread Shiyang Ruan
Add xfs_break_two_dax_layouts() to break layout for tow dax files. Then call compare range function only when files are both DAX or not. Signed-off-by: Shiyang Ruan --- fs/xfs/xfs_file.c| 20 fs/xfs/xfs_inode.c | 8 +++- fs/xfs/xfs_inode.h | 1 + fs/xfs

[PATCH v2 08/10] fsdax: Dedup file range to use a compare function

2021-02-25 Thread Shiyang Ruan
With dax we cannot deal with readpage() etc. So, we create a dax comparison funciton 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 --- fs/dax.c | 51

[PATCH v2 07/10] iomap: Introduce iomap_apply2() for operations on two files

2021-02-25 Thread Shiyang Ruan
Some operations, such as comparing a range of data in two files under fsdax mode, requires nested iomap_open()/iomap_end() on two file. Thus, we introduce iomap_apply2() to accept arguments from two files and iomap_actor2_t for actions on two files. Signed-off-by: Shiyang Ruan --- fs/iomap

[PATCH v2 06/10] fsdax: Add dax_iomap_cow_copy() for dax_iomap_zero

2021-02-25 Thread Shiyang Ruan
Punch hole on a reflinked file needs dax_copy_edge() too. Otherwise, data in not aligned area will be not correct. So, add the srcmap to dax_iomap_zero() and replace memset() as dax_copy_edge(). Signed-off-by: Shiyang Ruan --- fs/dax.c | 6 -- fs/iomap/buffered-io.c | 2

[PATCH v2 05/10] fsdax: Replace mmap entry in case of CoW

2021-02-25 Thread Shiyang Ruan
-by: Shiyang Ruan --- fs/dax.c | 37 ++--- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 748dfb89fb41..ec4b733e0b59 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -722,6 +722,9 @@ static int copy_cow_page_dax(struct block_device

[PATCH v2 04/10] fsdax: Introduce dax_iomap_cow_copy()

2021-02-25 Thread Shiyang Ruan
to copy the head and tail ranges which is outside of the non-aligned area instead of copying the whole aligned range. But in dax page fault, it will always be an aligned range. So, we have to copy the whole range in this case. Signed-off-by: Shiyang Ruan --- fs/dax.c | 73

[PATCH v2 03/10] fsdax: Output address in dax_iomap_pfn() and rename it

2021-02-25 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 --- fs/dax.c | 16 1 file changed, 12

[PATCH v2 02/10] fsdax: Factor helper: dax_fault_actor()

2021-02-25 Thread Shiyang Ruan
The core logic in the two dax page fault functions is similar. So, move the logic into a common helper function. Also, to facilitate the addition of new features, such as CoW, switch-case is no longer used to handle different iomap types. Signed-off-by: Shiyang Ruan --- fs/dax.c | 211

[PATCH v2 01/10] fsdax: Factor helpers to simplify dax fault code

2021-02-25 Thread Shiyang Ruan
The dax page fault code is too long and a bit difficult to read. And it is hard to understand when we trying to add new features. Some of the PTE/PMD codes have similar logic. So, factor them as helper functions to simplify the code. Signed-off-by: Shiyang Ruan --- fs/dax.c | 152

[PATCH v2 00/10] fsdax,xfs: Add reflink support for fsdax

2021-02-25 Thread Shiyang Ruan
of the patches are picked up from Goldwyn's patchset. I made some changes to adapt to this patchset. (Rebased on v5.11) == Shiyang Ruan (10): fsdax: Factor helpers to simplify dax fault code fsdax: Factor helper: dax_fault_actor() fsdax: Output address in dax_iomap_pfn() and rename it fsdax

[PATCH v3 10/11] xfs: Implement ->corrupted_range() for XFS

2021-02-08 Thread Shiyang Ruan
mapped into their address spaces, but future patches could actually do something about corrupt metadata. After that, the memory failure needs to notify the processes who are using those files. Only support data device. Realtime device is not supported for now. Signed-off-by: Shiyang Ruan --- fs

[PATCH v3 09/11] md: Implement ->corrupted_range()

2021-02-08 Thread Shiyang Ruan
With the support of ->rmap(), it is possible to obtain the superblock on a mapped device. Signed-off-by: Shiyang Ruan --- drivers/md/dm.c | 61 + 1 file changed, 61 insertions(+) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 7bac564f3

[PATCH v3 08/11] dm: Introduce ->rmap() to find bdev offset

2021-02-08 Thread Shiyang Ruan
in the future. However, some targets may not support it because of the non-linear mapping. Signed-off-by: Shiyang Ruan --- drivers/md/dm-linear.c| 20 include/linux/device-mapper.h | 5 + 2 files changed, 25 insertions(+) diff --git a/drivers/md/dm-linear.c b/drivers/md

[PATCH v3 11/11] fs/dax: Remove useless functions

2021-02-08 Thread Shiyang Ruan
Since owner tarcking is triggerred by pmem device, these functions are useless. So remove them. Signed-off-by: Shiyang Ruan --- fs/dax.c | 46 -- 1 file changed, 46 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index c64c3a0e76a6..e20a5df03eec

[PATCH v3 07/11] pmem: Implement ->corrupted_range() for pmem driver

2021-02-08 Thread Shiyang Ruan
Obtain the superblock of a pmem disk, and call filesystem's ->corrupted_range() to handle the corrupted data. Signed-off-by: Shiyang Ruan --- block/genhd.c | 6 ++ drivers/nvdimm/pmem.c | 19 +++ include/linux/genhd.h | 1 + 3 files changed, 26 insertions(+) d

[PATCH v3 06/11] mm, pmem: Implement ->memory_failure() in pmem driver

2021-02-08 Thread Shiyang Ruan
der to roll back if driver/device/filesystem does not support ->memory_failure()/->corrupted_range(). Signed-off-by: Shiyang Ruan --- drivers/nvdimm/pmem.c | 26 +++ mm/memory-failure.c | 102 +- 2 files changed, 87 insertions(+), 41 deletions

[PATCH v3 05/11] mm, fsdax: Refactor memory-failure handler for dax mapping

2021-02-08 Thread Shiyang Ruan
file and offset. Signed-off-by: Shiyang Ruan --- fs/dax.c| 21 ++ include/linux/dax.h | 1 + include/linux/mm.h | 9 + mm/memory-failure.c | 98 ++--- 4 files changed, 105 insertions(+), 24 deletions(-) diff --git a/fs/dax.c b/fs/d

[PATCH v3 04/11] block_dev: Introduce bd_corrupted_range() for block device

2021-02-08 Thread Shiyang Ruan
device to find out the MD that contains it. By this way, MD is able to call corrupted_range() from its target block device. Signed-off-by: Shiyang Ruan --- fs/block_dev.c| 47 ++- include/linux/genhd.h | 2 ++ 2 files changed, 48 insertions(+), 1

[PATCH v3 03/11] fs: Introduce ->corrupted_range() for superblock

2021-02-08 Thread Shiyang Ruan
Memory failure occurs in fsdax mode will finally be handled in filesystem. We introduce this interface to find out files or metadata affected by the corrupted range, and try to recover the corrupted data if possiable. Signed-off-by: Shiyang Ruan --- include/linux/fs.h | 2 ++ 1 file changed, 2

[PATCH v3 02/11] blk: Introduce ->corrupted_range() for block device

2021-02-08 Thread Shiyang Ruan
In fsdax mode, the memory failure happens on block device. So, it is needed to introduce an interface for block devices. Each kind of block device can handle the memory failure in ther own ways. Signed-off-by: Shiyang Ruan --- include/linux/blkdev.h | 2 ++ 1 file changed, 2 insertions

[PATCH v3 00/11] fsdax: introduce fs query to support reflink

2021-02-08 Thread Shiyang Ruan
own() * corrupted on file data try to recover data, call mf_dax_mapping_kill_procs() The fsdax & reflink support for XFS is not contained in this patchset. (Rebased on v5.11-rc5) == Shiyang Ruan (11): pagemap: Introduce ->memory_failure() blk: Introduce ->corr

[PATCH v3 01/11] pagemap: Introduce ->memory_failure()

2021-02-08 Thread Shiyang Ruan
. And finally call filesystem handler to deal with the error. The filesystem will try to recover the corrupted data if possiable. Signed-off-by: Shiyang Ruan --- include/linux/memremap.h | 8 1 file changed, 8 insertions(+) diff --git a/include/linux/memremap.h b/include/linux/memremap.h index

[PATCH 7/7] fs/xfs: Add dedupe support for fsdax

2021-02-07 Thread Shiyang Ruan
Add xfs_break_two_dax_layouts() to break layout for tow dax files. Then call compare range function only when files are both DAX or not. Signed-off-by: Shiyang Ruan --- fs/xfs/xfs_file.c| 20 fs/xfs/xfs_inode.c | 8 +++- fs/xfs/xfs_inode.h | 1 + fs/xfs

[PATCH 5/7] fsdax: Dedup file range to use a compare function

2021-02-07 Thread Shiyang Ruan
With dax we cannot deal with readpage() etc. So, we create a funciton callback to perform the file data comparison and pass it to generic_remap_file_range_prep() so it can use iomap-based functions. Signed-off-by: Goldwyn Rodrigues Signed-off-by: Shiyang Ruan --- fs/btrfs/reflink.c | 3

[PATCH 2/7] fsdax: Introduce dax_copy_edges() for CoW

2021-02-07 Thread Shiyang Ruan
dax_copy_edges() is a helper functions performs a copy from one part of the device to another for data not page aligned. Signed-off-by: Goldwyn Rodrigues Signed-off-by: Shiyang Ruan --- fs/dax.c | 41 + 1 file changed, 41 insertions(+) diff --git a/fs

[PATCH 4/7] fsdax: Replace mmap entry in case of CoW

2021-02-07 Thread Shiyang Ruan
-by: Shiyang Ruan --- fs/dax.c | 31 +++ 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index b2195cbdf2dc..29698a3d2e37 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -722,6 +722,9 @@ static int copy_cow_page_dax(struct block_device *bdev

[PATCH 6/7] fs/xfs: Handle CoW for fsdax write() path

2021-02-07 Thread Shiyang Ruan
In fsdax mode, WRITE and ZERO on a shared extent need CoW mechanism performed. After CoW, new extents needs to be remapped to the file. Signed-off-by: Shiyang Ruan --- fs/xfs/xfs_bmap_util.c | 6 +- fs/xfs/xfs_file.c | 10 +++--- fs/xfs/xfs_iomap.c | 3 ++- fs/xfs/xfs_iops.c

[PATCH 3/7] fsdax: Copy data before write

2021-02-07 Thread Shiyang Ruan
Add dax_copy_edges() into each dax actor functions to perform CoW. Signed-off-by: Shiyang Ruan --- fs/dax.c | 37 ++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index ea4e8a434900..b2195cbdf2dc 100644 --- a/fs/dax.c +++ b

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

2021-02-07 Thread Shiyang Ruan
mechanism implemented in fsdax, we are able to make reflink and fsdax work together in XFS. Some of the patches are picked up from Goldwyn's patchset. I made some changes to adapt to this patchset. (Rebased on v5.10) == Shiyang Ruan (7): fsdax: Output address in dax_iomap_pfn() and rename

[PATCH RESEND v2 08/10] md: Implement ->corrupted_range()

2021-01-28 Thread Shiyang Ruan
dev->bd_holder_disks to obtain its mapped device. Signed-off-by: Shiyang Ruan --- drivers/md/dm.c | 61 +++ drivers/nvdimm/pmem.c | 11 +++- fs/block_dev.c| 42 - include/linux/genhd.h | 2 ++ 4 files change

[PATCH RESEND v2 10/10] fs/dax: Remove useless functions

2021-01-28 Thread Shiyang Ruan
Since owner tarcking is triggerred by pmem device, these functions are useless. So remove it. Signed-off-by: Shiyang Ruan --- fs/dax.c | 46 -- 1 file changed, 46 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index c64c3a0e76a6..e20a5df03eec 100644

[PATCH RESEND v2 07/10] dm: Introduce ->rmap() to find bdev offset

2021-01-28 Thread Shiyang Ruan
in the future. However, some targets may not support it because of the non-linear mapping. Signed-off-by: Shiyang Ruan --- drivers/md/dm-linear.c| 20 include/linux/device-mapper.h | 5 + 2 files changed, 25 insertions(+) diff --git a/drivers/md/dm-linear.c b/drivers/md

[PATCH RESEND v2 09/10] xfs: Implement ->corrupted_range() for XFS

2021-01-28 Thread Shiyang Ruan
to repair the corrupted data.(did not implemented in this patchset) After that, the memory failure also needs to notify the processes who are using those files. Only support data device. Realtime device is not supported for now. Signed-off-by: Shiyang Ruan --- fs/xfs/xfs_fsops.c | 5 +

[PATCH RESEND v2 06/10] pmem: Implement ->corrupted_range() for pmem driver

2021-01-28 Thread Shiyang Ruan
Obtain the superblock of a pmem disk, and call filesystem's ->corrupted_range() to handle the corrupted data. Signed-off-by: Shiyang Ruan --- block/genhd.c | 6 ++ drivers/nvdimm/pmem.c | 24 include/linux/genhd.h | 1 + 3 files changed, 31 inserti

[PATCH RESEND v2 00/10] fsdax: introduce fs query to support reflink

2021-01-28 Thread Shiyang Ruan
p; reflink support for XFS is not contained in this patchset. (Rebased on v5.11-rc5) Shiyang Ruan (10): pagemap: Introduce ->memory_failure() blk: Introduce ->corrupted_range() for block device fs: Introduce ->corrupted_range() for superblock mm, fsdax: Refactor memory-f

[PATCH RESEND v2 03/10] fs: Introduce ->corrupted_range() for superblock

2021-01-28 Thread Shiyang Ruan
Memory failure occurs in fsdax mode will finally be handled in filesystem. We introduce this interface to find out files or metadata affected by the corrupted range, and try to recover the corrupted data if possiable. Signed-off-by: Shiyang Ruan --- include/linux/fs.h | 2 ++ 1 file changed, 2

[PATCH RESEND v2 04/10] mm, fsdax: Refactor memory-failure handler for dax mapping

2021-01-28 Thread Shiyang Ruan
file and offset. Signed-off-by: Shiyang Ruan --- fs/dax.c| 21 ++ include/linux/dax.h | 1 + include/linux/mm.h | 9 + mm/memory-failure.c | 98 ++--- 4 files changed, 105 insertions(+), 24 deletions(-) diff --git a/fs/dax.c b/fs/d

[PATCH RESEND v2 05/10] mm, pmem: Implement ->memory_failure() in pmem driver

2021-01-28 Thread Shiyang Ruan
der to roll back if driver/device/filesystem does not support ->memory_failure()/->corrupted_range(). Signed-off-by: Shiyang Ruan --- drivers/nvdimm/pmem.c | 25 +++ mm/memory-failure.c | 102 +- 2 files changed, 86 insertions(+), 41 deletions

[PATCH RESEND v2 02/10] blk: Introduce ->corrupted_range() for block device

2021-01-28 Thread Shiyang Ruan
In fsdax mode, the memory failure happens on block device. So, it is needed to introduce an interface for block devices. Each kind of block device can handle the memory failure in ther own ways. Signed-off-by: Shiyang Ruan --- include/linux/blkdev.h | 2 ++ 1 file changed, 2 insertions

[PATCH RESEND v2 01/10] pagemap: Introduce ->memory_failure()

2021-01-28 Thread Shiyang Ruan
. And finally call filesystem handler to deal with the error. The filesystem will try to recover the corrupted data if possiable. Signed-off-by: Shiyang Ruan --- include/linux/memremap.h | 8 1 file changed, 8 insertions(+) diff --git a/include/linux/memremap.h b/include/linux/memremap.h index

[PATCH] dax: fix default return code of range_parse()

2021-01-25 Thread Shiyang Ruan
The return value of range_parse() indicates the size when it is positive. The error code should be negative. Signed-off-by: Shiyang Ruan --- drivers/dax/bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c index 737b207c9e30

[PATCH v2 08/10] md: Implement ->corrupted_range()

2021-01-25 Thread Shiyang Ruan
dev->bd_holder_disks to obtain its mapped device. Signed-off-by: Shiyang Ruan --- drivers/md/dm.c | 61 +++ drivers/nvdimm/pmem.c | 11 +++- fs/block_dev.c| 42 - include/linux/genhd.h | 2 ++ 4 files change

[PATCH v2 09/10] xfs: Implement ->corrupted_range() for XFS

2021-01-25 Thread Shiyang Ruan
to repair the corrupted data.(did not implemented in this patchset) After that, the memory failure also needs to notify the processes who are using those files. Only support data device. Realtime device is not supported for now. Signed-off-by: Shiyang Ruan --- fs/xfs/xfs_fsops.c | 5 +

[PATCH v2 10/10] fs/dax: Remove useless functions

2021-01-25 Thread Shiyang Ruan
Since owner tarcking is triggerred by pmem device, these functions are useless. So remove it. Signed-off-by: Shiyang Ruan --- fs/dax.c | 46 -- 1 file changed, 46 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index c64c3a0e76a6..e20a5df03eec 100644

[PATCH v2 05/10] mm, pmem: Implement ->memory_failure() in pmem driver

2021-01-25 Thread Shiyang Ruan
der to roll back if driver/device/filesystem does not support ->memory_failure()/->corrupted_range(). Signed-off-by: Shiyang Ruan --- drivers/nvdimm/pmem.c | 25 +++ mm/memory-failure.c | 102 +- 2 files changed, 86 insertions(+), 41 deletions

[PATCH v2 03/10] fs: Introduce ->corrupted_range() for superblock

2021-01-25 Thread Shiyang Ruan
Memory failure occurs in fsdax mode will finally be handled in filesystem. We introduce this interface to find out files or metadata affected by the corrupted range, and try to recover the corrupted data if possiable. Signed-off-by: Shiyang Ruan --- include/linux/fs.h | 2 ++ 1 file changed, 2

[PATCH v2 04/10] mm, fsdax: Refactor memory-failure handler for dax mapping

2021-01-25 Thread Shiyang Ruan
file and offset. Signed-off-by: Shiyang Ruan --- fs/dax.c| 21 ++ include/linux/dax.h | 1 + include/linux/mm.h | 9 + mm/memory-failure.c | 98 ++--- 4 files changed, 105 insertions(+), 24 deletions(-) diff --git a/fs/dax.c b/fs/d

[PATCH v2 06/10] pmem: Implement ->corrupted_range() for pmem driver

2021-01-25 Thread Shiyang Ruan
Obtain the superblock of a pmem disk, and call filesystem's ->corrupted_range() to handle the corrupted data. Signed-off-by: Shiyang Ruan --- block/genhd.c | 6 ++ drivers/nvdimm/pmem.c | 24 include/linux/genhd.h | 1 + 3 files changed, 31 inserti

  1   2   >