From patchwork Fri Apr 21 03:55:50 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: 9691729 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 179026037F for ; Fri, 21 Apr 2017 03:56:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0AF0428334 for ; Fri, 21 Apr 2017 03:56:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3FA9285E4; Fri, 21 Apr 2017 03:56:47 +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 8154728334 for ; Fri, 21 Apr 2017 03:56:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1035039AbdDUD4p (ORCPT ); Thu, 20 Apr 2017 23:56:45 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:53068 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1035038AbdDUD4n (ORCPT ); Thu, 20 Apr 2017 23:56:43 -0400 X-IronPort-AV: E=Sophos;i="5.37,228,1488816000"; d="scan'208";a="12691047" 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; 21 Apr 2017 11:56:21 +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=bg6FURAQriqtU0E1qL6Is+PI8I/jU8q98rf0dOsKJOE=; b=oUYHkm+PxGhpHXyK/yt49iiX1u4SgEhR061/IgZMqwsQFIyNV96rggybh9rhvkShvLSYpoGXvU5SD+0tVZAtafsm/rMoV4BWRtsnxyvHYa55y0Zj7HljiwGY3m7F8XanQa8cHVE/k5afzHk4DbNDXHgchwrulMMVOuLnrwu3BDA= 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:17 +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 02/10] dm-table: Check device area zone alignment Date: Fri, 21 Apr 2017 12:55:50 +0900 Message-Id: <20170421035558.2657-3-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: cf1598cd-d7a1-4d84-ed65-08d4886a5e60 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:P9B+Zild7O/Z9tBXL2g9xuASivNzkAjyG7bXQki/g+JeJUjGNNd4Y7kcTQ4GvFlWu2JswYQ0O406zvC4FX5divszciFdFTvW+eQRcZRpilpLScGI4MbtIZ31lpxc7e6lQdwixlE24q10TmC6HzVZAgap/gwUpVe6Fs8d49O/0Axf48N15bMB9UTT0tRNGIdaNE5Yz7E2kodUTXIk0b8vq5yj+sd2G8s3Fk2a0OQcPOrmgZPlF59u/6qjQG0eEBbQrKos+iLwtBvNVWZzKLtXXWpP5J/j6BKwasVnbP0F85BiIvJfGu2of3X6F4zTbG/94XOHtMz1A4uf1g4F0XiFiqkBLmqwhRF4cta4qbaA6n4=; 25:NgxEnTjeS7DEZ6ww2Qdnq3Unt1/n/WnIpEF6bHada8Qf4faNO2XMezrkatKEcpBGaWKP4AmG6p5+YyG9HE8GfxyfxwFyiLmLc4E3Z+eqYp+4wt1avt+RME/IcQw2E9VSm5fagonF8lMrZ0zt7N9QwelPNZEgOCwASb3Yf8dY/3Yk1mTJmeJMPFPH4tNJI7KaRCz67XgdHJz1qYuJ70X1RzJ2/aVPadW6ug50zix7izzlPtUIKfFBJMk/CHHU1w96Oi78TqzSPdha+l1JYKa+l7a+n9q9lXJx7CoYuk8j5SUEnfEu4kSLFVCat4xhQKpVERs+w6lz2+Hqw3TCPA4zMuqo4Ozo5xKTOOVAQ4lOfSgP6rXloe+r5hiIqMnff2eYZvSq0OXPig9pR0Dy30Lpqx+I1KXyIHf3yXKKQGubC/yYDCD4AvIwufycRFjaM18bPaRJrdhdme3ipk1iKGCryg== X-Microsoft-Exchange-Diagnostics: 1; SN1PR04MB1983; 31:DcMxlQHLFC2W4C8TNV2pE0D4jduhC8Cqda9Ynd+ICcjJ4SERsDCOnKOwkUSRgc3rwjS5Etc0UcUAntYKdyh4DneDIpCsjHJek5uubzcTO4n+iGhR71AB+s3QOoi2jQA+HdxouxOSX0r5oVRf4ZFlcb7WmipQHES9WUZycvPUe4ZEDWDtVyu45kN8E1dbUpRyr+6cM5DdI6q11yUVWYFPEz7PPu4PxD2vjIDTvHUASS4=; 20:Cl4VusL5+Kpb6gXsPlF8sItMAHBkgyBvpWuKx6LIPmzPtWx4HPHFor9WwZSj8ZPTYFICnNzsob4vD6ALqROYmWRCGVoeAA3ArUrDaVBU923dB/wE0UcLnqtdbnYzhNy5/tPSZVfXx7/G1fOCcmgzBMx4efsY0rgefao9ekuD66jUgBexapbf9y6j++t8iipr8P+9ZsUJJIhacp+ifZVBze6BvKmCudVI6AUJ+vtlqqQkXSCy9XcT0zERdb/XGC3/xQKiwV+5ojzGrcXs5vsBC3g9A702pcAKhplREjL6muqO/81J8lwn4/4NDuhm3fxWdRz5/jw8+S8uOvmW2QoZoh7YlzBavTRvLxumBLbuBnDe4TQwGwjO5wlI6jIATTTZHpQrR+k1GmMw9rAC+RJ0qqoc46mkrmOnaqEdI2VHzLzfKV/f4kzdso4q9g88bPSkjbLNrC3ozdJUX9LUeDD3cE+2/KslhM6MJqMCcxeLZiguYtIyWeepTK/ndQuhXj6R 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:TMEC5gUqFwk3DSY23C56sBo02CzDVGvh2hDJkz4nm6BQTT1aOyeOs74AFA/L/cOrfrxx5d2Nm/B9ZqTLPojYufmRA+mICyRfWH9Xm55U5WaTDI9ONYzleZ7bqPyU+WX25tq7KP12iCzKa6xfU59wTiZbZcfGK9D5cGWUFwqeXV0ggAmSw2DM7fCHvlQ++fW9/ltSbuzwmv6uZrKEcwdw0xuxtblJFsTmFkk8IfUBLyNOe67aZr1Y8qN/0qb+u2QUh0SUCBsIpDL7emI6OOEm1SKFYB6JYZtS2xUyS1dvK4920aICe61L0VyUkUjgpvtDObZtfUtYx69eljjsd+AXVpl/X9wx3Y40xaPkTpNXMPkp/For90ib5EZjNJbX8LTMEvwaNErj/NmFV0Pqm/73gDo6LAEnB3y6qDCZSWvVG4ExHEkct5x80wIUMDUPYxXShmceM9IIz4lqk6CTJ9x0aACxIJ4cWxv8PA3MWqwJ1QTRIAob7c3OjOrM2QwXm8SjOw/GAVMhYnU2RiE4a/arBIr1dLJSj+XY4laB8dqedEf8FGQ2mMXl3s5hc8Tjvf2Qv8a7VjKNNf+JnNks7Syk9eMzVURYt6xi6POVRR2I0nzx9pD+CHGVhk9I0yUPSQig/Cmrs+rlXnPXUvZhb4HAtHTarAemEfHrW1arrOkcrtpaDmwwG6MfR0anSmZyawkT+tv3ZkTPMxM1aFyUbqZwO7Gw6huhYpgPwJwek/Z5js0= 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:DdN7LLHqdhmqmVQM9jmGMvVzhgbRdo+Jz49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Hl99TLNI6z480Is7izss2Ef0E6ozyAFt8G5RVKs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR04MB1983; 7:e88iu73HQ6DApNvEy2lXLTMAOhDfN5Cqk57TedPzKpdPTr8RG9/3ICgq0sw4Lx2hgLCiuI5MptNoancOebPeARBYnzJa92SICljmmvTtMOSAY0O+j23NZfqwVikJVPHfnRCX6EzTHs0mZkZ9IqU72kc5LPTisllBUMdtx+BrLFlsbRt7tKjufP44yRt+bIWGdnbBxxkvMYgea/qtYu0Au2He1qm5Po1SIN6Wd41A6C7eXHle21tYuYkTdo2oKXKtMsUMT73wbXFvGKWs8q+yz8bDArsueTK6bRIGxP3uM9dKHO+nfGPBRhdG3qefjgbwu5UrjdpJnuNo3OPi7PY24g==; 20:xToLCmp9DzznL70L5STxtqnRuttA3Rwxn7me6i8IGBfQuXnVOmshtL6STOXUq62MW78I7gl71H/dSyMUOE58iQenT/JfooLaz07BF2bPY/3If74hunRR7xGak/9/p4m8e32lWxbEiD1r5kPPh4GAtD9Zy0nreunwe7SesSMf4O4= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2017 03:56:17.7778 (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 If a target maps to a zoned block device, check that the device area is aligned on zone boundaries to avoid problems with REQ_OP_ZONE_RESET operations (resetting a partially mapped sequential zone would not be possible). This also greatly facilitate the processing of zone report with REQ_OP_ZONE_REPORT bios. Signed-off-by: Damien Le Moal --- drivers/md/dm-table.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 06d3b7b..6947f0f 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -339,6 +339,33 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev, return 1; } + /* + * If the target is mapped to a zoned block device, check + * that the device zones are not partially mapped. + */ + if (bdev_zoned_model(bdev) != BLK_ZONED_NONE) { + unsigned int zone_sectors = bdev_zone_sectors(bdev); + + if (start & (zone_sectors - 1)) { + DMWARN("%s: start=%llu not aligned to h/w " + "zone size %u of %s", + dm_device_name(ti->table->md), + (unsigned long long)start, + zone_sectors, bdevname(bdev, b)); + return 1; + } + + if (start + len < dev_size && + len & (zone_sectors - 1)) { + DMWARN("%s: len=%llu not aligned to h/w " + "zone size %u of %s", + dm_device_name(ti->table->md), + (unsigned long long)start, + zone_sectors, bdevname(bdev, b)); + return 1; + } + } + return 0; }