From patchwork Fri Nov 11 05:53:26 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: 9422487 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 DBFCD6047D for ; Fri, 11 Nov 2016 05:53:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFB6A2988B for ; Fri, 11 Nov 2016 05:53:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C413929895; Fri, 11 Nov 2016 05: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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 3CA8F2988B for ; Fri, 11 Nov 2016 05:53:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934577AbcKKFxw (ORCPT ); Fri, 11 Nov 2016 00:53:52 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:34839 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932591AbcKKFxv (ORCPT ); Fri, 11 Nov 2016 00:53:51 -0500 X-IronPort-AV: E=Sophos;i="5.31,620,1473091200"; d="scan'";a="32818792" Received: from mail-sn1nam01lp0111.outbound.protection.outlook.com (HELO NAM01-SN1-obe.outbound.protection.outlook.com) ([207.46.163.111]) by ob1.hgst.iphmx.com with ESMTP; 11 Nov 2016 13:53:51 +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=KvkzjgW5zVkQU/YzmlXbkOAzaMv6z8NdtYh3YNmizYk=; b=aJ0tJ1Us9Xq5FFtoL74tvya/YET7GYYaiCp/3aFfv4QAAbk1wSecdWVi36SpYvnXefJs1QYnZiBYmcVa/vO+DIf4bVof44fGnlpwDyma5hoPDQUr0eGfYLHXVZVvOab4wU+AqYF8nCq9zkETxe7WRXd36FYjlczG+9bkwjz/uR4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Damien.LeMoal@wdc.com; Received: from washi.fujisawa.hgst.com (199.255.44.5) by SN1PR04MB1982.namprd04.prod.outlook.com (10.166.69.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.707.6; Fri, 11 Nov 2016 05:53:44 +0000 From: Damien Le Moal To: Jens Axboe CC: , , Christoph Hellwig , "Martin K . Petersen" , Hannes Reinecke , Shaun Tancheff , Damien Le Moal Subject: [PATCH] sd_zbc: Force use of READ16/WRITE16 Date: Fri, 11 Nov 2016 14:53:26 +0900 Message-ID: <1478843606-15647-1-git-send-email-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [199.255.44.5] X-ClientProxiedBy: YTXPR01CA0053.CANPRD01.PROD.OUTLOOK.COM (10.165.216.21) To SN1PR04MB1982.namprd04.prod.outlook.com (10.166.69.142) X-Microsoft-Exchange-Diagnostics: 1; SN1PR04MB1982; 2:Y9+Sng9d3d8G2l4/uGQGEvm5PibXy8dVTt/Y0U4Rzh2GP8g4rH9hC4SMaX/bTp8RPpaBF4RwdIfyfAxdWeFLIw7e8ZXbeJoHF3fWzPF6olb00v7mxj2qTh0wYRsvGkK6VpcLiduNCScKuiQY3CFasTjHGSEgGa6EF7lBSw2uKB8=; 3:8onNC9STw2BwG3p4KR/gKrfIOXgcKBnIS1zC00FYkxIwQuzRrsILWxY4WuRXP+Dv3uHJE8cJ2gwqqm5Vw10esDws0ayZQnUpWz2jMsnVGK7lDHoMCzLWLvtarmgzxQ+GC+1zv0DR/2dR473wJOFdqJHpL9iQzyvzNJCJytYqHDo=; 25:0F5C6kTpBh9TJhVmsLeps8fJXR96oCzlDzxIuQXcPRvxAT/HhTx3iKBtVSpTUoqtxJ4lnRP75qFcNlReeSLGC56yDJZ8Cf5tU+oBzMguPe5rEzoXbUxBNuZN1GB//kR/U2vbxSBxLeXLrDQvBhRiHhWUSJxbMqaeHXNjydP//vdCjNCSrOilrn93nzciBDEIjKe+BvaObBn4ntXkr+zaw8fEyqfz2z6SGtB8eXzq/IKEGr9SVq9TCKPYl59Ct7aCE1S8vwrfgZHe4pCfZdksRjcEzpookOXeuj53ZDRtBJOFq8bvVHNEaatr1WJ1s87oY00zEjGdA/QPtixj/OVEaSONzcvZ6e0ICTmWo5BrVwzhgZ7F2ifeCA76ff9OprusLIyoy9kGJMYELsyxZnAggZIdyh8v+XYXsMVDM/RFwGGU1mhTx5/087Mmz+z8lqnW X-MS-Office365-Filtering-Correlation-Id: 4d4a43e7-f97f-4fc9-899f-08d409f71a3e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:SN1PR04MB1982; X-Microsoft-Exchange-Diagnostics: 1; SN1PR04MB1982; 31:Vr5jhCOEZttoIbBFeo5bDSXRPYvm99Bw0ef+eszqVsmA2KZc/ZZn/WK2C1wv9tmMaklSf4BqrLUTy7LZ43sAuFq2BfhHfCgh4tgkzweg+l2up1rqLYryhLDIOcKYtfIOheBeYcJLwKrzTtbPumhxltiQt/hdaEDwznPGBdUHwzdFL8BqSw43MXy4zm6RBBlIWiwE2i1aFgl+5auXuDY4Ty4rx+Fl1ZB0KE/gmFphWs1qfhQN2rDIgEezH3zIzbRs4UvllyMkC5UET16rJph2Kg==; 20:2dw8ZDtrPW3GlVGuYnRrM+z+pJRGZRWXiwnKFpqgCiAxH6b/6Y6b7lGSEKwzEZadUApKLj4xbu7GPxejrv0bsajl2N94TMZHEFgqMCT7+leO8LNLTy72nSOxKgcgENIYqAmJ49bkKGr1cyjsGFYWsfRrhDWg9kjIAy7skfa72u1gs5tgJhIRSc0WwAcGud+Gz0nEk01O2h33UhiAxnU14F/wzEJQsfinpxvjvU9uUAayuIxCaF6mqFurIYT/iXQQNOg44lpJRETnzJMsK/VbJC2Ezjb+7sEIONo+DcWIMDuDAUli5q6+C5v35RZbmFK32iQ5FGlS22kYmp8iKFlHI86eXfyi2gzUhM9k3IKIwHF5hbpeBBudswTkys9Vao/EpIhP1ZlSY9qbRcBQdWoWb/WM2jH8FjLSPdAmxAfDcpm45VzE7O9y/wM9oAYFJvK6IVL1ShkT7/c1o8Vs/zqT90cs/hzvRWcbr+yRH1RQ70TJK10KPKjXZYEfL1VaKQi7 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6060305)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6061300); SRVR:SN1PR04MB1982; BCL:0; PCL:0; RULEID:; SRVR:SN1PR04MB1982; X-Microsoft-Exchange-Diagnostics: 1; SN1PR04MB1982; 4:zmEqMm3Z4CP8afcayZ6ZGe6UudWqjXyDmrr9CJE9OsynANewXiTB4POR9OLEFY0Ga35wuR0yjZgQbPXnLtmEP7n8DgtqfMuRQYX2rL+INN03x6KXQtbO/e8//aT5ftC/iqa/t7ZXrRWb4fLBnJJYP3nY+YLnNWVt0Ga2kkuFo1JqUI/jHYPa04TmW3ijgr1sIQcK77eK+aiC/QrS6D2vl173NzSH+Mn2QghHmTN2VGrukJQwUn3/y4sC0hAJu21IHB9btgc0VpLohKrbAYi0hUYA4tyer8gEip1I8/uwVEeLfaGYuWUKn7Ed3NwlVwBb8nWPKOkjZO82ce7k8SLIYm/ZMbfNqFeZ2lEOiHdeQ8wv8Z+1lhkCRSea36MWlHGzQy8pg8hEWdo6SRO/ZMNm4nU5LJrn6UrGBUtv0NjZQZ/LhLmTp3L2rOTBdx5bdgUt X-Forefront-PRVS: 012349AD1C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(52314003)(199003)(189002)(68736007)(47776003)(3846002)(50226002)(6116002)(66066001)(6666003)(586003)(50466002)(92566002)(48376002)(36756003)(7736002)(305945005)(97736004)(4326007)(189998001)(7846002)(101416001)(50986999)(5660300001)(86362001)(33646002)(105586002)(106356001)(6916009)(8676002)(2906002)(81156014)(5003940100001)(81166006)(110136003)(42186005)(77096005)(7099028)(5005270100013); DIR:OUT; SFP:1102; SCL:1; SRVR:SN1PR04MB1982; H:washi.fujisawa.hgst.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; SN1PR04MB1982; 23:x9EsEVvusOXxEur1hm4teQVf5btsEJ9BFjBRz98Gc?= =?us-ascii?Q?+JgvVIYy9OSa5kkqj8BQipZm4TFWVraTEVv1di+WNqXMS05TxuMF8E0A3GTB?= =?us-ascii?Q?9Th95a+Sz/2oKSSpXe8xt/WV46cylsSdQIVvPcNrv02km73iuooTMTRX70q4?= =?us-ascii?Q?lEllFzz/7L24CY5PqyTD1WQy4tva2Bwq0R49rjDxwYGAyIl+wt2125qek4/V?= =?us-ascii?Q?XDxsDg5lsYMXBO1r2wKBFSMxWQQgYqnG8c29L3AsbCdOxvH6jxWtnNC+gNMj?= =?us-ascii?Q?+7MtJVaIhTq7qcEUaI+kZNswDsewnBpsolPHd47FrjWh9WXMuKdNhJIDVhT9?= =?us-ascii?Q?0SJ4dZwclOmflP5qTbsym6Xrnifm924HoFLMCUGtKbSGFGkd2VOZ+2NExxn+?= =?us-ascii?Q?9UApudbpJnl0NjIkDCfR9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riginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2016 05:53:44.1849 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR04MB1982 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 Normally, sd_read_capacity sets sdp->use_16_for_rw to 1 based on the disk capacity so that READ16/WRITE16 are used for large drives. However, for a zoned disk with RC_BASIS set to 0, the capacity reported through READ_CAPACITY may be very small, leading to use_16_for_rw not being set and READ10/WRITE10 commands being used, even after the actual zoned disk capacity is corrected in sd_zbc_read_zones. This causes LBA offset overflow for accesses beyond 2TB. As the ZBC standard makes it mandatory for ZBC drives to support the READ16/WRITE16 commands anyway, make sure that use_16_for_rw is set. Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig --- drivers/scsi/sd_zbc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index 394ab49..92620c8 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -612,6 +612,10 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, if (ret) goto err; + /* READ16/WRITE16 is mandatory for ZBC disks */ + sdkp->device->use_16_for_rw = 1; + sdkp->device->use_10_for_rw = 0; + return 0; err: