[PATCH v13 2/7] mm: factor helpers for memory_failure_dev_pagemap

2022-04-18 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 Reviewed-by: Dan Williams --- mm/memory-fa

[PATCH v13 6/7] xfs: Implement ->notify_failure() for XFS

2022-04-18 Thread Shiyang Ruan
Introduce xfs_notify_failure.c to handle failure related works, such as implement ->notify_failure(), register/unregister dax holder in xfs, and so on. 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 k

[PATCH v13 4/7] fsdax: Introduce dax_lock_mapping_entry()

2022-04-18 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 output the page corresponding to the specific dax entry for caller use. Signed-

[PATCH v13 7/7] fsdax: set a CoW flag when associate reflink mappings

2022-04-18 Thread Shiyang Ruan
Introduce a PAGE_MAPPING_DAX_COW flag to support association with CoW file mappings. In this case, since the dax-rmap has already took the responsibility to look up for shared files by given dax page, the page->mapping is no longer to used for rmap but for marking that this dax page is shared. An

[PATCH v13 5/7] mm: Introduce mf_dax_kill_procs() for fsdax case

2022-04-18 Thread Shiyang Ruan
This new function is a variant of mf_generic_kill_procs that accepts a file, offset pair instead of a struct to support multiple files sharing a DAX mapping. It is intended to be called by the file systems as part of the memory_failure handler after the file system performed a reverse mapping from

[PATCH v13 1/7] dax: Introduce holder for dax_device

2022-04-18 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 instance of this filesystem. - When this pmem d

[PATCH v13 0/7] fsdax: introduce fs query to support reflink

2022-04-18 Thread Shiyang Ruan
This patchset is aimed to support shared pages tracking for fsdax. Changes since V12: - Rebased onto next-20220414 - Do not continue ->notify_failure() if filesystem is not ready yet - Simplify the logic of setting CoW flag - Fix build warning/error and typo This patchset moves owner trac

[PATCH v13 3/7] pagemap,pmem: Introduce ->memory_failure()

2022-04-18 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