From patchwork Wed May 24 05:02:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 9745047 Return-Path: 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 4C42560210 for ; Wed, 24 May 2017 05:02:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38F9A288C7 for ; Wed, 24 May 2017 05:02:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C39F288CD; Wed, 24 May 2017 05:02:49 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham 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 19440288C7 for ; Wed, 24 May 2017 05:02:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965712AbdEXFCk (ORCPT ); Wed, 24 May 2017 01:02:40 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:31087 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936312AbdEXFCi (ORCPT ); Wed, 24 May 2017 01:02:38 -0400 X-IronPort-AV: E=Sophos;i="5.38,384,1491235200"; d="scan'208";a="19933880" Received: from mail-by2nam01lp0182.outbound.protection.outlook.com (HELO NAM01-BY2-obe.outbound.protection.outlook.com) ([216.32.181.182]) by ob1.hgst.iphmx.com with ESMTP; 24 May 2017 13:02:38 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=q0Z+Fe9KMBjMuRObToVnt7EyEUZzz0EBYJNEO/U03lM=; b=Gz0by2UWYjDKE0/1URbbf5/3+stSW1uzcPguPC3E6V1ScE1/vdU2W7RBYF9k6N6nt2W0bkCEe7xhnWuT9Qz+lOM7aKiFJNS/gZ40ioDlEjKoWaZ/ZKsETHafMTWiRrLC3sTOUBEPXQyEAl6CwhvyWZSdxoIyytApQ8djuS01RYE= Authentication-Results: lists.sourceforge.net; dkim=none (message not signed) header.d=none; lists.sourceforge.net; dmarc=none action=none header.from=wdc.com; Received: from washi.fujisawa.hgst.com (199.255.44.173) by CY1PR04MB1977.namprd04.prod.outlook.com (10.166.191.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14; Wed, 24 May 2017 05:02:34 +0000 From: Damien Le Moal To: linux-f2fs-devel@lists.sourceforge.net, jaegeuk@kernel.org, yuchao0@huawei.com Cc: linux-fsdevel@vger.kernel.org Subject: [PATCH] f2fs: Do not issue small discards in LFS mode Date: Wed, 24 May 2017 14:02:29 +0900 Message-Id: <20170524050229.13213-1-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.9.4 MIME-Version: 1.0 X-Originating-IP: [199.255.44.173] X-ClientProxiedBy: MWHPR2201CA0003.namprd22.prod.outlook.com (10.174.164.16) To CY1PR04MB1977.namprd04.prod.outlook.com (10.166.191.13) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY1PR04MB1977: X-MS-Office365-Filtering-Correlation-Id: bac8aced-b9e2-4c28-239f-08d4a2621796 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(201703131423075)(201703031133081); SRVR:CY1PR04MB1977; X-Microsoft-Exchange-Diagnostics: 1; CY1PR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3qJcpTTOZCcAuysrFxy/8XXSsOf0YYuVXywzZ6TAnBcDV30I2zBcCGB6mqBzizSpva71kOWWG; 20:So+6xKK8Hf+rD+6nKOj+Pn4yR0vFmMWCxPV/D20WUWT4SWAfA/vTSP/cbgff+MnH2I0+lgQwdKWRzQXxQFlWXFQwujqUZnH/iOsUVyX6YxnKcag0FlnTBIySCDISpZWZj8sjEXP5eErNZH0dFk/D5Pc5dl9oH0HeoG/h7wrkPGaqzzql4FXhr10WdXu8UOtzzyaxhQn+LUuKj/aTnHdkKujHtKQ3po0leTpfyd77R5pMPctUA1o0iWoCMpVk1LX2t6gfTJr37ejrhsNH3H8qFWMN92rQ2/Q3Xs5HgjnIO5ftw5q6FDtLtnBLhqz2D2leHNV5hkBevPLKqmPDUvMKUrBLS6BpTraKgAG/MGLfirl9Ly8BMZY04oNKnbrbLXyqFncvw4Pv9oBw8IiMdCRrGItUPVy8Wa4o0G183rejTxq37crWPkZAi/2OerLwwmXfY3BJGSgJnP8K+Dk1S22xM2TuQM27cGRsh32n4gjZbIKEAftzid/38G6URmw8Hhlb WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041248)(20161123560025)(20161123558100)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(6072148); SRVR:CY1PR04MB1977; BCL:0; PCL:0; RULEID:; SRVR:CY1PR04MB1977; X-Microsoft-Exchange-Diagnostics: 1; CY1PR04MB1977; 4:nqC262O2AjJ56B5cgSPMJ/RXquvQi3ya1cMlNELW/+ikysWNo0Oq/Kmaa280UkNZph9nLsh0M2LkbEX8JL0GJBUfLFRqBZXSmWZ+Z9o5ayrqX3XqwSZqSWO5+/lchjhJaUv43j96NG+rRqlCbQh6aUXKWzFR2kCiVU4tFBW83TQ6x+js8X6Q8Or8GIPsy0usZmvOTp7RBlGSTFyhuBi2MWPNPVfZFQivz2X28c9HjJPPbophMA3Ar1VnfIhaxcWuPNb1B7TfvRROpqC9gZBnX59BE8GCAnDN9ii8ziFXKT7ySGf8eRHvgu0BRG4sZL9RLf71/6fSL+tKXqUU/2ghmc1GV4MNpqY210Bl8HY4fRXeHTLVGSdJF0IJIHJPmo8KAAPO/6YD/L8agjkca9Vev6eeIX4AbZaYuhu4kxgG+D2Xc3XN5tbudY3m/+5GbH38BjvwJ8hqKSPUUqTl6cDKGmk5r5w+bmsEp4E41+FD+ZZOqDW2HVIhmE00tivYH9FOUg78o+sTrZeC7BuB1nFFh/ZkMwBRkUzNC5q6s5zJdsUA5/+TnpvQXz5fBjlhT6OF+IoCqpLAOWcfJL3pqd3rm7VrERR0pZNV0WfSbO4CxWVxTRt6vjMXrx757MNapJDnq5qBKyQBPsVyBaT7ki5NnsrbQJCs4CzDnhZO/f4dMVHSAIIlMzK8RYz7CWlkeQvJ1RZgwDm4bF0PxpEGAVs3y9n1gLV+Cc/fmXo7Yy5KMiRf+eRzlMWslhxw9jJwqK5wL8nuOTYbxCmOpIZ44MyYvPd8CVas+8/k+2yYrCFS+wg= X-Forefront-PRVS: 031763BCAF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(39850400002)(39400400002)(39450400003)(39840400002)(39410400002)(39860400002)(42186005)(50986999)(478600001)(8676002)(81166006)(53936002)(6506006)(6512007)(50226002)(6116002)(33646002)(3846002)(47776003)(72206003)(6486002)(4326008)(305945005)(5003940100001)(7736002)(25786009)(36756003)(189998001)(2906002)(1076002)(86362001)(38730400002)(66066001)(50466002)(5660300001)(110136004)(6666003); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR04MB1977; H:washi.fujisawa.hgst.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR04MB1977; 23:L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= =?us-ascii?Q?/FEOcWgdAK7L766Oe+K2lGYRbgA++VcOjNaMK4MYewiIBDrsN/h9HNgw4dy+?= =?us-ascii?Q?SPNB+LuxpY65yOmM8fKjQiAGSkYZsEQpQlI9RNiSsFDl+TR3UxDGdbm4yWJ0?= =?us-ascii?Q?Tbvp6NfzRFwLQspyjyV7ZTS?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR04MB1977; 6:0HBYftG6x1IIOdxQvrQ67wTuXb/RwiKkAiRbA5LHbKJH0s2u+1H7Zz2wSVryDfd//ph6hWV4jZ/g+a3cPEwe4y73CuQLtAemRapu/v1lyop330JSVR6dS1ojnVPw49UldFHvvJLAN7X7MjNQvqLe7bjChPT6Q8nw4Way8iKu1Y/DwPtTfMCpFNaPRJoZhNiSEpRtrzqQs476DzvD5ffXBtwOExG3ND0FTZFXYYx3cbxu0QubjiUXlS0BrUPeNkUtasc/1inUGRUXu80Io8g3wCwA9xs69Ah2HodRcgpkJQZWL3LfY8MUYsw+IAi3k3QtCN+f27H6CQiUWafD8u2iJNW/YwSkEpj+iiP94PWLfQPcZYg7x3ge6EDeHK57OK0JRhcITxtWjAQ1asijusFvHmWdcgcBNbMrPzQob2WitIZ8fqRLeYZMLs3bUM0p2LJsOyR37skTSQm9be9UfauYAxNvZHWj9nAGSw24rzSIzn/DCERongneP8xmgSvUrtExZa/Nuu6DTnyvwJ1KMwSNsUOAkWhrpfp6Bx1VSkWc5ts=; 5:pttgrLBOTHv1YmeaucnAouuHRBC7v6KoaoQH9ReuymSBHxQHxf00XvdWxw83eDOOhyApSk4lIM6lafTK/h2jIncoyuKoxJATZCyWUJ9nHF+DSpP4q5PCp43keg4fPBcoCDjPoOLEZvcexFSrpC/I4A==; 24:7XS+oilCC1Okh1kzPlGaNCZBErcpahWhbSv5lQOnETU+N4K31ChuxUpC7DVk29bcC95lQ55BST9RtwzOw8kxVq671DWxqfgB2BlYIgfBBgw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR04MB1977; 7:0zLuKU4q2sY4l2ROlw/Tb1vSbiwPSd7gx1fFzYWnBaZXGdBUKW0nM5AjdGP6SGg9E2XBQpvPyuUOcUpwiu6igTwEPaO34GUPC7JRKodW7BfgQcg3eKmLgJjddTxy1zNSCVfcpaBxw+bJiR6NbRgfbBbEbcrn3hL1treCe58b8ViZn3o+myIk3A1QxQgRZ/OTYJk85Gv49xE03podJSDzY/0Zgt5je7w0KWpXgKYJyPAgKnm6SPnD4GrJtm95NoPCfmKBKJgOTtV+YaOFxg9NH0ZBCTRziOmHfleQ+ix7GkOaVc9R84tnZEQtk77/MmgmJNvvSTbpgOpNABmtJNhzcQ==; 20:3gyl0vefQI+5oop0HNdcttjoNn4pUrIK5gdQuo6eDVhsR7FhRQ1+HrQRteKheNnkQlbzuvHfYZXe5EhZREfg3Mi01m5PvnOIrS1gZX8fMK6RN/W4LbmYAUSO67LKLnMhkMHDWdW570DlkrvKW8Unmn9+SFU6W1YpWafCaiWUzic= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2017 05:02:34.1564 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR04MB1977 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 clear_prefree_segments() issues small discards after discarding full segments. These small discards may not be section aligned, so not zone aligned when using a zoned block device, or more generally, when mounted in LFS mode. So do not issue these small discards when mounted in LFS mode. Signed-off-by: Damien Le Moal --- fs/f2fs/segment.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 9684585..3d190a7 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1322,7 +1322,8 @@ void clear_prefree_segments(struct f2fs_sb_info *sbi, struct cp_control *cpc) sbi->blocks_per_seg, cur_pos); len = next_pos - cur_pos; - if (force && len < cpc->trim_minlen) + if (test_opt(sbi, LFS) || + (force && len < cpc->trim_minlen)) goto skip; f2fs_issue_discard(sbi, entry->start_blkaddr + cur_pos,