From patchwork Mon May 1 17:53:12 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: 9706767 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 6103C602B5 for ; Mon, 1 May 2017 17:54:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 549DB208C2 for ; Mon, 1 May 2017 17:54:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 498FA2808F; Mon, 1 May 2017 17:54:04 +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 C0F81208C2 for ; Mon, 1 May 2017 17:54:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750761AbdEARyD (ORCPT ); Mon, 1 May 2017 13:54:03 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:42560 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750703AbdEARyC (ORCPT ); Mon, 1 May 2017 13:54:02 -0400 X-IronPort-AV: E=Sophos;i="5.37,401,1488816000"; d="scan'208";a="14501989" Received: from mail-bl2nam02lp0079.outbound.protection.outlook.com (HELO NAM02-BL2-obe.outbound.protection.outlook.com) ([207.46.163.79]) by ob1.hgst.iphmx.com with ESMTP; 02 May 2017 01:54:01 +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=CK//3GH2ble3vgF3DdQGmTFaKGspd/w5w7dBlSmJQBM=; b=XNj3tgTcpu+sgF6f1JoIt2emOHVDr9Nv6CQIdQzGaw6E5wXbz812+f4e3lGDgV/tzwkANt7v1b+gb6NltU6jMA1/Yq6HImknCdAS1+WVfhanHX2lf7z6QcqI4i8MItUa3dFQdaB7i9KVmXs1AWKAtlNzHs7X5NC/8JbRCVA0u5o= 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 BL2PR04MB1971.namprd04.prod.outlook.com (10.167.97.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1047.13; Mon, 1 May 2017 17:53:55 +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 v2 08/10] dm-linear: Add support for zoned block devices Date: Tue, 2 May 2017 02:53:12 +0900 Message-Id: <20170501175314.10922-9-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170501175314.10922-1-damien.lemoal@wdc.com> References: <20170501175314.10922-1-damien.lemoal@wdc.com> MIME-Version: 1.0 X-Originating-IP: [199.255.44.173] X-ClientProxiedBy: BN6PR1301CA0002.namprd13.prod.outlook.com (10.174.84.143) To BL2PR04MB1971.namprd04.prod.outlook.com (10.167.97.143) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 05527f95-1998-48a4-8ad6-08d490bb0a7f X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(201703131423075)(201703031133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SupQVqa55mEA4R63AtGRM3oOWutRCGckwvU+XpSgH2NFnTHYD+44mmdp+KNtCzPPAoo9FR/CMnVGaXaIOs+6ddHTMnQ=; 20:EwOCAuR+XV/FjvIMeGTavIQ5UhLY0CCW1UQpv3dhR3vW+52U6SPBSplmdJD/VE/HFAA6b5s/L/FITQUZieUGoR2GFLGqkbi7wqMqrnp5axnZvxmM9NEedvSs27gshuoZoitLUFsH/5Zcs0+PtmdIKTTeD79RnDZcQuOSqPwB4P+nfFmLRsqIJSphGhabwU/Ju0IdZ+OSXkbA3Ecb9WRTKtaQuXMrVSafXeL3zxBJZe8R8wQzd3b+kHzBVvyFR78GH7aGQC5pKmLS49GjeztckrwaJLymUJrbbmpe4wm50r9WMrW4O8xjrh+wuddYmRZLN0AAf21j5xuh+vMBsGwqQeo3Bt6O6P+ETZGGFRyl6c01GcLLpQpvaOOAXxamZZclOAq75cAVUg9zsZ8vpUe10SImWyHVWMdUEHX7XnQWirOc289RPF7GjE4d9zX2ximUtMFSoTgo3TKeMgSYssoDqjPRhgiVmd0mxq5I46TxU79JspRZCRvUSHhwzmQzWFpZ 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)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041248)(20161123555025)(20161123564025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(20161123562025)(6072148); SRVR:BL2PR04MB1971; BCL:0; PCL:0; RULEID:; SRVR:BL2PR04MB1971; X-Microsoft-Exchange-Diagnostics: 1; BL2PR04MB1971; 4:kwK85ClHggQrJosg7H/JIas/mK8QLcAoZgzY9rJVRTNtb8QvD5YDzyOhtBEUF4WQpNTu80FSSwGFio7v3D06kE3Z0Ndai638wuUmns6DQa6ccvYHRtsSbwWlP6hom7Cf2io4th5OSPJ5biWPDd7HYdNow28WwtK9tI4T+lWUFB3yFgN20Z+/rarmOkjmK4E08ZNNPtjLsvTLnlQ0aoPi6OGehkuUIVCHSbwvIF8+xhUBrswpUCEI4IHbGsMjZ9NRgmqpwoJ6ifgVwzZdO+JpPS3Q/zPWkGHfiEZOwOLUaU35Aw/16nmSrleMLUFHBnjanzXwI/gpvM3H0RWjBt5Jnkmt5rw2nm0xSHVZ1qwZULW8qiLrjIzOD0ncHz6mXNtw2M1q+BwLVJ+UPwchAHWDM6Doa6xjUtodOoDQSYqZXWLi+6qbFRci9tvuMlX23Vpobkl8Kpx5T8gjYkA8GKWG1jrVkCWp1f1fqWrVrIbBpeEhRZvjBjl9jd6PONrfmKnqIxtUe/3kdXbE9D2R7eWilUoXXKAvJIw2LdqHxxlpBy6qo8m0vd65+hiSJTFFkRee29vkoNrrzCHnoE34/fvLsDQhz7iuLEAxvVkPKmijjlaWMNLdxKK+cTUTld7MhViuAPyilrJcIEszM7ibXCM//0XdKwf+ovwfHZ5n5K7cxVfVaHA8effqG79Gi+dXSjWWV/vnKN4Wb60ID3xYWc4gEC1l9fZPkk99oeWIgDcMLg8= X-Forefront-PRVS: 02945962BD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(39450400003)(39840400002)(39860400002)(39400400002)(39410400002)(39850400002)(2950100002)(47776003)(50226002)(85782001)(25786009)(42186005)(7736002)(5660300001)(6636002)(305945005)(81166006)(6116002)(3846002)(8676002)(33646002)(54906002)(6666003)(53936002)(6486002)(9686003)(189998001)(6512007)(86362001)(575784001)(1076002)(50466002)(2906002)(38730400002)(48376002)(4326008)(36756003)(76176999)(508600001)(50986999)(85772001); DIR:OUT; SFP:1102; SCL:1; SRVR:BL2PR04MB1971; H:washi.fujisawa.hgst.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BL2PR04MB1971; 23:srQSi3w8v+ImFTWvG6dxifAY8ppKe85EcHzu+ar31?= =?us-ascii?Q?xThicb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amDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BL2PR04MB1971; 7:o9Q/UrQ34hdXVuEa9ZYe6LrDIEtowtEZ/pWHufrSC2PQOnuGGG0YkISUbKIcIxd1bzrzaqxriOT8agu98dyFniciUQYUSxtfaMLQG59UDOj7MO8mv9SdwYDPEM0w+MsP6XpDkeTqC2xx8GP98Gu1ZF1vxz7C+Q0AN7XbAlN6DCXbJXBQwuVBbLsa8BfhdsGlATi/RlsmEY/ie5UFxd1jzQ8LoCmham1ZxNU1VPRzTXBM/Ps270hFPuYK7l37Qf9TTXBJXO8S4OsL3eRmVb0aNRgfz0N75vMjbzighKY0+nbY1t2tK2vKDFOAqBvf00TRidGwCNmj9jeJGCMenM4C7Q==; 20:qxq6EeuOmCBtxZ5LKKzbvAw2x5bDH2FkBblZlEEDCxlDfohY4Kly80KNAFp28jRAX2zdLnEUBHtI8OOCcU2RGw6egCGA/P5mkeLS9wmDgJIpIlriqjWUNbYbJL4rXPTql+F9Da5Rf/YPkMUgp+Jm4H7G+FKX5UOIQVTpAWASo3c= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2017 17:53:55.4640 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR04MB1971 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 Reviewed-by: Hannes Reinecke --- 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,