From patchwork Fri Apr 21 03:55:56 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: 9691727 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 BEF156037F for ; Fri, 21 Apr 2017 03:56:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B26AD28334 for ; Fri, 21 Apr 2017 03:56:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A69EF285E4; Fri, 21 Apr 2017 03:56:41 +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 8C7F728334 for ; Fri, 21 Apr 2017 03:56:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1035033AbdDUD4j (ORCPT ); Thu, 20 Apr 2017 23:56:39 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:18196 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1034979AbdDUD4g (ORCPT ); Thu, 20 Apr 2017 23:56:36 -0400 X-IronPort-AV: E=Sophos;i="5.37,228,1488816000"; d="scan'208";a="114480112" Received: from mail-dm3nam03lp0015.outbound.protection.outlook.com (HELO NAM03-DM3-obe.outbound.protection.outlook.com) ([207.46.163.15]) by ob1.hgst.iphmx.com with ESMTP; 21 Apr 2017 11:56:35 +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=QBvSaMImYvnA2H6jAXorz8yt0B8KCa3B50Z68Pzqw0Q=; b=ftl7Eocn1q9lO04nqvZfe+Hb3bmtvV/d+t/ku2utD4dUOMPOeCVIQNKEoRwvXLp9Ok8eSugh7HJxrSjDv/qsrYNOdBGxrEOM3l/kaiUXP+sljZm3xUMWGpRTrB90rb8u+FwHHTXRNVpKevY0D+KRUGwzKSitVKgTAlBWaafjTlY= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=wdc.com; Received: from washi.fujisawa.hgst.com (199.255.44.173) by SN1PR04MB1983.namprd04.prod.outlook.com (10.166.69.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10; Fri, 21 Apr 2017 03:56:31 +0000 From: damien.lemoal@wdc.com To: dm-devel@redhat.com, Mike Snitzer , Alasdair Kergon Cc: Hannes Reinecke , Christoph Hellwig , Bart Van Assche , linux-block@vger.kernel.org, Damien Le Moal Subject: [PATCH 08/10] dm-linear: Add support for zoned block devices Date: Fri, 21 Apr 2017 12:55:56 +0900 Message-Id: <20170421035558.2657-9-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170421035558.2657-1-damien.lemoal@wdc.com> References: <20170421035558.2657-1-damien.lemoal@wdc.com> MIME-Version: 1.0 X-Originating-IP: [199.255.44.173] X-ClientProxiedBy: MWHPR10CA0052.namprd10.prod.outlook.com (10.169.238.14) To SN1PR04MB1983.namprd04.prod.outlook.com (10.166.69.143) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ed39e6f5-d3c2-4a16-78b8-08d4886a66b6 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(201703131423075)(201703031133081); SRVR:SN1PR04MB1983; X-Microsoft-Exchange-Diagnostics: 1; SN1PR04MB1983; 3:1f06ND3CFVA0jBiNPn4BHsjOcqL8AOHCIRhxleKlR/LzdAw9ByOGLMfBHysGGCuu1CpuJZFyXEN940lhkZ4a9hERsTME9hamI1eBSn7SxZc0k2Kzxcxbpu8asXkktcEIxdLnvNyc1YkiE46aUjs4zYTdcharDL4vjCUCOzwsQu8NyhjQlM5VO4gEgS5ljTNok7J9SZJX0yneb0+yTisyNGkUfKcxhzur+Ch9LMct7XKrgD4IT0jRhINHfnwJPdSb2edR2VgANjufeCaUx1h13Sd/+S3C5SWL3YASyFU7uEiXCbcH2xR4V1nggIKbFSRNx/dsIfzG2IoFXjYgi9B2p5yYOMgg2GR0U3H6/x5odcY=; 25:uEzKJOq2qKiWSeIV/L/7QbhpZtT4pR/BR06COgzShyfIKK6SdrvGogdwIW4mXkmo9uPHqoAT0V7Iw8w+AUyg0wY34gvzkLZulAmKq/sJdtY+NdSUGrapv9dgkRuBkBMdVj5G/HVQlkR6aukiHGVHJ5MieX81pzcPsCv+ZGClBS9uBbSbZxLOw4E/iodI+8bnWKRH9FQ98qGMdumBXJtJZYrOVhkEo24DeEv7V2qG+wiL6ZIvYMgZSc2xTQMBFBS4CA8xXCgMG/gkXJySmFK4RKTbTtHqNo4+yyx8Rpl/QZqXfN8kMGDcEh0Y5zor6z4rVaY9UV1tb6TiJ4Wqw4u07HHfZDE+RwOB6NVV5JBsgO7QW3mWBOOiA9E/ZkauJ5JeHQLtfG/2XOsLx6wuafjtbic6XJwQtKtpmnwy/NlPyKTrKvPgDmbLLpX324K46KCIGuBz0YAJ2gMqMlEkJnAY0A== X-Microsoft-Exchange-Diagnostics: 1; SN1PR04MB1983; 31:LmZs0AMrI0dk1tONcoe2994I0b7BePDMIF0vWqdIkFG2UrF6zQh4n/5N+36Ic+hGZg/IgbzBtWE2EEeKHX6kxxI48JEBb+ogux8tn3u46pYTKzO7LysbLB8Iw/8tsvT0eNpcO0Y2+PaCv7ZqVfpVETeNcimUx5o3OtdRR/q+SJ57NC/Ht+PB8i2irD5qNYKAQHHmraK0gvwuXwYCzbdqHllEXtd0sfpZg9aEAsNkmhoO7mDJ22MxCBhHvWRTZVlQ; 20:DUB1JIXEXnvoYRAu3gNHSPcXKKSbbtrqKvPu3nMgvhrIhZ0S208j5d6iJGcFWPx5l+brJmVhehmxtlcV4GKcdswtWj2HxQ7Qu2K3Mxpf2U3glP7qbKTCjehQUoaAcbZltgpklK7w9pyyJPjE0C3kzJtGA91BgU3gfKKSiV+btTXdP7mXLuBIJ6UaXRZPijkrI/q/YQkl8Kc3fNld7efqHyMnZeWYsyRDqAOanOdpgPPvSyEJGuOko+IfJMrhrZqapUxfPxw2PDQQOHs9gM/T50ubZf70xqSs+gd0EeeF3XmnA498s4sNADZkijh4VL3N/Ejcw35A4QO2en7wUXWU8XZNMzConG6mz6TAfk8WE+898fOMn0MIUyPnDnQq4Ifacc+V3zCnhVzjQf89Cpx8+tW6kKwt2P/GvS0CPZ473X1taz7YeV4v5qIyK9WsMx2zr/pu+qqf+QelCSq/oquIS/+sVti285UKFQglD/3QuOWmtPSOsfTywiPvf9yuMfwQ 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)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041248)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(20161123560025)(20161123555025)(6072148); SRVR:SN1PR04MB1983; BCL:0; PCL:0; RULEID:; SRVR:SN1PR04MB1983; X-Microsoft-Exchange-Diagnostics: 1; SN1PR04MB1983; 4:Pm+PnZPpmpK5QGpSh1uxynnRaqC80vZnnC1WAhMRvZtkpSE0uHjDshhwUBjg1H0Sry1+/grtBLhjCo7sVXtbz1L1zQsrMlyX3mfjYSYuSYpb6nCCTepg4dTwqHtJtVsXXI2OI6KhULelDi6nzF6rizKpdgmQlEhd/jBj9rbE7pB2Gl84+4rY5qErKgVtK+7P6c/PFqrsQS8SJEYEn8gs0bw6APW0O0c7hTMx10pkXmXqicTy4BPEa+TzUy/mtWNClpC9rZWps+5opTNUoDiu955cqQx5SmfI2enVVX6cFAB+sga4FFJ1GAQqeNw8hPxGj7uGjPmN/4iLnirmDVYVycZzaXoG7yA9ZzVGJ8Py4XLKkerD0CVnbAOnmBJBCWGZ+x4EvI0TyhCQgaPNiCzorXoenO7egqc+mc3qqLT717UEdt7p/y2fo0s2uhfOXl44VxT3aWeDVMoQZ2z3PxgLfwBXTijy+vfCCJIsDtoN+nTEpevtKZiWwhjwNfccc2UhHhoQml80FF3qaD0HyuzrD1GpQ5DErPGp+J6af7a35n4rFZ7+pOcjusjLkyI61V5dfhIqC14DmcPQU6wHHBhftQB3ILwUt1mM3mQKNVMerEF4OVKmZje+FeESsnFmzuBC+UnFgjhU8Xc1UNPHfrLkG/vtF0kSLYHU6cK71pJpQRdfE1rYcWAE1QuXvJ2t85QAG1uanmP+PHp3DaCTFn4Ijczfc2+qiWitzwCKYziIGpk= X-Forefront-PRVS: 02843AA9E0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(39400400002)(39850400002)(39450400003)(39840400002)(39860400002)(39410400002)(8676002)(5003940100001)(50466002)(48376002)(3846002)(2906002)(38730400002)(6116002)(36756003)(86362001)(4326008)(575784001)(50226002)(1076002)(6636002)(2950100002)(6666003)(6486002)(305945005)(6512007)(53936002)(47776003)(66066001)(50986999)(54906002)(189998001)(5660300001)(76176999)(85782001)(7736002)(9686003)(33646002)(25786009)(42186005)(85772001); DIR:OUT; SFP:1102; SCL:1; SRVR:SN1PR04MB1983; H:washi.fujisawa.hgst.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR04MB1983; 23:khbJ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ZdV3KtRNuHq67DREVNwbCla7dm+n4DqnFpMgtb+1uaf5he4pRbQg0FnGc12sdpQvNfRVG2A18wMWU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR04MB1983; 7:nL/RQYTncJKVVUx/7txVod5l0z3yOiItoG55oR1SHGmtnUhnWI9eh0XECOGdEi4zjrwXmPAu7IRJTEmWRQD1PnfXAOFhVKRms/gl2OngO7zGYaOvsPWu3GiyIFUlI8IC1pvvIIbC5ZQ/3NKgCNRFxWnZwWt+V/1eXNGWPwGmA4diyxY1BMgp0RBtmRRYeagYDNwCNEXuRCR/U8dYFRCL2nwGkTa6XF8Xa/kK5kthNT0WQRJ4RzL3JnQZTYcJUSAo2oTMgUB644BcSLaoPm90x8RPSqsm0D6RYr6n65oye6V73KKQS3M8gRD3bp1ZaI+m17okQiw6g0m5QqOnujUHnQ==; 20:Qa7xHfMEccO0p08Rx1lEbGqmwj4DHxGCf0mXso5rd0AQBsf16EyN1g8nMMM/vpp/JQlVYXTG8g0I78DpaHgfmAdIln1KYMuPJfj99pW0aZKmz2HCSIPAy7kxLFxTesbZlYKAzl0dRGLppKx69q+D+G/kOpKMoKlVz4RCNAcs8Ns= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2017 03:56:31.7662 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR04MB1983 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Damien Le Moal Add support for zoned block devices by allowing host-managed zoned block device mapped targets, the remapping of REQ_OP_ZONE_RESET and the post processing (reply remapping) of REQ_OP_ZONE_REPORT. Signed-off-by: Damien Le Moal --- drivers/md/dm-linear.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c index 4788b0b..9c4debd 100644 --- a/drivers/md/dm-linear.c +++ b/drivers/md/dm-linear.c @@ -87,7 +87,7 @@ static void linear_map_bio(struct dm_target *ti, struct bio *bio) struct linear_c *lc = ti->private; bio->bi_bdev = lc->dev->bdev; - if (bio_sectors(bio)) + if (bio_sectors(bio) || bio_op(bio) == REQ_OP_ZONE_RESET) bio->bi_iter.bi_sector = linear_map_sector(ti, bio->bi_iter.bi_sector); } @@ -99,6 +99,16 @@ static int linear_map(struct dm_target *ti, struct bio *bio) return DM_MAPIO_REMAPPED; } +static int linear_end_io(struct dm_target *ti, struct bio *bio, int error) +{ + struct linear_c *lc = ti->private; + + if (!error && bio_op(bio) == REQ_OP_ZONE_REPORT) + dm_remap_zone_report(ti, bio, lc->start); + + return error; +} + static void linear_status(struct dm_target *ti, status_type_t type, unsigned status_flags, char *result, unsigned maxlen) { @@ -162,10 +172,12 @@ static long linear_direct_access(struct dm_target *ti, sector_t sector, static struct target_type linear_target = { .name = "linear", .version = {1, 3, 0}, + .features = DM_TARGET_ZONED_HM, .module = THIS_MODULE, .ctr = linear_ctr, .dtr = linear_dtr, .map = linear_map, + .end_io = linear_end_io, .status = linear_status, .prepare_ioctl = linear_prepare_ioctl, .iterate_devices = linear_iterate_devices,