From patchwork Fri Oct 28 07:55:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 9401461 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 CE7F860588 for ; Fri, 28 Oct 2016 07:56:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB8322A5EF for ; Fri, 28 Oct 2016 07:56:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEABA2A5F3; Fri, 28 Oct 2016 07:56:19 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 430EC2A5EF for ; Fri, 28 Oct 2016 07:56:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S942102AbcJ1H4Q (ORCPT ); Fri, 28 Oct 2016 03:56:16 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:63346 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S942164AbcJ1H4M (ORCPT ); Fri, 28 Oct 2016 03:56:12 -0400 X-IronPort-AV: E=Sophos;i="5.31,556,1473091200"; d="scan'208";a="25239559" Received: from mail-by2nam03lp0054.outbound.protection.outlook.com (HELO NAM03-BY2-obe.outbound.protection.outlook.com) ([216.32.180.54]) by ob1.hgst.iphmx.com with ESMTP; 28 Oct 2016 15:56:12 +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=R9Wgmi3q6po3tPAN+2JwAW1daIzGWBuwNDAreHidDFQ=; b=oCIjhAk3HuxGJ6GV11fBb7DkP7No45cGKns/h4bPMafZ7c9jC18fmPLMej2ACVXQuvaac42wapB6+1ushKMBR2Fsn2TVUSuCzgnUQxs/9MdWm9U20RgLN9Mm1K+YasADppChVzZt8FoYr2Ulv9lgRyKmacW2hRSei71u1p57mbE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Damien.LeMoal@wdc.com; Received: from washi.fujisawa.hgst.com (199.255.44.5) by BL2PR04MB1972.namprd04.prod.outlook.com (10.167.97.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12; Fri, 28 Oct 2016 07:56:07 +0000 From: Damien Le Moal To: , CC: , , Hannes Reinecke , Shaun Tancheff , Damien Le Moal Subject: [PATCH 5/9] f2fs: Always enable discard for zoned blocks devices Date: Fri, 28 Oct 2016 16:55:33 +0900 Message-ID: <1477641337-12321-6-git-send-email-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477641337-12321-1-git-send-email-damien.lemoal@wdc.com> References: <1477641337-12321-1-git-send-email-damien.lemoal@wdc.com> MIME-Version: 1.0 X-Originating-IP: [199.255.44.5] X-ClientProxiedBy: CY4PR02CA0042.namprd02.prod.outlook.com (10.175.57.156) To BL2PR04MB1972.namprd04.prod.outlook.com (10.167.97.144) X-MS-Office365-Filtering-Correlation-Id: 6a1420c6-9d27-46fa-c66d-08d3ff07e128 X-Microsoft-Exchange-Diagnostics: 1; BL2PR04MB1972; 2:shnyPrz47Gdwr5CnIsp1ZTTJ0HvGzAaoZPDt2ifuI7yvMF+TuI9PtEUsOtQB5oYA17s5DSAqiLxAdm/uPag87IkKT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Q30q+e2zZv3GAebETn+wKYA/84ACRyvVJvOLmUeM= X-Microsoft-Exchange-Diagnostics: 1; BL2PR04MB1972; 31:7+jNut/E4lj6jaSs3EExTQK6ss2cFM9ghoBvX3tx5rW9PHgcvvTKE7UQaqO/0uAJXqY4Z5e5u/oJjEg+RNSWn5fIw7xk7fGggB8wQfM/qB3+hTA+uQY0ZJ2nnG98i1X6Dslkr1HuHDqAm/MQMQSR3pUtTIYermS/izwuhJ7rbhbqXQXa069uBCE1u/XZwRENPHkZj8szz6EwqXZXmDIBIzhIS1AN/U4BVojQ2PQrEzwSPGCThnNzUSQKwTeP4L9t; 20:E1WqMMyD/diWJjyXj1UKl9j/D3cfRGKg0fRDtWa6jIwZFgw8CDRri08RQ8R0dnrlR+mCvif6eMqJphJxgD5fKD1wsD2U2atRnkuPF4BZ3ut/lKr1SKhdpPziYcI17f0+PFjHLSiaKea9Gyhkwx5g+01xsl58E/0yPhs19Po3/ALrMwM4hGsJoOLJnm+ednfvDXMBgtCZtKZukf6gRnxnSeB7AMlJYHaqIQnOd7zgykb/sueqyxrRn09Ba9mnSPP5aMpMzmV7hKuSlLavZnFxvuUODCNSF6JYqc8aV1oTQr4/cKGP6EcaYUxpvd8NK+90w9ybFhrkBIPz+FUWXVZOKE2ZlAcKy/0WGxgSYLtJa99bXPyQLYQhy97/I/X4pIu7ZxbyGqjRbf6jLguJIS56+rj/oXYDevvjBwiTRbcfihTkAI1nUsymnPwvAwMQukmlEiggJ71E4QeeDINsqfC3YR3/d3vr4cgucJ4Fa7IviqkyKoZSmvvqLXADxYxLbBFS X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:BL2PR04MB1972; BCL:0; PCL:0; RULEID:; SRVR:BL2PR04MB1972; X-Microsoft-Exchange-Diagnostics: 1; BL2PR04MB1972; 4:4Cw9AvjVC2Ujndhu/Qk+8cFizvcazaoc0he8YbPvfuuVlNumMrUccP2ppX0BfYaL/22d/sYno/2ZtPa5oy8qH1A2f3Ae+ODgsbUBMhu4782ACKsSCxapJij+pAELdggAaEOkjx9WyU5hmMA12VoATdTBQ9PQat2MT4zNeJe2xDC1HHeS6YovTMNrjtB+7YMo9giDco/MwW+zsiKtD9X92JWKRMHfcjOIBBLH0tBCMQ/3Ca8X9CeQEBx6fjNNa+CKhjBtxmoiXRwHq5aBuYYvT2FpIH1RhpI3DR/SZsWAaCInLKZMPFC5IPXC3nXwFhWFrCh2qg8j87xX21r2WuUmLdz5zubTqfnUJfIjkfgFcM4Ds9ExOkb3UchZ0Q8RzlsyBx7pKsS1n5BYxZbay0WOXWdOi6r9IYH1zIGmg0nO2LE= X-Forefront-PRVS: 0109D382B0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(189002)(199003)(7736002)(305945005)(7846002)(81166006)(77096005)(92566002)(4326007)(5003940100001)(6666003)(2950100002)(3846002)(76176999)(50986999)(68736007)(2906002)(50226002)(81156014)(8676002)(6116002)(47776003)(586003)(66066001)(19580395003)(5001770100001)(19580405001)(33646002)(106356001)(105586002)(229853001)(101416001)(189998001)(97736004)(36756003)(50466002)(48376002)(42186005)(86362001)(5660300001)(7099028)(5005270100013); DIR:OUT; SFP:1102; SCL:1; SRVR:BL2PR04MB1972; H:washi.fujisawa.hgst.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: wdc.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BL2PR04MB1972; 23:diat3BrkSdagUD8XkR6TV5Cuk0LgptxYvvtjPK4j1?= =?us-ascii?Q?yBCqN2l7hx8tu36qJRxroHtzveSKRVE/zl4+XjPNPpziXwtEhfcyTtbIexYw?= =?us-ascii?Q?oEjYJR8WQt3uQFjR6juvxFna28RVybKhYaxY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tgqa7HinsTYfEe0Prd+TyrUwMsgr3cZAfbRX3or8MAq0NI?= =?us-ascii?Q?qvXW39two3JFfHncji5QOdcx/S9J29plGzNLKMfvL5u7iAVprNXe1vlcOu9T?= =?us-ascii?Q?fvnqYnYdt8=3D?= X-Microsoft-Exchange-Diagnostics: 1; BL2PR04MB1972; 6:HCQ7LJXFmYMRHJaMUBHeE4MQqBcMcikczRgAw8UQJoI8VmJxjhZemeyjLzchu5SdXKJsoCNhLMEPVUUwZaYPiOZGPZ6Rh6eRCYKEBPeYKxcTla1JDnLXA0vQsNtXArLCv4XoM0t4VQL9KgmxBu6N2Y0wI4BVx74AlODtCYCv0B9C55UFZM+ieONVtqll/Eac9XBCrRQkz1YgW+N0msaoAWzeDAxh+wnbGX/FWA8godsmTfnx8vupisnf2fHet/s4Xefg7C8UTbB1+c9KL7QO2X+JhVQHiQPqU6APo1FJBYQGxpT2f5C9jSpY1uLfyBbiHBg5zuzwdXmxpVNKHj3xlfEPFGFcVYEtSO/sKCwYq24=; 5:QsihEFL86k8wGiMC8ZQ0EdGhJIvc2yRVvheMYDWq4iMH08HIsTwzUJPg78+k76XW8awkjVyHDpc3XITuQDubvaW6lcRuyvhEiF36OHgb3KkDO5u+RtjHupjuDgioxE8Wd8TIR9I3EhUlTkT5G1DBgQ==; 24:RQSRT74OmGnenSvMzZjOFjP1L5OoPJgpQAxGg7Tqu+vzBZ83nwMZwQtHROHNmB6bqeG+MHY8nz6BKg1RO2YjvEJGfT4gvGITRflelHrdRg4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BL2PR04MB1972; 7:uTTQJ28WcbzA4cwH8BOxDC3N0D8MovXl2RJbmQdmfkmqMG16V1gdgPOKVM+YhP2bjalR1mIOOnR/OokJw4ZhkiSstTRZrPlEGDCi6LIiEuaVq53X3fZdAjmfumLVp6wHUKgZsBu7nwTB1OxJBllqWWOMI1wk2oZKwunVmGEvO8LFMVqd9nWOL/uL3TgYe4/hEaKALzfYBfnmLdDRjThFSbCISqcIeHnOBNHHy4TFuEqznNK8j3TwVGW4FMqWSHImnYx8IU+cQ/jb56/rBaNspZ6pksGFMqT55iYQGKJlw7mSkZ5+oAN9u2AM16mI9xiLTIEFAz5U1tYDl/HhoKOCyWqlv8qbUrkblF5Yd1FRwm4=; 20:W9upCod6mmYndQ13ep6zHN8pJniZax/MQZqMhx7W9xdUftQX30VEMQb5TfxQDqgK6UIg58Ja8d7znSM5phPVmh8E9U/Q1wvMvV70mL9mfV3E1u4zMj+Ly/vea+xjre7th47x8hj94VOytdJZGNdD/ByYzxr2DzLPgGlm55FXIKbUrcslR+sWFcYqpSypxRFp/bABa2cbetjK/1rcjE3VO394uCijoQQtUcN0PrLkF+LHIwBT3PqednFaBqkZobX3 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2016 07:56:07.7846 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR04MB1972 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 Zone write pointer reset acts as discard for zoned block devices. So if the zoned block device feature is enabled, always declare that discard is enabled, even if the device does not actually support the command. For the same reason, prevent the use the "nodicard" mount option. Signed-off-by: Damien Le Moal --- fs/f2fs/f2fs.h | 14 +++++++------- fs/f2fs/super.c | 5 +++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 2fc771a..beb2093 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1105,13 +1105,6 @@ static inline void clear_ckpt_flags(struct f2fs_sb_info *sbi, unsigned int f) spin_unlock(&sbi->cp_lock); } -static inline bool f2fs_discard_en(struct f2fs_sb_info *sbi) -{ - struct request_queue *q = bdev_get_queue(sbi->sb->s_bdev); - - return blk_queue_discard(q); -} - static inline void f2fs_lock_op(struct f2fs_sb_info *sbi) { down_read(&sbi->cp_rwsem); @@ -2417,6 +2410,13 @@ static inline int f2fs_sb_mounted_blkzoned(struct super_block *sb) return F2FS_HAS_FEATURE(sb, F2FS_FEATURE_BLKZONED); } +static inline bool f2fs_discard_en(struct f2fs_sb_info *sbi) +{ + struct request_queue *q = bdev_get_queue(sbi->sb->s_bdev); + + return blk_queue_discard(q) || f2fs_sb_mounted_blkzoned(sbi->sb); +} + static inline void set_opt_mode(struct f2fs_sb_info *sbi, unsigned int mt) { clear_opt(sbi, ADAPTIVE); diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 2313234..2c8a12e 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -419,6 +419,11 @@ static int parse_options(struct super_block *sb, char *options) } break; case Opt_nodiscard: + if (f2fs_sb_mounted_blkzoned(sb)) { + f2fs_msg(sb, KERN_WARNING, + "discard is required for zoned block devices"); + return -EINVAL; + } clear_opt(sbi, DISCARD); break; case Opt_noheap: