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

2021-09-24 Thread Shiyang Ruan
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 mf_generic_kill_procs() is, it accepts file's mapping,offset instead of struct page. Because different file's mappings and o

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

2021-09-24 Thread Shiyang Ruan
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 corresponding to this file's mapping,index. And BTW, output the page corresponding to the specific dax entry for caller use. Si

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

2021-09-24 Thread Shiyang Ruan
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 be a global lock rather than per-device. So, change the current lock to rwsem and introduce a write lock fo

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

2021-09-24 Thread Shiyang Ruan
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 filesystem in which the corrupted page located in. With dax_holder notify support, we are able to notify the

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

2021-09-24 Thread Shiyang Ruan
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 it is the backend of a filesystem, the holder will be the superblock of this filesystem. - When this pmem

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

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

2021-09-24 Thread Shiyang Ruan
This patchset is aimed to support shared pages tracking for fsdax. Changes from [V6 RESEND]: - Move ->memory_failure() into the patch who implements it - Change the parameter of ->memory_failure(): unsigned long nr_pfns -> size_t size - Remove changes(2 patches) for mapped device - A

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

2021-09-24 Thread Shiyang Ruan
This function is used to handle errors which may cause data lost in filesystem. Such as memory failure in fsdax mode. If the rmap feature of XFS enabled, we can query it to find files and metadata which are associated with the corrupt data. For now all we do is kill processes with that file mapp

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

2021-09-24 Thread Shiyang Ruan
For reflinked files, one dax page may be associated more than once with different fime mapping and index. It will report warning. Now, since we have introduced dax-RMAP for this case and also have to keep its functionality for other filesystems who are not support rmap, I add this exception here.