Message ID | 20170414140753.16108-5-aryabinin@virtuozzo.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-fsdevel-owner@kernel.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F06EF60132 for <patchwork-linux-fsdevel@patchwork.kernel.org>; Fri, 14 Apr 2017 14:08:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2BCC28698 for <patchwork-linux-fsdevel@patchwork.kernel.org>; Fri, 14 Apr 2017 14:08:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7830286AD; Fri, 14 Apr 2017 14:08:56 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 80E9B28698 for <patchwork-linux-fsdevel@patchwork.kernel.org>; Fri, 14 Apr 2017 14:08:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753447AbdDNOId (ORCPT <rfc822;patchwork-linux-fsdevel@patchwork.kernel.org>); Fri, 14 Apr 2017 10:08:33 -0400 Received: from mail-eopbgr50102.outbound.protection.outlook.com ([40.107.5.102]:35712 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753030AbdDNOIO (ORCPT <rfc822;linux-fsdevel@vger.kernel.org>); Fri, 14 Apr 2017 10:08:14 -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; bh=ufDNvFvbskdqa0W7NTQhS/Ypmsb/8bi2W0zUUG7LR9o=; b=L+MRCYTw2AsOg1LNICtPnhZA0nsECIDAxxDkzZu6suXJAkCCmwOy43FGsNiWnYKHifvfmFcFgD+ty790YErYMJ9dZIG74hAtH+vQDQ01S9TpnH0s4r8DLNmBXHHX5MTl3vVD1IXMJpNzwzBSUDwepckCoUpQMYn41m+on8xz8Oc= Authentication-Results: zeniv.linux.org.uk; dkim=none (message not signed) header.d=none;zeniv.linux.org.uk; dmarc=none action=none header.from=virtuozzo.com; Received: from localhost.sw.ru (195.214.232.6) by HE1PR0801MB2732.eurprd08.prod.outlook.com (10.169.123.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10; Fri, 14 Apr 2017 14:08:03 +0000 From: Andrey Ryabinin <aryabinin@virtuozzo.com> To: Alexander Viro <viro@zeniv.linux.org.uk>, <linux-fsdevel@vger.kernel.org> CC: Andrey Ryabinin <aryabinin@virtuozzo.com>, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>, Eric Van Hensbergen <ericvh@gmail.com>, Ron Minnich <rminnich@sandia.gov>, Latchesar Ionkov <lucho@ionkov.net>, Steve French <sfrench@samba.org>, Matthew Wilcox <mawilcox@microsoft.com>, Ross Zwisler <ross.zwisler@linux.intel.com>, Trond Myklebust <trond.myklebust@primarydata.com>, Anna Schumaker <anna.schumaker@netapp.com>, Andrew Morton <akpm@linux-foundation.org>, Jan Kara <jack@suse.cz>, Jens Axboe <axboe@kernel.dk>, Johannes Weiner <hannes@cmpxchg.org>, Alexey Kuznetsov <kuznet@virtuozzo.com>, Christoph Hellwig <hch@lst.de>, <v9fs-developer@lists.sourceforge.net>, <linux-kernel@vger.kernel.org>, <linux-cifs@vger.kernel.org>, <samba-technical@lists.samba.org>, <linux-nfs@vger.kernel.org>, <linux-mm@kvack.org> Subject: [PATCH 4/4] mm/truncate: avoid pointless cleancache_invalidate_inode() calls. Date: Fri, 14 Apr 2017 17:07:53 +0300 Message-ID: <20170414140753.16108-5-aryabinin@virtuozzo.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170414140753.16108-1-aryabinin@virtuozzo.com> References: <20170414140753.16108-1-aryabinin@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: VI1PR08CA0039.eurprd08.prod.outlook.com (10.164.95.49) To HE1PR0801MB2732.eurprd08.prod.outlook.com (10.169.123.152) X-MS-Office365-Filtering-Correlation-Id: dd195bc1-6e3a-4c66-21b5-08d4833fabf9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:HE1PR0801MB2732; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB2732; 3:suQeX5yPAfFQPfnTKcw5Xn3d30Z23EUheHnahOGhLS0NJSeUi3gstgLFvj3gAZhjvmmNTMAUV93vkbJJ7EB0WsDoBVbXiAw9omBPT+vla7SWtJz+H+O7hvfEqMhUK4YfltkVxNAap/K0J9TebpvACF52+hMA/2vfJ+N2bd7cuNKWTpe6hJIiRxxBv10cw6Kn+Cl3VKeYZEiGY9SYRZ1sCh17EVjDPOcD6hRHWy1dZ8oAX0Mw/K3RCi4n+1+wZ8s2KF2Mn9wpGeVdQlPggAramrP6S3enaLbu+p+p/uOZQeDnjnnJbzjTQ1qadXQuFZx7pAogNFdAq0y8qU5ETVMZYw==; 25:CmP+/el7uz73qNZHAjGphX9cQxlTmOj9BJ+gJeKOUVOq2yYoBU5AQfWXOxmtM1YK+0ZFN5hj2htRHQA521kSauFNcNsiCvXQSb6rGGSqpGnPlAgFYicw/iZXhc53yxE6HpvZZTq6lwF5TtgA/vho0hC3vkDBlEcr591DOY5QX9uzyTL+gbYqPWL18N9DvjaYmu9kCQ8YLRPR422HKygbuYf0HaqjlMAFCMMBOsL8cmyX8or08uXCMMJ8T9k7yp82nGwBBBP8aOUuFmddOaznmgzh8AzUxj20ZC3jCPDsYxGGJzTp3wUKc6fCKhyIS5UFn/RNAZnPb18fl9nI/gZjWRwRswx9nbh7W+7F1HEcIvq/E/cEr4GraJUMEkAbuJPYHxrTuXVlaBEAXCzov1+FlxIpLXVQOtn65imlfOf8DjavwEAEyWIFPHCL1U1AZNEsAECJOJuDfIDHzyx+UYF0Ww== X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB2732; 31:9n0Fl9yUR7ftQLYk9n1rpDSiRmxuwOAn4QUDQnmWDUQJ4dWY/kGP4tq6IxWD02hnklNbe3e9JLU+eS/biTrIOc2P7wsqUgHauHXV5qA2bZlVvK19FhjjtWVouGprmp3nkPGr/WsQtWpfDBhzB47i1s7Kv2gq5rpug/yYtbiBb6SsZor3dHD2ESAqu/0lR8xcgts49wZlfShSmunaE5lY0k/8JZST11MoOEL9EmPkz5Q=; 20:XUVt7AQ6JZXMpigBmjJRSMjM1b+aKpr2+xp/P40OGhWY5uFAzF3RcIlt/OJKrMW26jq5goHxXZrqA8v/djNd0DfxwteKXuJ+HfFr+hGRedZXuYPwkJKHPkFUcsPzRUZPDuks7F3i472/PQcbn7oWx7C9dCUGNFCmwX7g2ce2p/bnAJKkB1QCWqIzpuL0pcevuYBKQm1nGf1EY9k3GsWEGYiSwJp39oyVedpUkbT2R5X/MLW941/fMkWNx7pMkvkgSKZ41itUcVmNxgyUQSTHgUbg3tce4sBn663MfIsiQZXTmFhXEkdUy/tAx1wR8SZcD5Dnh5wLII94+saQaYaKhvE4wK6/WLYDePkB0BpzY3kKh67WQTolt5OkY04eiCz7NJQKNrwboeUl7tmpybRs0iDF3JXVJgoHraQnbdxRSck= X-Microsoft-Antispam-PRVS: <HE1PR0801MB27324B112850C6B6B16CBA23B0050@HE1PR0801MB2732.eurprd08.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(20161123560025)(20161123555025)(20161123562025)(6072148); SRVR:HE1PR0801MB2732; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0801MB2732; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB2732; 4:N+jM5P0bptwZvLQcmQgcoZg6gjEtJhQIBh1j6UitRprb4nPV40nrcviW0fEew7DUT0BWnWOmV4hOmqpiapxkH0kSZEOj0lvSgxl5LOZdnwjucbWZZpFiyirtAGote6Jw/ETmSBbJg2oVeC7D6272bqxrUsi6/yIYCF1wDCEBzGHU/NvQyPfeXl5TVp1/OcwvhWQN0Fn6H/QENqdSBSG5TixLD9WZtpIiRPKnx/HAW0VKXfWSzSDvMumbcwPj9CXZBB0oXuYeb6dvBHzCxKJj/21t80Vcqppdnx4G45h6MRkKkUoqL9Q66vGqrwvyx15q8y1yVSg801H3EQiZ6UHgYMFOcUb2ThfEQiGQsh0FQX6lzb6XeFWjThMmYrCuzFKynt73az16la7UJNbCo8ni/NMEIVTm7UpFG+aHyUrdECeznY8jG6oaa0+pF2+nUDYyep/1rnYTCNBDHt1G2NncDB6tF/5gdVYgTv1hIW8nHLXkh2tTh0MudH1/MFUJWIClDny6Ey95m6YdV1MI7sgC2XBXUUCj9XMDxmSBfs1JYS7O/dC+sKq5a06HvfhqY5ROZndf+tRP7/W/R/QrXS9hcBYvX5UJ8m4H3n3lqRmRzgoYbTUreM5b5XkPpMm4u25AjqvgCIGMLR/dy1oP5LYCNfgJCGpiv0En7eAvqgKIUXRLFnuDRnessLn5vZr9EUgEFmytMP8OUM5/Vp5HxMKTnw== X-Forefront-PRVS: 02778BF158 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6069001)(6009001)(39410400002)(39400400002)(39830400002)(39450400003)(81166006)(6486002)(86362001)(54906002)(7736002)(575784001)(305945005)(50466002)(66066001)(47776003)(6666003)(5003940100001)(50226002)(48376002)(2950100002)(1076002)(33646002)(53936002)(5660300001)(4326008)(6512007)(50986999)(76176999)(7416002)(25786009)(53416004)(6116002)(3846002)(8666007)(2906002)(36756003)(8676002)(42186005)(6506006)(189998001)(38730400002)(76506005); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0801MB2732; H:localhost.sw.ru; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0801MB2732; 23:JmRNWI3EIREzyO/0ECYEX21vatcPbGkSXyttN7b?= =?us-ascii?Q?PImEHCxPf12eVp1r0eElB1njm0iv9kbPG9hyjJCCLthUeiQ5prBJE8oHaLJ4?= =?us-ascii?Q?Am1jZlgUelwPhD8jm3/nfG8uO6z4CKLSaOkyXfj73HSpI9W88KgGDvor2FDS?= =?us-ascii?Q?W3JSCnx3eU5FWIBhxFfO2G9VaVueaGVUILYs0qaMEkb1PsUgb/l7Qmnjv0Bk?= =?us-ascii?Q?4HxQl6XhrBYRB4TNMXDeRW00SDMLarLuXv7j41ofDiuWSH+prBYnONPIj0n5?= =?us-ascii?Q?F6iBFTjvh+8wIE2C6TgixfIVSzcudgMC6xoAJ9mSAOVjQ8BD0uX24uBoSqC3?= =?us-ascii?Q?l7cUJJXs9QXMJMAM68AcJ7QYBxOC+ZDI6pyTXYgEdgPXE7vB6z6x3m8+9qBC?= =?us-ascii?Q?FS1A28d/SGUkYH1y/TCMBRWL7Clqki0e3CVCJatxJv67sk36OexmhxjNHZ1h?= =?us-ascii?Q?P67GV3fDgCVo7pelNc014Z6zqS0TKDQ0IPajaYStWsmNhXjLwcTPBM/Qd82u?= =?us-ascii?Q?85lUrRpA4ckYZRnuSLDlOwJ+pQHN+JCwefSs827y83L7ANzJhSQ7dAS1vOjd?= =?us-ascii?Q?4XogrXiMPQyNOOj3znM+YksMwT6WyHDn3PuyTvVCXHZMoeZYLZJmkYN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LOHDv5CMGGFsZVJ8XCaxvS8H5+RE86GA==; 5:JBk4KTXFdeFLFqdk41UxBtyAgECDfmhfSTIdnqNzX3+gImQMWBjQqQqNGLC1SGjrD83+kiedL5SlBhVA3xP+XKzusPsfcwG0RiHzOYrPb6TUCl7YlmlDg7qzZL7YmbG6niY1YZC7/WtCmElrJasGTA==; 24:xdXGPUJYvw/ZyKIx0rFu/2auRD8B7bieZGEV+0ufs9L+hR/i0jzQqGpAvfPLblH2SDjBdkevdd/pVA7ayxO7WMsjqi6bJzT0jJB3CLIUgHo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB2732; 7:cRgchkoamew1yPSuqYcu+rcBb51Q1kJ96OQCgRPWEMm/PmGq2tbpwnUcQXIsItGvPTuRe+EiWAyLb3MxmwEdfFE7SgOPk5zBf+uIgH2jMlgcMWm8SVu/GburoKwhRRg3b4c1cq10n8aZpNMHl3VBCfDKEeV5DTUexiaZxqMBtvnl3WtHxzAk2aTQuGJQ/4Jv8Qd5yu8OrdMTvIhW13mEVrFaQ3gZTzd9U3rd1p7O4666k5015RkBr/A3FDZEGs7XGSZAFfsAA5PP5X1kLowpUd/Es0vPjKXOJDf1IMEGIA1lwwYxxuzCM82mgZImNA802TRLEprvYi6Y5R63W6+OZQ==; 20:nJnUP6BdWO9sRBIzi3mFLZP0dFqJogXm/MP5RF5lsh1Q7NHpj8gS5Dz4GTS7pYFSScdMpjeexhCGgnv8zfkIMMZch+9GLSzNPlc+U22PMdkup0M/vA6ivov2opsP9ufDNkCsj8vQb8x5o9oP3/MGTo55WBrAX6xVPzH8lZ25r6w= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2017 14:08:03.1241 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB2732 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: <linux-fsdevel.vger.kernel.org> X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/mm/truncate.c b/mm/truncate.c index 8f12b0e..83a059e 100644 --- a/mm/truncate.c +++ b/mm/truncate.c @@ -266,9 +266,8 @@ void truncate_inode_pages_range(struct address_space *mapping, pgoff_t index; int i; - cleancache_invalidate_inode(mapping); if (mapping->nrpages == 0 && mapping->nrexceptional == 0) - return; + goto out; /* Offsets within partial pages */ partial_start = lstart & (PAGE_SIZE - 1); @@ -363,7 +362,7 @@ void truncate_inode_pages_range(struct address_space *mapping, * will be released, just zeroed, so we can bail out now. */ if (start >= end) - return; + goto out; index = start; for ( ; ; ) { @@ -410,6 +409,8 @@ void truncate_inode_pages_range(struct address_space *mapping, pagevec_release(&pvec); index++; } + +out: cleancache_invalidate_inode(mapping); } EXPORT_SYMBOL(truncate_inode_pages_range); @@ -623,9 +624,8 @@ int invalidate_inode_pages2_range(struct address_space *mapping, int ret2 = 0; int did_range_unmap = 0; - cleancache_invalidate_inode(mapping); if (mapping->nrpages == 0 && mapping->nrexceptional == 0) - return 0; + goto out; pagevec_init(&pvec, 0); index = start; @@ -689,6 +689,8 @@ int invalidate_inode_pages2_range(struct address_space *mapping, cond_resched(); index++; } + +out: cleancache_invalidate_inode(mapping); return ret; }
cleancache_invalidate_inode() called truncate_inode_pages_range() and invalidate_inode_pages2_range() twice - on entry and on exit. It's stupid and waste of time. It's enough to call it once at exit. Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com> --- mm/truncate.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)