From patchwork Fri Apr 21 03:55:53 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: 9691721 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 C11D46038E for ; Fri, 21 Apr 2017 03:56:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B49F228334 for ; Fri, 21 Apr 2017 03:56:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9077285E4; Fri, 21 Apr 2017 03:56:37 +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 940A4284CF for ; Fri, 21 Apr 2017 03:56:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1035035AbdDUD4e (ORCPT ); Thu, 20 Apr 2017 23:56:34 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:36240 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1034979AbdDUD43 (ORCPT ); Thu, 20 Apr 2017 23:56:29 -0400 X-IronPort-AV: E=Sophos;i="5.37,228,1488816000"; d="scan'208";a="114480098" Received: from mail-dm3nam03lp0021.outbound.protection.outlook.com (HELO NAM03-DM3-obe.outbound.protection.outlook.com) ([207.46.163.21]) by ob1.hgst.iphmx.com with ESMTP; 21 Apr 2017 11:56:28 +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=KNH0qK75MGxdlod/RTQahMAYEw9GGEadHcpBck+i6aw=; b=KVwz27rT+5X9UAsjEskUXRjjcbIYsEkxciCMb9jCuJXJN/T7jXCrdeN8p7xFC5+e4hSDKoPx7IgjI6Hviu0LZ7+P8+UFQPjaqXf1LZWl4U0B3tpEINTEUhPUwELrPeBq14c+9KeJxpJpEkJxmMPhmEfnreRz052jikKUkiRedU8= 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:24 +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 05/10] dm: Fix REQ_OP_ZONE_REPORT bio handling Date: Fri, 21 Apr 2017 12:55:53 +0900 Message-Id: <20170421035558.2657-6-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: 56e0d6ff-b227-4c44-daad-08d4886a6276 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:ZsqNTgxcB0V60oGMAdu78+IR2QE/HoFPLp82GmV9eNpLApUuQM4KfYauVYwUkQrKcrFjWnhjM8JRfM520HHTeY8On7XmdTWHOKJ14QOoKGV1E9AC8EPCc+zhHw5oh09yf++UwVfXaUgXKWGU+dXG2YVlxejQ0sb9UNxUYxRzvQPfN7cMJdk7dEx+XIWdhH3ws1gtFxBsNAnyU6rReziHxmXb6t7q22/D99eqsMbgBYhkAjRzZ0YszRFW1Z7cWJTfDJ+Szp5IU4aePsUukMFlLRnubzASTI7I4Zc7626vYCVfnpvVfXW9OgjCF2+7zJTgPZyAGbZfdMJOPfHZNJwfKfRXFkuqlV6Seg1QXuTQ8Yg=; 25:ZIonL901UPfaYeuZNTIRlUkdj+tLZNycZ/Qc72Zrk9Kc1fCFxX8qCuAp2sYWkOzOHOo9U1zCWjQqHLpIGyHZdiDfTfm9L9mfqRC+o12HAEYuyxnZR3KBKMw5WR6YFfRPEWn1/7Iqn8CYlRucrFuxhQU5cMwbNMCWkCpz/e5A+tpHJlRddWuYxYDfLmJAoTyScQVwjx6HTY5/A6yR/vHFcrFgf0cPDhj/qArmCmqGDzrYvjPNmNK95raKqi3ii3Sos7Ij05NYatOJUIB94cNBpIPw2u69CmKqi/mrFBoZ86zeuX2TnE0aWwvfMofV95PMxJJxNKqEnlI7TbMDMMyFCzlIDKjsF1P63f56L773BnN4GluOSVc57LxJFw6iP8zUpT1B1FSLBcP/GY00YU/QaT3RmluwYZvvWjWZ4OHvqiYU+EZMLH67MaPNzQOFcva1n4a+GpCpDS42F+UhkyD3vA== X-Microsoft-Exchange-Diagnostics: 1; SN1PR04MB1983; 31:uyrXl6Q5aEPtPNuE7jW5YS8BImrOp510DCP8xcbHS9gaHHZ4UykERrhJfS1q/57pzkVfHD+Ouab1/up8z5sUetEznxylc8A+3TQDtu5dr6eZYvGE8SI3f8LwsjbTRd+06hcuOyGm0xAJJCbv+DnaH57HDqGGJWDRVUAe+CrcmP7WDhCC2Y3MXYdapHb2fgWIMdC/QX7zpVxO5OfyD4c1wzXeZd0G7WZ/65U7TTVZ7zE9q9llnEhw72TCUsQFsDEt; 20:rtjfRyjjizsJV6RGH1pfz6hCH38IAPmG5IKa8IPyLG4Bunu9eYdvg0Atq3Ge1+BIQVRf/ta8TxqdOL0l+VHpRxz/RZmbamcrF7vyYGJKD8FCLiUPUea9XU+PjYy7S/1ugPw3RaCZRlUifa1jSCHfeEAww3NFK5KotaL+tONfCCZTqTs0W9pCEMDiPdKBhosLY8h/WALo63kxe1PIRNljSVid74sY7ORnjTzAQ2EDQtDj8brk2SkpFsWjbIs+bsxbvQkPq5gsNX/18XbgZ9Ds/IKC5sZK2IUDu7FwSIsc2mr821t4Uts4I6L112HfjjTdPlGM/tNjfFitryERB7XsjmVklSEoLGN24OIIxwcsXyxq3Hk272mKyNYJgAG7dm9pq2dQecxzMnQcG3b5RG9ZCSpO/uCbe1pHymlrCQ00l0wMBhLFrlbGjeofFicBrQ1XCH6D1+CjS1T9XDpfdT/WVl5RybN8KC6Q7m/0mM7tqO4eJtp0J3vVWEi9hl0evkp5 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:iW71AjrdhY4v8g9Z09ioYcYHBjIglCVJK8/pzXe3MdEqkJEx21ZQdi/JpjT8ge48AWM2NLNmtHOE6+eY9RmvXIHvYA8tt8uRKvwdr7U3GslpWbJZEmfIkbi6MLjGSyNiH3PjIp2xJ0Y7CHKjZ77WfWrgRaClWxiHmIS0byRwsPq7o/P3V3yEOwILBLA4DBE9jqpa7UUC7P7eIcI61gitIZCT0me+5Agcy6RMENfl15UDFR5X55CSONe0tBwNsKKr09kZStLToedTgIuyk6i70Lvsp268/N9FSDv5QHQhHD287dFgRMpx0gwqNv1F+OOOSScJi7ys/JQKizBhY4rpF3ri0QD9ErMWUFZJMABnr3RIkv0jaaeakGxDb0FU0mufjc0E2Bt5N92pIJavC/CkcFhO2nlHWXz0WyjiexMuPK82YwaZBJY5nuYatU6t8+WJrVYju5h+K6Opye0849qah2HyakEdlyiC3T+XVdFGob/eTCZx+5I75+zarSMYUvIYJ1+yjPKzYsf0BuiaSWTStCUj78wzdngWpqSs9O0TQOGUV1wyob0o2j6FbAvjf0wZ+nXZv6hM11xGVQLzYUMxmRdcpWp3wOhOpBV4PFBEp+n1JLqIYRYvSqtovDqFIKfxFPt4aQrMWL328w4kbwY+ZlQUf8oplNahx+h+tOJg7OyIdc7cseLVMsq0jl31NoKOj9gtwjWW+R2iJ1mwGHAFLJoBd/6Mk12Fb9uSPs3oL+8= 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)(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:FmkyD/ysaG3ykg5UT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zpM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR04MB1983; 7:niXcBQmJS1l2AKOKOEPu3C17KZOxeSOz+kFW6KHsztU7ADOpzztOBezOR/vaPkyPD8lCATlnupw7MOlZikRzmNokFWpVuva8RmQYtXAKVj+iFY0lMqljfgjB0AmOeofJxKMwl0vp+8XVbOw68es/ld3t7cPWtgFYUXbZH5KlQc7X/DA3uQ0n4nU4RoJ4+HRzv/Az1PBCLPpW2VR+JYe270aWrPUrTdPJaqv+ojAOoHNHke9IrPSqu4dPrmGLDKGaIkNQJkO7TGcZRgYrZ8gTN5AJfHJWrDWS6cpaIQO/DDPG9ig/4kRo27LP0CDGn1dcEqNimw3xVouoco9X2PuMeQ==; 20:DSOoqtc7qy4n3nAQm6CSQXP7zzLw7r5E5yAS5uKcpaYYSZlZo9UT8Y9240fuslVm3CO5uYRAySxe2T96WDvmHnJlIo0bPQCmtYc3LdxR7TW1vWirI4rPM8arH3Q+sK5tLkKxaINRDMccH6JJq1ko9RYxWfgy1r6qeW1vb1j+hbE= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2017 03:56:24.7644 (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 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 --- 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)