From patchwork Mon May 1 17:53:09 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: 9706761 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 7EAC9602B5 for ; Mon, 1 May 2017 17:53:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74249208C2 for ; Mon, 1 May 2017 17:53:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68D5E2808F; Mon, 1 May 2017 17:53:55 +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 C6575208C2 for ; Mon, 1 May 2017 17:53:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750728AbdEARxy (ORCPT ); Mon, 1 May 2017 13:53:54 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:56443 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750703AbdEARxx (ORCPT ); Mon, 1 May 2017 13:53:53 -0400 X-IronPort-AV: E=Sophos;i="5.37,401,1488816000"; d="scan'208";a="15320429" Received: from mail-bl2nam02lp0084.outbound.protection.outlook.com (HELO NAM02-BL2-obe.outbound.protection.outlook.com) ([207.46.163.84]) by ob1.hgst.iphmx.com with ESMTP; 02 May 2017 01:53:52 +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=RMh5GPLs/mNtppVPkcxlM+nvs/lykD0DC2pHn9iKRD0=; b=Sq4Pxq5BZxzC/JRbkmvcldzCPSbVCCkpfhVUE88kULLxfobKQGBHKlx1RGAbmQIMeNQBT8CKx2pZI6KYcuba0Xw/L0Liee/6JvPujNnijJ62iJsAZnbI6zJ+GH9K/W2HrqBIabZnE1yeVp7S11A5gudPSEx3xTeFmHnfH/4NOmg= 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:48 +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 05/10] dm: Fix REQ_OP_ZONE_REPORT bio handling Date: Tue, 2 May 2017 02:53:09 +0900 Message-Id: <20170501175314.10922-6-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: 8ee4d22e-0008-442e-3d93-08d490bb0602 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(201703131423075)(201703031133081); SRVR:BL2PR04MB1971; X-Microsoft-Exchange-Diagnostics: 1; BL2PR04MB1971; 3:L0ycp8xR0YaVLJY8JNLcmypgjNNwT5cGeq1hCOUFr3fqKFMLxTBj5wkCkR91peNQesI9DLoUdAD3V0AJtfYTjUuM9iRb9WEIKKwoAIXd+Q6TR21B/f0b0kH9RYjL7F7aKo3C3m2g41xsSw+8aTtjt13uHHmmmT8op7GMgUqD46lnlOTK2UDi/c4i8Bx7TOPTkW+RLt745g9qXdoP+muvASuoo1+HMimuyXcK5f67swq5HZyQiCtUd5vqAdkTKSE7xbm3Zd78/L48lJ6TpUc6ev0jkUHJ5ulaLdzWTrTruGlpm4heuunDe0flVpJnoUUUiT0A3EKE16A3zEtHXXa+UccY+Jf3p6CMTYJoI4qXwgs=; 25:P7IHsMtahMJzWGSLi8zaqsW32rt411wtVPAPleM1nMgIF4Fp1t8wDDg5cb7oxmlCdY3QMVCc6jc8+gZhE387lDfF/m1xFCk/YPz1psRGudc6pGd8398wb0M4a1ayQbqQvpnWHxKsGPZexSbokyHGYh03OuHdphflq/px0bado93xsvseYegKZ/RngqmmclYmfoPpY+On4m7YTEHbdVS32XRMphNjYMjdBnR60FHa9YD/ufBRnkOqsXGcFCxtpuaNvw468iCCxWaJ2W39xBgrvCZkftELxTLd7Q8sHnzhJcvZgtIf6n4ZtaZWbK6XjGdj/PqG2wRhpJlBcLAL2d0UhgWdMu6FmtrpkYDUnseNQJxxPmC24LzjV7TQZuYV5ALaNaE2EqrnDiZHmTi02dIC42etPtPjkxiQh7hVXv90XB7Z79QTfiY6MOFdS7/BvKyXzYWkzki/OsufaIijsfl5fw== X-Microsoft-Exchange-Diagnostics: 1; BL2PR04MB1971; 31:+GJwSGhgk+gq0WImNhalxp8vZQVJZxb3TUXouY2BC4YAU+SO5ygCwtw1ORz7jEVJBE+AcbGVv88iC97J5z0KUhA+PkfiYeAhHW6tc5vZqLkqpG0lj/69o4aqTGbJLndhtz+EHczESFO+oPYKcObK5AJgQgbl+qt9aRKRFYeQ59YlcT1gg4LvWKUZxSrNW1NVeDynBDOqUq8aCihxWDZ0BIs1REea8pFM2VX60kzqGRm/s4uyvU8uCjZW1kzny/ex; 20:QSWlR/H6j5+FzHg+BFIONO+D2GNAui8WIOF0cm51xl2b/iq5xeH6i+Z86vhiaOYSld3k5P8XlmUV/ms99So4ymdJh7++9j2hN4Gclr0AfOAG7Uw+Qv/9XcgzT0URrpzAYcg0JJGfxd8v4wnNPh6F+EmeVmr9zBzaAm5zNYkffIvAfkkVrE28Sor8gHFxjZH5ly+dB3DIgcDnq/vGRpBfQvJvoahx0HeJnREiNS8RaP+nziNDGYqxZ9Azx2YNjSvMGTIbar5Lc9RBRna5a7XHZrpeEymNc/7/OQk/nKgvxDCYj6xM1ilH4IhIn7yTTuPoCjP1XGz4px9K/ZLn4fc4WyFkENfnv+yQn6vTm/Omec1dgwgVnnU6pkJGb+kzJ6OC59f5A+rBalqrnZhAxi2BhGw+WNqeP8W2MHPlZbiByvzBmbXH5zRQrtWbRfiXolyfUzPhXdxPrOIkPJ8U0S4lcDfhiWcm7xDyS3+aoryYH3KiR84mJHTmt2vgvtd72Yi9 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:Tm2T/PMA1o9ndXZNL9PjyczmyOqcXfkM/zdyKU9iI82+f79UwBD75fZ3HNqM2R18nQ+g0isN2SnYa1c65JfYrUOyqVGoARz81e77SXp/pWnmdIhbGGR/43WaoBFwHQiWyO3vRbYQyP98sXX4Boue4U62vhoYCaJtWa2KeyVejdHWfy/Y4BGcAfZN6LH6lu53L0uez/ZNhBAIz289aUHLQVTnxRc/Z7UOKCYO+83rAgmQezrvWMUmMFvn0z6JsT+2qbT0kS6FxDJ3bREkrngw9n1RB4BluaGXD3v8D5XxUnLcnvKmmed5w7kQw4x5k3dk8+FrSme0Ol3gHKsICYatcm+EQW4md1nCetHKaZpYpspULlMtRBVeM20xD4oN1kJR+Jwnqwi8RDH4mgjLNPy4Lx3CV7dEvqFynOUmBrJ2+v3S7AmHf8nvX9pEfXyWCrh6HOBT/fwOHc9sf+4OnZyFOr59n9Xx90apkd2io9y2Wnz33yfyx5WUrymCmhedlnzMrxXxyq3h0ShZhFlFFcUhSg6STtzKosJ8G0eGGtnecQcBHwp9u3P1iFqWI7LfArBebTEglwqfZ3BQ3GprPUWffy2vke3CUl2bsuI7S+sV1iHzfzzGuyuckQDj+XHh6chPRrdyV6fsjbbs43zFfx023JVJDtEUqUamRTM1eojnm+DzPQsQySBdZdPrGy3KmYICcMnjIZssSi/Q/RVRNGvjUhBaqcdUr+fsocnQsTU7BIo= 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)(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:s0LF0loOrcTXmLIYQE53wBv0v0VTf/ZgkDoJxYODO?= =?us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c= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BL2PR04MB1971; 7:/nc66yVjfrOWFtcwGugqu0Ei3RWiWOWFCnW5uI/t0bH92H3hoDezEvY34vU/ibhjXQkI1W4WoUa/ZywfDzNnBFy5oBIG82cm6kS+0nzQRLVAHBM8qibzNwjzzbEh14wk9onO9CrO26Ay+yEOljA83Hl+XWNbOQkQtemBnJimtY6ko4bIBwCQ1zxt1/1l/N1knaQKeUuU04XzCfZY/eXoL/o3HLiwbHHDRJiGmz3hs2Kc2PTo7KH/tRUTdSqOmkrS/jhVmJfm8FIO7qscLxe/hCcbcfI7SvATDLJDJKHW927mq+pz3TzzzGeoNVO2DPOoTZzXP5ReRXJLiRcf3s0tmw==; 20:LJrDPVqKwNTMAmPmgQ0yaUgoPSKgJy6IalPxo/lVyxg3QSxK5tAuoGFFsfTGnnfx21z0ncxs1S24B3/xIYsdHLVroASCNkHAfd2VF2B59vl2kAGTmnuyDC4jwrVzaoMPHi7Hg0A793pExldAeKuCGlreWzCdAFWn/I6yFcpjSso= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2017 17:53:48.1001 (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 A REQ_OP_ZONE_REPORT bio is not a medium access command. Its number of sectors indicates the maximum size allowed for the report reply size and not an amount of sectors accessed from the device. REQ_OP_ZONE_REPORT bios should thus not be split depending on the target device maximum I/O length but passed as is. Note that it is the responsability of the target to remap and format the report reply. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- drivers/md/dm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 1d98035..cd44928 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1098,7 +1098,8 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio, return r; } - bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector)); + if (bio_op(bio) != REQ_OP_ZONE_REPORT) + bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector)); clone->bi_iter.bi_size = to_bytes(len); if (bio_integrity(bio)) @@ -1275,7 +1276,11 @@ static int __split_and_process_non_flush(struct clone_info *ci) if (!dm_target_is_valid(ti)) return -EIO; - len = min_t(sector_t, max_io_len(ci->sector, ti), ci->sector_count); + if (bio_op(bio) == REQ_OP_ZONE_REPORT) + len = ci->sector_count; + else + len = min_t(sector_t, max_io_len(ci->sector, ti), + ci->sector_count); r = __clone_and_map_data_bio(ci, ti, ci->sector, &len); if (r < 0)