From patchwork Tue Sep 15 10:13:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ruan Shiyang X-Patchwork-Id: 11775977 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 56A9692C for ; Tue, 15 Sep 2020 10:13:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0194021D7B for ; Tue, 15 Sep 2020 10:13:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0194021D7B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=cn.fujitsu.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D949890001D; Tue, 15 Sep 2020 06:13:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D435F900017; Tue, 15 Sep 2020 06:13:26 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C328490001D; Tue, 15 Sep 2020 06:13:26 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0134.hostedemail.com [216.40.44.134]) by kanga.kvack.org (Postfix) with ESMTP id B1425900017 for ; Tue, 15 Sep 2020 06:13:26 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 75F9E1EF1 for ; Tue, 15 Sep 2020 10:13:26 +0000 (UTC) X-FDA: 77264883612.07.wind02_310664227110 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 4B8BC1803F9B2 for ; Tue, 15 Sep 2020 10:13:26 +0000 (UTC) X-Spam-Summary: 1,0,0,090f470cf52ec8bd,d41d8cd98f00b204,ruansy.fnst@cn.fujitsu.com,,RULES_HIT:41:69:355:379:541:968:988:989:1260:1261:1277:1311:1313:1314:1345:1437:1515:1516:1518:1534:1542:1711:1730:1747:1777:1792:1801:2198:2199:2307:2393:2559:2562:2899:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3872:4250:4605:5007:6119:6120:6261:7901:7903:8660:9010:9203:10004:10400:11026:11537:11657:11658:11914:12043:12048:12291:12297:12438:12521:12679:12683:12895:13019:13148:13161:13184:13229:13230:13894:14095:14096:14721:21080:21324:21451:21627:21939:30054:30070,0,RBL:183.91.158.132:@cn.fujitsu.com:.lbl8.mailshell.net-62.16.2.100 64.201.201.201;04yf3pkw9fyagn4oyycec3nsfoakeycnm53czhgqobfrtxrx4scoewephtn4w1i.hupehx94u5msb5tk43zce88gi3kpnageimcwohomfda9qg1y65fy8f56w1fc7xs.4-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: wind02_310664227110 X-Filterd-Recvd-Size: 3898 Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Tue, 15 Sep 2020 10:13:24 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.76,429,1592841600"; d="scan'208";a="99252004" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 15 Sep 2020 18:13:19 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id 2B52448990DF; Tue, 15 Sep 2020 18:13:14 +0800 (CST) Received: from G08CNEXCHPEKD05.g08.fujitsu.local (10.167.33.203) by G08CNEXMBPEKD04.g08.fujitsu.local (10.167.33.201) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 15 Sep 2020 18:13:12 +0800 Received: from localhost.localdomain (10.167.225.141) by G08CNEXCHPEKD05.g08.fujitsu.local (10.167.33.209) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 15 Sep 2020 18:13:11 +0800 From: Shiyang Ruan To: , , , CC: , , , , , , , Subject: [RFC PATCH 0/4] fsdax: introduce fs query to support reflink Date: Tue, 15 Sep 2020 18:13:07 +0800 Message-ID: <20200915101311.144269-1-ruansy.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-yoursite-MailScanner-ID: 2B52448990DF.AB1A2 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: ruansy.fnst@cn.fujitsu.com X-Spam-Status: No X-Rspamd-Queue-Id: 4B8BC1803F9B2 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This patchset is a try to resolve the problem of tracking shared page for fsdax. This patchset moves owner tracking from dax_assocaite_entry() to pmem device, by introducing an interface ->memory_failure() of struct pagemap. The interface is called by memory_failure() in mm, and implemented by pmem device. Then pmem device find the filesystem which the damaged page located in, and call ->storage_lost() to track files or metadata assocaited with this page. Finally we are able to try to fix the damaged data in filesystem and do other necessary processing, such as killing processes who are using the files affected. The call trace is like this: memory_failure() pgmap->ops->memory_failure() => pmem_pgmap_memory_failure() bdev->bd_super->storage_lost() => xfs_fs_storage_lost() xfs_rmap_query_range() xfs_storage_lost_helper() mf_recover_controller->recover_fn => \ memory_failure_dev_pagemap_kill_procs() The collect_procs() and kill_procs() are moved into a callback which is passed from memory_failure() to xfs_storage_lost_helper(). So we can call it when a file assocaited is found, instead of creating a file list and iterate it. The fsdax & reflink support for XFS is not contained in this patchset. (Rebased on v5.9-rc2) == Shiyang Ruan (4): fs: introduce ->storage_lost() for memory-failure pagemap: introduce ->memory_failure() mm, fsdax: refactor dax handler in memory-failure fsdax: remove useless (dis)associate functions block/genhd.c | 12 ++++ drivers/nvdimm/pmem.c | 31 ++++++++++ fs/dax.c | 64 ++------------------ fs/xfs/xfs_super.c | 80 ++++++++++++++++++++++++ include/linux/dax.h | 5 +- include/linux/fs.h | 1 + include/linux/genhd.h | 2 + include/linux/memremap.h | 3 + include/linux/mm.h | 14 +++++ mm/memory-failure.c | 127 ++++++++++++++++++++++++--------------- 10 files changed, 229 insertions(+), 110 deletions(-)