From patchwork Tue Aug 7 15:38:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10558821 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E703E14E5 for ; Tue, 7 Aug 2018 15:39:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3DAF2A464 for ; Tue, 7 Aug 2018 15:39:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C622A2A470; Tue, 7 Aug 2018 15:39:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 627C12A464 for ; Tue, 7 Aug 2018 15:39:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390051AbeHGRx5 (ORCPT ); Tue, 7 Aug 2018 13:53:57 -0400 Received: from mail-eopbgr50090.outbound.protection.outlook.com ([40.107.5.90]:43008 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387578AbeHGRx5 (ORCPT ); Tue, 7 Aug 2018 13:53:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Bz2w5fJXdWqMn1oOXDA+rfsXW/U99Vf7ljx+Ic1im58=; b=g1KuV9IDx/Z8Q7e7z5x6BW558qmx4dGjg2apJXJkmqrQKp1Q4ncWfHUHuiOmf/48ejsmWh1/672OTERGcXviXkMxhtUXxnqkrcuIrnkqahbd47kN+uYZiSIrzLOfrDLXo/MdnGLtVgfu23/FALRxrMz1ePUCTGgfz1PEJXt0pTM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by VI1PR0801MB2032.eurprd08.prod.outlook.com (2603:10a6:800:8b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Tue, 7 Aug 2018 15:38:55 +0000 Subject: [PATCH RFC 07/10] fs: Introduce struct super_operations::destroy_super() callback. From: Kirill Tkhai To: akpm@linux-foundation.org, gregkh@linuxfoundation.org, rafael@kernel.org, viro@zeniv.linux.org.uk, darrick.wong@oracle.com, paulmck@linux.vnet.ibm.com, josh@joshtriplett.org, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com, hughd@google.com, shuah@kernel.org, robh@kernel.org, ulf.hansson@linaro.org, aspriel@gmail.com, vivek.gautam@codeaurora.org, robin.murphy@arm.com, joe@perches.com, heikki.krogerus@linux.intel.com, ktkhai@virtuozzo.com, sfr@canb.auug.org.au, vdavydov.dev@gmail.com, mhocko@suse.com, chris@chris-wilson.co.uk, penguin-kernel@I-love.SAKURA.ne.jp, aryabinin@virtuozzo.com, willy@infradead.org, ying.huang@intel.com, shakeelb@google.com, jbacik@fb.com, mingo@kernel.org, mhiramat@kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Date: Tue, 07 Aug 2018 18:38:48 +0300 Message-ID: <153365632811.19074.14026254201855676335.stgit@localhost.localdomain> In-Reply-To: <153365347929.19074.12509495712735843805.stgit@localhost.localdomain> References: <153365347929.19074.12509495712735843805.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: VI1PR03CA0056.eurprd03.prod.outlook.com (2603:10a6:803:50::27) To VI1PR0801MB2032.eurprd08.prod.outlook.com (2603:10a6:800:8b::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8fea4c23-9e09-4c58-c4eb-08d5fc7be4e8 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:VI1PR0801MB2032; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2032;3:AyMVy+6dGfOLA+zlBNLanKxbZ6YX0DxTnIci3l3kNDxmn/Xlzv4/t0QHVW/Ycs28tpOgkgUyO2P2dkYqqa1wrpZnNlS3Ugw+DQHFXtXNJfhdXoznPQfd8w+ka8WoyvtnQpddTRgJ0qfMlJ7FjiV5SWXPK81Ec0tl7hf3TS1bllxCabNPu2kUb4eVlvrO+WPoYYnUpoIYKACH/Z+wX3RZUbVokj6SFnRr9qbYgAxuT2c/gNQ3nQD2mB6AOP8GRUd2;25:7i+mB3K3yz1iqaN8lOW278iliL/ObXg8y6eNeavKR4HFyIXoJRqhAWFRrXwQN4MNP/x+MALZC2aDZ6WNmGfI0nyKi6CDDF0TH0uvlpZeJndIHKThZBdi/YxBZijpCjwBtRd2QzTvY8urcOGisE/uGB5v3X5I0t4SoJKf8A1fqTW1kwoRDJnkshq05FpbxTfwyxJrA6VsHpXk6S5kH/p6XNIQh0gxqZCtHKSUXfbseKZAClpRWSUMsD5IWaT0xUu0ei6TJiyYmObSo+x7t+Iwks5KVtBW74dnOSXmVFlWxnxtTv0FGGITDSmfn9hdoEW1w0fBFkfsj3JyggjeM3Ptmw==;31:vj2N560yOsvJxJzKEeJg64YdRw2/B74IUx2T9eglukKW+I1OEmcp+LDKsa73iZxAoEIOXt0qMb5W6xtDSagpk5gwnGerJqDVAgfvGfj1vjb8R27XyGdejEeezoX6SdwSqaP8n7WgRH6lDCGKXMs/T/Pc92fXSq4g1lJvPHw/RLzjkDyO17mZ+dFls+wdgW6dZeW1QllbMbk3dFN0gscqdZyGjCf3gGj2sxtcjF44VLc= X-MS-TrafficTypeDiagnostic: VI1PR0801MB2032: X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2032;20:9rXmBI09PKWjgywaJNv8ft9Chyq/tJqvJLrzztOz566hQstUMpCL3FZHFvSY/cMflkhLN48Qk0GRCVuAF+RtsMMGa5mBoLPG8ppai4SOrvqniq03LwHL2VPn2Zvrr9/p8NfkB6coUN75pmdScGZFiNRxgW7wfQ4nJbYRprka4To6pvccZ4WWc3+QV7q/d/uokX20e5TQhZReSGF4wV18ZdcurEQMvZ7jK/PwVK25JirVbsEMLKH8jCFWvA2aWgSuRuDl2iBVyQM2YFhFDMeGv7lKPSS0xkSnarA8VfX5ZMadTtAYeezANB/vWhQhu5IXqbvfQo8oQRWegUSAWfy41hPTECNqwaZZ8xmzuse7n7rUwJ9ggUb3jC+KVrGAgmNnatAWCCEj7y4W4hwTndbA17Lku3+h1pXaLw0O+o3sh0FHxT44V+cnIw00YxN8QvU6crYol49RTRKbp8tAgnO/HhPqhyEI5hhrqiiReRxp3errQJ+z5SS8iXHy/qzLxsrQ;4:Pa7mqx1X6+Kd3v9Q7M4jl90VZ5yRr4XYUzn6pjLqgWiJbGtL62mbvVKenz0CIMebd/Ojr7eyklUfGJRQrfYlG1rd+5pixEXDqzYusfDrqpQdAMwDKdrMJb/qQg0FLDhc/Mc9SMoYL/UVe1jAaWNpwbLePeVBsifTKjtG5RrowRNyHX6AyPVsybIoWKVk88Ge+xJsgQSt7vK2p560jxCGRrsAVjKf/6mF5e0hBHQEVo+SKYxyO8hrpCmAhTUsxabWbNDMRJaBx9/cbctUi/HSjw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016);SRVR:VI1PR0801MB2032;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0801MB2032; X-Forefront-PRVS: 0757EEBDCA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(346002)(366004)(396003)(376002)(136003)(39850400004)(199004)(189003)(106356001)(105586002)(217873002)(956004)(61506002)(66066001)(486006)(478600001)(11346002)(446003)(7416002)(39060400002)(7406005)(26005)(186003)(6666003)(86362001)(575784001)(97736004)(230700001)(476003)(5660300001)(16526019)(6116002)(3846002)(53936002)(103116003)(6506007)(68736007)(386003)(305945005)(7696005)(7736002)(76176011)(81156014)(8676002)(81166006)(2486003)(23676004)(9686003)(25786009)(55016002)(47776003)(8936002)(50466002)(316002)(33896004)(58126008)(2906002)(52116002)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0801MB2032;H:localhost.localdomain;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BVI1PR0801MB2032=3B23=3AGnUgD?= =?utf-8?q?5kMD92HHpmpX7f1TxMKX+M8QJbCvqjfoCASxf0iRImahTTP5J3e1Q6XwpxLsgStB2?= =?utf-8?q?L1hQ48NkbMVkcZjl/HFVRf2D95fg+Qp9AAzhvRwIsXFILrRrF0zhmP2/90xrfFfbP?= =?utf-8?q?jb3C2EBwZyi3bLuU53mCTeiWQUAp2o6RbKBSaCO6VGzOmE33TRdGe6y2IShrAtods?= =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OsAtyGVTXAFPu9lKS0HIFn9WPXVuzoBs344jv5a9fiGP/9MreiK1clGSaAcJQ2eNQftohc+tIMePorvhVp/TozdTp1OqFksqDg==;5:h8XaS7IoNmTQJsHQYEFSt826TE5ctqmFbkwixP76qkOvgvBGp5D/TvpeWWoxODJYPUcCPSyGbcHDZYKgzuWPQqfN9iSLa9usFV7GDG4xlkklLzoOV8eOCVtfvzWvoCgfrXpt4t7+36nNEU2gfBcsRkO4UBmwZEjITI4nRMbVhLY=;7:wOGYVhyOpN/64bRXDkgPFn1honJYNFjp8kyoRPncZaeesY+WERxlUfHOzNgNfdBF2ZfKZzPayCy29mlEYBeW5XkdLuxX1Khwt9JPyzf7mBKL6AV7hZKbMWg7F2RSaIgA2+ZRyBIL44QNYkWLdftrImiLZl90OvX3paV/oPvyGN+U42L/g6r2b0uROo1bSPrb5lUPBNWI2zkCBNP9f4i5NHVERBT80+yJgiokl7hImF5jihaE9goG/vSdqmHuOAFO SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2032;20:LqLirqxTPbI5EkhYC25qng7zxJqHDgngQ35x/ExQi88oH59ErfsezBZeYyHW7VLFPpsC0ST1qfuzJ/O5r1RYenqQV6byLdI1Oyvp3ETQms07mD5YSiOzkr0mk2U0G2n6vqeg9dO1TyKgRCHzbBaYkA2MwkNrJ+iVxTZVYskuHN8= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2018 15:38:55.8789 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8fea4c23-9e09-4c58-c4eb-08d5fc7be4e8 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2032 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The patch introduces a new callback, which will be called asynchronous from delayed work. This will allows to make ::nr_cached_objects() safe to be called on destroying superblock in next patches, and to split unregister_shrinker() into two primitives. Signed-off-by: Kirill Tkhai --- fs/super.c | 3 +++ include/linux/fs.h | 1 + 2 files changed, 4 insertions(+) diff --git a/fs/super.c b/fs/super.c index 9222cfc196bf..c60f092538c7 100644 --- a/fs/super.c +++ b/fs/super.c @@ -170,6 +170,9 @@ static void destroy_super_work(struct work_struct *work) list_lru_destroy(&s->s_dentry_lru); list_lru_destroy(&s->s_inode_lru); + if (s->s_op->destroy_super) + s->s_op->destroy_super(s); + for (i = 0; i < SB_FREEZE_LEVELS; i++) percpu_free_rwsem(&s->s_writers.rw_sem[i]); kfree(s); diff --git a/include/linux/fs.h b/include/linux/fs.h index 842fde0f0981..33dfaed0a01a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1880,6 +1880,7 @@ struct super_operations { int (*drop_inode) (struct inode *); void (*evict_inode) (struct inode *); void (*put_super) (struct super_block *); + void (*destroy_super) (struct super_block *); int (*sync_fs)(struct super_block *sb, int wait); int (*freeze_super) (struct super_block *); int (*freeze_fs) (struct super_block *);