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

2021-08-26 Thread Shiyang Ruan
On 2021/8/23 20:57, Christoph Hellwig wrote: On Thu, Aug 19, 2021 at 03:54:01PM -0700, Dan Williams wrote: static void *dax_insert_entry(struct xa_state *xas, struct vm_fault *vmf, const struct iomap_iter *iter, void *entry, pfn_t pfn,

Re: [PATCH v7 4/8] fsdax: Add dax_iomap_cow_copy() for dax_iomap_zero

2021-08-26 Thread Shiyang Ruan
On 2021/8/20 10:39, Dan Williams wrote: On Sun, Aug 15, 2021 at 11:04 PM Shiyang Ruan wrote: 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 srcmap to dax_iomap_zero() and replace memset() as

Re: [PATCH v7 7/8] fsdax: Introduce dax_iomap_ops for end of reflink

2021-08-26 Thread Shiyang Ruan
On 2021/8/20 23:18, Dan Williams wrote: On Thu, Aug 19, 2021 at 11:13 PM ruansy.fnst wrote: On 2021/8/20 上午11:01, Dan Williams wrote: On Sun, Aug 15, 2021 at 11:05 PM Shiyang Ruan wrote: After writing data, reflink requires end operations to remap those new allocated extents. The

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

2021-08-26 Thread Shiyang Ruan
On 2021/8/20 11:08, Dan Williams wrote: On Sun, Aug 15, 2021 at 11:05 PM 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

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

2021-08-26 Thread Shiyang Ruan
On 2021/8/27 13:00, Dan Williams wrote: On Thu, Aug 26, 2021 at 8:22 PM Shiyang Ruan wrote: On 2021/8/23 20:57, Christoph Hellwig wrote: On Thu, Aug 19, 2021 at 03:54:01PM -0700, Dan Williams wrote: static void *dax_insert_entry(struct xa_state *xas, struct vm_fault *vmf

Re: [PATCH v7 7/8] fsdax: Introduce dax_iomap_ops for end of reflink

2021-08-26 Thread Shiyang Ruan
On 2021/8/27 13:04, Dan Williams wrote: On Thu, Aug 26, 2021 at 8:30 PM Shiyang Ruan wrote: On 2021/8/20 23:18, Dan Williams wrote: On Thu, Aug 19, 2021 at 11:13 PM ruansy.fnst wrote: On 2021/8/20 上午11:01, Dan Williams wrote: On Sun, Aug 15, 2021 at 11:05 PM Shiyang Ruan wrote

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

2021-08-29 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 --- fs

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

2021-08-29 Thread Shiyang Ruan
ented in fsdax, we are able to make reflink and fsdax work together in XFS. (Rebased on v5.14-rc4 and Christoph's "switch iomap to an iterator model v2"[1]) [1]: https://lore.kernel.org/linux-xfs/20210809061244.1196573-1-...@lst.de/ == Shiyang Ruan (7): fsdax: Output address in dax_io

[PATCH v8 2/7] fsdax: Introduce dax_iomap_cow_copy()

2021-08-29 Thread Shiyang Ruan
is better 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 copy the whole range in this case. Signed-off-by: Shiyang Ruan Reviewed-by: Christoph Hellwig Reviewed-by: Darr

[PATCH v8 4/7] fsdax: Add dax_iomap_cow_copy() for dax_iomap_zero

2021-08-29 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 srcmap to dax_iomap_zero() and replace memset() as dax_iomap_cow_copy(). Signed-off-by: Shiyang Ruan Reviewed-by: Ritesh Harjani Reviewed-by: Darrick J. Wong

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

2021-08-29 Thread Shiyang Ruan
-by: Shiyang Ruan Reviewed-by: Christoph Hellwig Reviewed-by: Ritesh Harjani Reviewed-by: Darrick J. Wong --- fs/dax.c | 73 +++- 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 792116b14782

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

2021-08-29 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 v8 6/7] xfs: support CoW in fsdax mode

2021-08-29 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. Add an implementation of ->iomap_end() for dax write ops to do the remapping work. Signed-off-by: Shiyang Ruan --- fs/dax.c |

[PATCH v8 7/7] xfs: Add dax dedupe support

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

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

2021-09-15 Thread Shiyang Ruan
: Shiyang Ruan Reviewed-by: Christoph Hellwig Reviewed-by: Ritesh Harjani Reviewed-by: Darrick J. Wong --- fs/dax.c | 73 +++- 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index dded08be54dc..41c93929f20b

[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 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 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 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 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_

[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 --- fs

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

2021-09-15 Thread Shiyang Ruan
flink and fsdax work together in XFS. (Rebased on v5.15-rc1) == Shiyang Ruan (8): fsdax: Output address in dax_iomap_pfn() and rename it fsdax: Introduce dax_iomap_cow_copy() fsdax: Replace mmap entry in case of CoW fsdax: Convert dax_iomap_zero to iter model fsdax: Add dax_iomap_cow_c

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

2021-09-15 Thread Shiyang Ruan
is better 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 copy the whole range in this case. Signed-off-by: Shiyang Ruan Reviewed-by: Christoph Hellwig Reviewed-by: Darr

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 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. Signed

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

2021-09-16 Thread Shiyang Ruan
On 2021/9/16 14:16, Christoph Hellwig wrote: On Wed, Sep 15, 2021 at 06:44:58PM +0800, Shiyang Ruan wrote: + rc = dax_direct_access(iomap->dax_dev, pgoff, 1, &kaddr, NULL); + if (rc < 0) + goto out; + memset(kaddr + offset, 0, size); + if (sr

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

2021-09-16 Thread Shiyang Ruan
On 2021/9/16 14:23, Christoph Hellwig wrote: On Wed, Sep 15, 2021 at 06:45:00PM +0800, Shiyang Ruan wrote: +static int +xfs_dax_write_iomap_end( + struct inode*inode, + loff_t pos, + loff_t length, + ssize_t

[PATCH v7 8/8] fsdax: add exception for reflinked files

2021-09-24 Thread Shiyang Ruan
. Signed-off-by: Shiyang Ruan --- fs/dax.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 2536c105ec7f..1a57211b1bc9 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -352,9 +352,10 @@ static void dax_associate_entry(void *entry, struct

[PATCH v7 7/8] xfs: Implement ->notify_failure() for XFS

2021-09-24 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. Signed-off-by: Shiyang Ruan --- drivers/dax/super.c | 19 + fs/xfs/xfs_fsops.c | 3 + fs/xfs

[PATCH v7 0/8] [PATCH v7 0/8] fsdax: introduce fs query to support reflink

2021-09-24 Thread Shiyang Ruan
ata, call mf_dax_kill_procs() |* normal case |- mf_generic_kill_procs() The fsdax & reflink support for XFS is not contained in this patchset. (Rebased on v5.15-rc1) == Shiyang Ruan (8): dax: Use rwsem for dax_{read,write}_lock() dax: Introduce holder for dax_device mm: factor helpers for memo

[PATCH v7 3/8] mm: factor helpers for memory_failure_dev_pagemap

2021-09-24 Thread Shiyang Ruan
memory_failure_dev_pagemap code is a bit complex before introduce RMAP feature for fsdax. So it is needed to factor some helper functions to simplify these code. Signed-off-by: Shiyang Ruan --- mm/memory-failure.c | 140 1 file changed, 76

[PATCH v7 2/8] dax: Introduce holder for dax_device

2021-09-24 Thread Shiyang Ruan
filesystem is being mounted, or an target device is being activated. Signed-off-by: Shiyang Ruan --- drivers/dax/super.c | 59 + include/linux/dax.h | 29 ++ 2 files changed, 88 insertions(+) diff --git a/drivers/dax/super.c b/drivers/dax

[PATCH v7 4/8] pagemap,pmem: Introduce ->memory_failure()

2021-09-24 Thread Shiyang Ruan
memory failure from pmem driver to upper layers. If there is something not support in the notify routine, memory_failure will fall back to the generic hanlder. Signed-off-by: Shiyang Ruan --- drivers/nvdimm/pmem.c| 11 +++ include/linux/memremap.h | 9 + mm/memory-failure.c

[PATCH v7 1/8] dax: Use rwsem for dax_{read,write}_lock()

2021-09-24 Thread Shiyang Ruan
for registration. Signed-off-by: Shiyang Ruan --- drivers/dax/device.c | 11 +- drivers/dax/super.c| 43 ++ drivers/md/dm-writecache.c | 7 +++ fs/dax.c | 26 +++ include/linux/dax.h| 9

[PATCH v7 5/8] fsdax: Introduce dax_lock_mapping_entry()

2021-09-24 Thread Shiyang Ruan
r use. Signed-off-by: Shiyang Ruan --- fs/dax.c| 65 - include/linux/dax.h | 15 +++ 2 files changed, 79 insertions(+), 1 deletion(-) diff --git a/fs/dax.c b/fs/dax.c index 798c43f09eee..509b65e60478 100644 --- a/fs/dax.c +++ b/fs/

[PATCH v7 6/8] mm: Introduce mf_dax_kill_procs() for fsdax case

2021-09-24 Thread Shiyang Ruan
ppings and offsets may share the same page in fsdax mode. So, it is called when filesystem RMAP results are found. Signed-off-by: Shiyang Ruan --- fs/dax.c| 10 -- include/linux/dax.h | 9 + include/linux/mm.h | 2 ++ mm/memory-fail

[PATCH v10 0/8] fsdax,xfs: Add reflink&dedupe support for fsdax

2021-09-27 Thread Shiyang Ruan
access support. With the two mechanisms implemented in fsdax, we are able to make reflink and fsdax work together in XFS. (Rebased on v5.15-rc3) == Shiyang Ruan (8): fsdax: Output address in dax_iomap_pfn() and rename it fsdax: Introduce dax_iomap_cow_copy() fsdax: Replace mmap entry in case

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

2021-09-27 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 Reviewed

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

2021-09-27 Thread Shiyang Ruan
is better 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 copy the whole range in this case. Signed-off-by: Shiyang Ruan Reviewed-by: Christoph Hellwig Reviewed-by: Darr

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

2021-09-27 Thread Shiyang Ruan
: Shiyang Ruan Reviewed-by: Christoph Hellwig Reviewed-by: Ritesh Harjani Reviewed-by: Darrick J. Wong --- fs/dax.c | 75 +++- 1 file changed, 41 insertions(+), 34 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index dded08be54dc..b437badfe0dd

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

2021-09-27 Thread Shiyang Ruan
Let dax_iomap_zero() support iter model. Signed-off-by: Shiyang Ruan Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- 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

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

2021-09-27 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 Reviewed-by

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

2021-09-27 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 v10 7/8] xfs: support CoW in fsdax mode

2021-09-27 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_

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

2021-09-27 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

Re: [PATCH v7 1/8] dax: Use rwsem for dax_{read,write}_lock()

2021-10-19 Thread Shiyang Ruan
在 2021/10/15 1:48, Darrick J. Wong 写道: On Fri, Sep 24, 2021 at 09:09:52PM +0800, Shiyang Ruan wrote: In order to introduce dax holder registration, we need a write lock for dax. Because of the rarity of notification failures and the infrequency of registration events, it would be better to

Re: [PATCH v7 4/8] pagemap,pmem: Introduce ->memory_failure()

2021-10-19 Thread Shiyang Ruan
在 2021/10/15 2:05, Darrick J. Wong 写道: On Fri, Sep 24, 2021 at 09:09:55PM +0800, Shiyang Ruan wrote: When memory-failure occurs, we call this function which is implemented by each kind of devices. For the fsdax case, pmem device driver implements it. Pmem device driver will find out the

Re: [PATCH v7 6/8] mm: Introduce mf_dax_kill_procs() for fsdax case

2021-10-19 Thread Shiyang Ruan
在 2021/10/15 3:32, Darrick J. Wong 写道: On Fri, Sep 24, 2021 at 09:09:57PM +0800, Shiyang Ruan wrote: This function is called at the end of RMAP routine, i.e. filesystem recovery function, to collect and kill processes using a shared page of DAX file. The difference between

Re: [PATCH v7 2/8] dax: Introduce holder for dax_device

2021-10-19 Thread Shiyang Ruan
在 2021/10/15 2:00, Darrick J. Wong 写道: On Fri, Sep 24, 2021 at 09:09:53PM +0800, Shiyang Ruan wrote: To easily track filesystem from a pmem device, we introduce a holder for dax_device structure, and also its operation. This holder is used to remember who is using this dax_device: - When

[PATCH v8 6/8] mm: Introduce mf_dax_kill_procs() for fsdax case

2021-10-31 Thread Shiyang Ruan
ppings and offsets may share the same page in fsdax mode. So, it is called when filesystem RMAP results are found. Signed-off-by: Shiyang Ruan --- fs/dax.c| 10 -- include/linux/dax.h | 9 + include/linux/mm.h | 2 ++ mm/memory-fail

[PATCH v8 4/8] pagemap,pmem: Introduce ->memory_failure()

2021-10-31 Thread Shiyang Ruan
memory failure from pmem driver to upper layers. If there is something not support in the notify routine, memory_failure will fall back to the generic hanlder. Signed-off-by: Shiyang Ruan Reviewed-by: Christoph Hellwig --- drivers/nvdimm/pmem.c| 11 +++ include/linux/memremap.h

[PATCH v8 3/8] mm: factor helpers for memory_failure_dev_pagemap

2021-10-31 Thread Shiyang Ruan
memory_failure_dev_pagemap code is a bit complex before introduce RMAP feature for fsdax. So it is needed to factor some helper functions to simplify these code. Signed-off-by: Shiyang Ruan Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- mm/memory-failure.c | 141

[PATCH v8 7/8] xfs: Implement ->notify_failure() for XFS

2021-10-31 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. Signed-off-by: Shiyang Ruan --- drivers/dax/super.c | 19 fs/xfs/xfs_fsops.c | 3 + fs/xfs

[PATCH v8 5/8] fsdax: Introduce dax_lock_mapping_entry()

2021-10-31 Thread Shiyang Ruan
r use. Signed-off-by: Shiyang Ruan --- fs/dax.c| 65 - include/linux/dax.h | 15 +++ 2 files changed, 79 insertions(+), 1 deletion(-) diff --git a/fs/dax.c b/fs/dax.c index a06cbb950950..59e02c9f169c 100644 --- a/fs/dax.c +++ b/fs/

[PATCH v8 8/8] fsdax: add exception for reflinked files

2021-10-31 Thread Shiyang Ruan
, which is set true when it is CoW operation, for reflink case. Normal cases work as before. We will get the cow flag in the dax-reflink(v10) patchset. So, always set false here for now. Signed-off-by: Shiyang Ruan --- fs/dax.c | 39 +++ 1 file changed, 27

[PATCH v8 0/8] fsdax: introduce fs query to support reflink

2021-10-31 Thread Shiyang Ruan
le data | | try to recover data, call mf_dax_kill_procs() |* normal case |- mf_generic_kill_procs() The fsdax & reflink support for XFS is not contained in this patchset. (Rebased on v5.15-rc7) == Shiyang Ruan (8): dax: Use rwsem for dax_{read,write}_lock() dax: Introduc

[PATCH v8 1/8] dax: Use percpu rwsem for dax_{read,write}_lock()

2021-10-31 Thread Shiyang Ruan
In order to introduce dax holder registration, we need a write lock for dax. Change the current lock to percpu_rw_semaphore and introduce a dax write lock for registration. Signed-off-by: Shiyang Ruan --- drivers/dax/device.c | 11 drivers/dax/super.c| 51

[PATCH v8 2/8] dax: Introduce holder for dax_device

2021-10-31 Thread Shiyang Ruan
filesystem is being mounted, or an target device is being activated. Signed-off-by: Shiyang Ruan --- drivers/dax/super.c | 63 + include/linux/dax.h | 25 ++ 2 files changed, 88 insertions(+) diff --git a/drivers/dax/super.c b/drivers/dax

[PATCH v8 9/9] fsdax: set a CoW flag when associate reflink mappings

2021-12-02 Thread Shiyang Ruan
ake sure disassociation works fine, we use page->index as refcount, and clear page->mapping to the initial state when page->index is decreased to 0. With the help of this new flag, it is able to distinguish normal case and CoW case, and keep the warning in normal case. Signed-off-by:

[PATCH v8 5/9] fsdax: Introduce dax_lock_mapping_entry()

2021-12-02 Thread Shiyang Ruan
r use. Signed-off-by: Shiyang Ruan --- fs/dax.c| 65 - include/linux/dax.h | 15 +++ 2 files changed, 79 insertions(+), 1 deletion(-) diff --git a/fs/dax.c b/fs/dax.c index 1f46810d4b68..b3c737aff9de 100644 --- a/fs/dax.c +++ b/fs/

[PATCH v8 8/9] xfs: Implement ->notify_failure() for XFS

2021-12-02 Thread Shiyang Ruan
is kill processes with that file 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. Signed-off-by: Shiyang Ruan --- fs/xfs/Makefile | 1 +

[PATCH v8 2/9] dax: Introduce holder for dax_device

2021-12-02 Thread Shiyang Ruan
filesystem is being mounted, or an target device is being activated. Signed-off-by: Shiyang Ruan --- drivers/dax/super.c | 61 + include/linux/dax.h | 25 +++ 2 files changed, 86 insertions(+) diff --git a/drivers/dax/super.c b/drivers/dax

[RESEND PATCH v8 0/9] fsdax: introduce fs query to support reflink

2021-12-02 Thread Shiyang Ruan
d on metadata | | try to recover data, call xfs_force_shutdown() | |* corrupted on file data | | try to recover data, call mf_dax_kill_procs() |* normal case |- |mf_generic_kill_procs() == Shiyang Ruan (9): dax: Use percpu rwsem for dax_{read,write}_l

[PATCH v8 1/9] dax: Use percpu rwsem for dax_{read,write}_lock()

2021-12-02 Thread Shiyang Ruan
In order to introduce dax holder registration, we need a write lock for dax. Change the current lock to percpu_rw_semaphore and introduce a write lock for registration. Signed-off-by: Shiyang Ruan --- drivers/dax/device.c | 11 +-- drivers/dax/super.c| 40

[PATCH v8 3/9] mm: factor helpers for memory_failure_dev_pagemap

2021-12-02 Thread Shiyang Ruan
memory_failure_dev_pagemap code is a bit complex before introduce RMAP feature for fsdax. So it is needed to factor some helper functions to simplify these code. Signed-off-by: Shiyang Ruan Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- mm/memory-failure.c | 141

[PATCH v8 4/9] pagemap,pmem: Introduce ->memory_failure()

2021-12-02 Thread Shiyang Ruan
memory failure from pmem driver to upper layers. If there is something not support in the notify routine, memory_failure will fall back to the generic hanlder. Signed-off-by: Shiyang Ruan Reviewed-by: Christoph Hellwig --- drivers/nvdimm/pmem.c| 16 include/linux

[PATCH v8 6/9] mm: Introduce mf_dax_kill_procs() for fsdax case

2021-12-02 Thread Shiyang Ruan
ppings and offsets may share the same page in fsdax mode. So, it is called when filesystem RMAP results are found. Signed-off-by: Shiyang Ruan --- fs/dax.c| 10 -- include/linux/dax.h | 9 + include/linux/mm.h | 2 ++ mm/memory-fail

[PATCH v8 7/9] dax: add dax holder helper for filesystems

2021-12-02 Thread Shiyang Ruan
Add these helper functions, and export them for filesystem use. Signed-off-by: Shiyang Ruan --- drivers/dax/super.c | 19 +++ include/linux/dax.h | 15 +++ 2 files changed, 34 insertions(+) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index a19fcc0a54f3

Re: [PATCH v8 1/9] dax: Use percpu rwsem for dax_{read,write}_lock()

2021-12-14 Thread Shiyang Ruan
在 2021/12/14 23:40, Christoph Hellwig 写道: On Thu, Dec 02, 2021 at 04:48:48PM +0800, Shiyang Ruan wrote: In order to introduce dax holder registration, we need a write lock for dax. Change the current lock to percpu_rw_semaphore and introduce a write lock for registration. Why do we need

Re: [PATCH v8 7/9] dax: add dax holder helper for filesystems

2021-12-14 Thread Shiyang Ruan
在 2021/12/14 23:47, Christoph Hellwig 写道: On Thu, Dec 02, 2021 at 04:48:54PM +0800, Shiyang Ruan wrote: Add these helper functions, and export them for filesystem use. What is the point of adding these wrappers vs just calling the underlying functions? I added them so that they can be

[PATCH v9 02/10] dax: Introduce holder for dax_device

2021-12-26 Thread Shiyang Ruan
filesystem is being mounted, or an target device is being activated. Signed-off-by: Shiyang Ruan --- drivers/dax/super.c | 62 + include/linux/dax.h | 29 + 2 files changed, 91 insertions(+) diff --git a/drivers/dax/super.c b/drivers/dax

[PATCH v9 01/10] dax: Use percpu rwsem for dax_{read,write}_lock()

2021-12-26 Thread Shiyang Ruan
In order to introduce dax holder registration, we need a write lock for dax. The write operation is per dax device job. So, the global lock is not suitable. Change the current lock to percpu_rw_semaphore and introduce a write lock for registration. Signed-off-by: Shiyang Ruan --- drivers/dax

[PATCH v9 10/10] fsdax: set a CoW flag when associate reflink mappings

2021-12-26 Thread Shiyang Ruan
ake sure disassociation works fine, we use page->index as refcount, and clear page->mapping to the initial state when page->index is decreased to 0. With the help of this new flag, it is able to distinguish normal case and CoW case, and keep the warning in normal case. Signed-off-by:

[PATCH v9 05/10] fsdax: fix function description

2021-12-26 Thread Shiyang Ruan
The function name has been changed, so the description should be updated too. Signed-off-by: Shiyang Ruan --- fs/dax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/dax.c b/fs/dax.c index 1f46810d4b68..2ee2d5a525ee 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -390,7 +390,7

[PATCH v9 04/10] pagemap,pmem: Introduce ->memory_failure()

2021-12-26 Thread Shiyang Ruan
memory failure from pmem driver to upper layers. If there is something not support in the notify routine, memory_failure will fall back to the generic hanlder. Signed-off-by: Shiyang Ruan Reviewed-by: Christoph Hellwig --- drivers/nvdimm/pmem.c| 16 include/linux

[PATCH v9 09/10] xfs: Implement ->notify_failure() for XFS

2021-12-26 Thread Shiyang Ruan
is kill processes with that file 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. Signed-off-by: Shiyang Ruan --- fs/xfs/Makefile | 1 +

[PATCH v9 08/10] mm: Introduce mf_dax_kill_procs() for fsdax case

2021-12-26 Thread Shiyang Ruan
ppings and offsets may share the same page in fsdax mode. It will be called when filesystem's RMAP results are found. Signed-off-by: Shiyang Ruan --- include/linux/mm.h | 2 + mm/memory-failure.c | 89 +++-- 2 files changed, 80 insertions(+), 11 del

[PATCH v9 06/10] fsdax: Introduce dax_lock_mapping_entry()

2021-12-26 Thread Shiyang Ruan
igned-off-by: Shiyang Ruan Reviewed-by: Christoph Hellwig --- fs/dax.c| 63 + include/linux/dax.h | 15 +++ 2 files changed, 78 insertions(+) diff --git a/fs/dax.c b/fs/dax.c index 2ee2d5a525ee..b3c737aff9de 100644 --- a/fs/dax.c

[PATCH v9 03/10] mm: factor helpers for memory_failure_dev_pagemap

2021-12-26 Thread Shiyang Ruan
memory_failure_dev_pagemap code is a bit complex before introduce RMAP feature for fsdax. So it is needed to factor some helper functions to simplify these code. Signed-off-by: Shiyang Ruan Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- mm/memory-failure.c | 141

[PATCH v9 07/10] mm: move pgoff_address() to vma_pgoff_address()

2021-12-26 Thread Shiyang Ruan
Since it is not a DAX-specific function, move it into mm and rename it to be a generic helper. Signed-off-by: Shiyang Ruan --- fs/dax.c | 12 +--- include/linux/mm.h | 13 + 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index

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

2021-12-26 Thread Shiyang Ruan
ata | | try to recover data, call xfs_force_shutdown() | |* corrupted on file data | | try to recover data, call mf_dax_kill_procs() |* normal case |- |mf_generic_kill_procs() == Shiyang Ruan (10): dax: Use percpu rwsem for dax_{read,write}_lock() dax: Introduce

Re: [PATCH v9 01/10] dax: Use percpu rwsem for dax_{read,write}_lock()

2022-01-06 Thread Shiyang Ruan
在 2022/1/5 6:44, Dan Williams 写道: On Sun, Dec 26, 2021 at 6:35 AM Shiyang Ruan wrote: In order to introduce dax holder registration, we need a write lock for dax. As far as I can see, no, a write lock is not needed while the holder is being registered. The synchronization that is needed

Re: [PATCH v9 02/10] dax: Introduce holder for dax_device

2022-01-20 Thread Shiyang Ruan
在 2022/1/20 16:46, Christoph Hellwig 写道: On Wed, Jan 05, 2022 at 04:12:04PM -0800, Dan Williams wrote: We ended up with explicit callbacks after hch balked at a notifier call-chain, but I think we're back to that now. The partition mistake might be unfixable, but at least bdev_dax_pgoff() is

Re: [PATCH v9 10/10] fsdax: set a CoW flag when associate reflink mappings

2022-01-20 Thread Shiyang Ruan
在 2022/1/20 16:59, Christoph Hellwig 写道: On Sun, Dec 26, 2021 at 10:34:39PM +0800, Shiyang Ruan wrote: +#define FS_DAX_MAPPING_COW 1UL + +#define MAPPING_SET_COW(m) (m = (struct address_space *)FS_DAX_MAPPING_COW) +#define MAPPING_TEST_COW(m)(((unsigned long)m

Re: [PATCH v9 10/10] fsdax: set a CoW flag when associate reflink mappings

2022-01-21 Thread Shiyang Ruan
在 2022/1/21 15:16, Christoph Hellwig 写道: On Fri, Jan 21, 2022 at 10:33:58AM +0800, Shiyang Ruan wrote: But different question, how does this not conflict with: #define PAGE_MAPPING_ANON 0x1 in page-flags.h? Now we are treating dax pages, so I think its flags should be different

[PATCH v10 0/9] fsdax: introduce fs query to support reflink

2022-01-27 Thread Shiyang Ruan
call xfs_force_shutdown() | |* corrupted on file data | | try to recover data, call mf_dax_kill_procs() |* normal case |- |mf_generic_kill_procs() == Shiyang Ruan (9): dax: Introduce holder for dax_device mm: factor helpers for memory_failure_dev_pagemap pagemap,pmem: Introduce -&

[PATCH v10 1/9] dax: Introduce holder for dax_device

2022-01-27 Thread Shiyang Ruan
filesystem is being mounted, or an target device is being activated. Signed-off-by: Shiyang Ruan --- drivers/dax/super.c | 62 + include/linux/dax.h | 29 + 2 files changed, 91 insertions(+) diff --git a/drivers/dax/super.c b/drivers/dax

[PATCH v10 2/9] mm: factor helpers for memory_failure_dev_pagemap

2022-01-27 Thread Shiyang Ruan
memory_failure_dev_pagemap code is a bit complex before introduce RMAP feature for fsdax. So it is needed to factor some helper functions to simplify these code. Signed-off-by: Shiyang Ruan Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- mm/memory-failure.c | 141

[PATCH v10 9/9] fsdax: set a CoW flag when associate reflink mappings

2022-01-27 Thread Shiyang Ruan
to make sure disassociation works fine, we use page->index as refcount, and clear page->mapping to the initial state when page->index is decreased to 0. With the help of this new flag, it is able to distinguish normal case and CoW case, and keep the warning in normal case. Signed-off-by:

[PATCH v10 5/9] fsdax: Introduce dax_load_page()

2022-01-27 Thread Shiyang Ruan
igned-off-by: Shiyang Ruan Reviewed-by: Christoph Hellwig --- fs/dax.c| 44 include/linux/dax.h | 8 2 files changed, 52 insertions(+) diff --git a/fs/dax.c b/fs/dax.c index c8d57080c1aa..964512107c23 100644 --- a/fs/dax.c +++

[PATCH v10 3/9] pagemap,pmem: Introduce ->memory_failure()

2022-01-27 Thread Shiyang Ruan
memory failure from pmem driver to upper layers. If there is something not support in the notify routine, memory_failure will fall back to the generic hanlder. Signed-off-by: Shiyang Ruan Reviewed-by: Christoph Hellwig --- drivers/nvdimm/pmem.c| 16 include/linux

[PATCH v10 6/9] mm: move pgoff_address() to vma_pgoff_address()

2022-01-27 Thread Shiyang Ruan
Since it is not a DAX-specific function, move it into mm and rename it to be a generic helper. Signed-off-by: Shiyang Ruan Reviewed-by: Christoph Hellwig --- fs/dax.c | 12 +--- include/linux/mm.h | 13 + 2 files changed, 14 insertions(+), 11 deletions(-) diff

[PATCH v10 8/9] xfs: Implement ->notify_failure() for XFS

2022-01-27 Thread Shiyang Ruan
is kill processes with that file 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. Signed-off-by: Shiyang Ruan --- fs/xfs/Makefile | 1 +

[PATCH v10 7/9] mm: Introduce mf_dax_kill_procs() for fsdax case

2022-01-27 Thread Shiyang Ruan
ppings and offsets may share the same page in fsdax mode. It will be called when filesystem's RMAP results are found. Signed-off-by: Shiyang Ruan --- include/linux/mm.h | 4 ++ mm/memory-failure.c | 91 +++-- 2 files changed, 84 insertions(+), 11 del

[PATCH v10 4/9] fsdax: fix function description

2022-01-27 Thread Shiyang Ruan
The function name has been changed, so the description should be updated too. Signed-off-by: Shiyang Ruan Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/dax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/dax.c b/fs/dax.c index cd03485867a7

[PATCH v10.1 1/9] dax: Introduce holder for dax_device

2022-02-13 Thread Shiyang Ruan
activated. Signed-off-by: Shiyang Ruan --- drivers/dax/super.c | 95 + include/linux/dax.h | 30 ++ 2 files changed, 125 insertions(+) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index e3029389d809..d7fb4c36bf16 100644 --- a/drivers

[PATCH v10.1 8/9] xfs: Implement ->notify_failure() for XFS

2022-02-13 Thread Shiyang Ruan
e 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. Signed-off-by: Shiyang Ruan --- fs/xfs/Makefile | 1 + fs/xfs/xfs_buf.c| 1

Re: [PATCH v10.1 8/9] xfs: Implement ->notify_failure() for XFS

2022-02-15 Thread Shiyang Ruan
在 2022/2/15 9:46, Darrick J. Wong 写道: On Sun, Feb 13, 2022 at 09:02:24PM +0800, Shiyang Ruan wrote: v10.1 update: - Handle the error code returns by dax_register_holder() - In v10.1, dax_register_holder() will hold a write lock so XFS doesn't need to hold a lock - Fix the mi

Re: [PATCH v10 9/9] fsdax: set a CoW flag when associate reflink mappings

2022-02-15 Thread Shiyang Ruan
在 2022/2/16 10:09, Dan Williams 写道: On Thu, Jan 27, 2022 at 4:41 AM Shiyang Ruan wrote: Introduce a PAGE_MAPPING_DAX_COW flag to support association with CoW file mappings. In this case, the dax-RMAP already takes the responsibility to look up for shared files by given dax page. The page

Re: [PATCH v10 5/9] fsdax: Introduce dax_load_page()

2022-02-15 Thread Shiyang Ruan
在 2022/2/16 9:34, Dan Williams 写道: On Thu, Jan 27, 2022 at 4:41 AM Shiyang Ruan wrote: The current dax_lock_page() locks dax entry by obtaining mapping and index in page. To support 1-to-N RMAP in NVDIMM, we need a new function to lock a specific dax entry I do not see a call to

  1   2   3   4   >