From patchwork Fri May 26 08:04:40 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: 9749907 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 7FC1D60249 for ; Fri, 26 May 2017 08:04:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E09E28304 for ; Fri, 26 May 2017 08:04:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 62065283BD; Fri, 26 May 2017 08:04:58 +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 8F99628304 for ; Fri, 26 May 2017 08:04:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759925AbdEZIEy (ORCPT ); Fri, 26 May 2017 04:04:54 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:32980 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757752AbdEZIEv (ORCPT ); Fri, 26 May 2017 04:04:51 -0400 X-IronPort-AV: E=Sophos;i="5.38,396,1491235200"; d="scan'208";a="20532368" Received: from mail-bn3nam01lp0182.outbound.protection.outlook.com (HELO NAM01-BN3-obe.outbound.protection.outlook.com) ([216.32.180.182]) by ob1.hgst.iphmx.com with ESMTP; 26 May 2017 16:04:50 +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=ng3LyFcShoeQUMcypDqVvCJ8OR2nKLW4Vgs47UzNkRQ=; b=b2CXVt4Im1BhViQE/5mg/XkDOL1ZRXPTWkOXH8tEGdJ4bx0XIhYvAKsi29I1cyWUwLNZWbXtF8UQLZvAJT/ok8garnGVaNb/x0LKBy8p+RPCOYti3ITGKV74yJuoY67FlsUyA1Nin9wjEP0cbckl55cgkW5NWOuXStX4Y+OogJI= 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 SN1PR04MB1982.namprd04.prod.outlook.com (10.166.69.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14; Fri, 26 May 2017 08:04:46 +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 v2] f2fs: Do not issue small discards in LFS mode Date: Fri, 26 May 2017 17:04:40 +0900 Message-Id: <20170526080440.11160-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: BN6PR13CA0030.namprd13.prod.outlook.com (10.171.172.16) To SN1PR04MB1982.namprd04.prod.outlook.com (10.166.69.142) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PR04MB1982: X-MS-Office365-Filtering-Correlation-Id: 0ed476b8-75b0-4f97-00c9-08d4a40de06b X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(201703131423075)(201703031133081); SRVR:SN1PR04MB1982; X-Microsoft-Exchange-Diagnostics: 1; SN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CkloaIDGcK1RgtQFVOdRUkq1dHaN/rHXNPXe42F+HLfV+qXvmiBUYIi6Rv9qAmC9xsGtwaZALjvvMzm7TfJgzPeb9oT6qfOGP1MyR; 20:LjIpBT85jQV5HllWf3g24oHyfkjQ3JXo00IyZJM4HrttjlBEdiM57MktTaQkWO6j1EJNKwfIKwuyThwGfTDMVAkHYBk648zRmd4wzgAnnrz0yGxVNh4IYT7od/983mmPyrm7mTpItu/glrfctPf98sSPR/x+NI12TxXzO6naDhnCu1PS8goyJPSuxriYxHL4FFfohfYwbn6Whzdpy/26mr1tQOQMSXPKzTdBsh9yEr5gobX4697LRdyKNBCgQ0H6L0plsHdn39dyCbEnISpyJ18JAuEzXhlPm840PjwGgTV70VFxuM8h+mRYE4CUuzlrJAbAebS1vuaUeQU4Nj6SRtebufjJg9bFCg1TIP61gehcVSl1/uldEjV+Lp3Hfm/FtRKtzyayAlvZS/+c4MuYWc1UTy49mfeDB3WxefnPuO8DK21SikS5qWtUudzQqRO/G+Lz2DgN/1xanYqKsJkCHzKOYCODt7yqWslBvLB5b8B0n4puS2W6oPjDjThp7f9M WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700061)(100105000095)(100000701061)(100105300095)(100000702061)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(100000703061)(100105400095)(10201501046)(6055026)(6041248)(20161123560025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123564025)(20161123558100)(6072148)(100000704061)(100105200095)(100000705061)(100105500095); SRVR:SN1PR04MB1982; BCL:0; PCL:0; RULEID:(100000800061)(100110000095)(100000801061)(100110300095)(100000802061)(100110100095)(100000803061)(100110400095)(100000804061)(100110200095); SRVR:SN1PR04MB1982; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR04MB1982; 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9?= =?us-ascii?Q?5FX2ubTx9q0S2vbZJCs129gHRLcUs1O5JUunXBNhk/XxDcABFFwdwRixCMVM?= =?us-ascii?Q?t2Zv3fLPuUWAy5u3dP2L+FRnTxaD14W1tAr2XpCJEBLOwqQTQ1xF+SXOJfTA?= =?us-ascii?Q?mp2c29E98fgFEN0rNOUqFH/j1CcaIywl0HluLe6gb/EU+XvrnjZQHbRWQimL?= =?us-ascii?Q?Ypv1jh4ksZMKqganNkz9nEc/shbWWDhn4w7xWc+ALZBe9DhdgLMlRjXbgW52?= =?us-ascii?Q?69SrRzwqf+DcZqPMhLGSC/cFzCiyXGdF3fuVWE83jEA/4jR84NIg=3D=3D?= X-Forefront-PRVS: 031996B7EF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(39410400002)(39860400002)(39850400002)(39400400002)(6486002)(6116002)(36756003)(47776003)(50466002)(5660300001)(3846002)(50986999)(48376002)(189998001)(53936002)(6666003)(33646002)(6512007)(5003940100001)(1076002)(305945005)(25786009)(86362001)(42186005)(2906002)(478600001)(8676002)(72206003)(50226002)(7736002)(81166006)(4326008)(6506006)(38730400002)(110136004); DIR:OUT; SFP:1102; SCL:1; SRVR:SN1PR04MB1982; H:washi.fujisawa.hgst.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1PR04MB1982; 23:lsK+qgYkaamPlxyhNbNQsRwb/Hq184aUb7OG70t+4MfO0kO9x8967iB7Xw7FZGIg4AQvEBLv9V2AxFUZXTaeSQsainy5vio9TNp1BbBshqd1WGN0TffTNsw6aX6APa0BOzcHCFjswBuh5HD47ZFfvhvGxulmTXrJPfNYwECtgy5ehiabsv7AWUd5qNsoYzhflLlR4bALNZxJnJHal94rQ4lNvg8E9/w6+2pES2I7oGUKOFrYgOhyNRlmTSHRhbu1uM76JplaKWvAdbOe5Y5ldm6sXrOEdCI8s1LrxyI4SzPTOdbPPDdSIS0alXmhbQP2UcB8e62LRY5U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OG8YBSRGGD7ETboYLQXtmRSUxw== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR04MB1982; 20:jmoEUU1Nj8yPOiWx57Z5kq92UqjeQJnNDvBLbsQtO64bis41ggHhWwkIWXDRGt4i4itUC140iBL1ZRI9tjO8a6lt12siG9sKaQy0FHKcVwyh3G1E7jK6piXrQxytIEHA42JbiI295eHdxTZhhMMMSXJznCollH4oW+wF7zclsA8= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 May 2017 08:04:46.0001 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR04MB1982 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 on a zoned block device, causing __f2fs_iissue_discard_zone() to fail. Fix this by not issuing small discards for a volume mounted with the BLKZONED feature enabled. Signed-off-by: Damien Le Moal Reviewed-by: Chao Yu --- 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..1279650 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 (f2fs_sb_mounted_blkzoned(sbi->sb) || + (force && len < cpc->trim_minlen)) goto skip; f2fs_issue_discard(sbi, entry->start_blkaddr + cur_pos,