From patchwork Mon Jul 8 18:47:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11035641 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B6E8B14F6 for ; Mon, 8 Jul 2019 18:48:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7D26285B3 for ; Mon, 8 Jul 2019 18:48:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9881828628; Mon, 8 Jul 2019 18:48:59 +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=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3EA1D285C7 for ; Mon, 8 Jul 2019 18:48:59 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hkYfv-00057h-1D; Mon, 08 Jul 2019 18:47:43 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hkYft-00056n-19 for xen-devel@lists.xenproject.org; Mon, 08 Jul 2019 18:47:41 +0000 X-Inumbo-ID: dc6df01b-a1b0-11e9-8980-bc764e045a96 Received: from esa3.hgst.iphmx.com (unknown [216.71.153.141]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id dc6df01b-a1b0-11e9-8980-bc764e045a96; Mon, 08 Jul 2019 18:47:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1562611660; x=1594147660; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=TRJ5mIHEpUFUMoE20YZUADV3tKY+JE58H4HrPBkkQ1M=; b=RRemQHUudUe9qclr4zzg/Lb7ptwYbqk5TfKSYFkWEs55hkaPDPZpL7lS 26krxYahP7DQKKEij8rfG2AQzRDZX+vAG6hJgcSDg4JYIWSEbrE7XdTmX l1K3hukRf66zf0HxA35EnA0CpWSIKiv3pQExJwiy2wd7Q/X85FOUPR8ju czuTlLHWcBaNmi/peJhCEmCgvR9E5R6JvNlAIH/wUuAe1J3dwK/kHYklz prwwJVloT1ek3K9eEqD+6E/5ZwUBsHw9lkhFpzVQSHgnWfI1HEjO0d68I pCLz08nHw8etjMEcxmCJdMEcuwNt+aT94pWIN6Y8xUA5B36+0M6b6figD A==; IronPort-SDR: CbdudkSwxJA8k/ST1T/kuCKTasUlMSaZ0W74scRtFUjAIjT6mFX6jJX02IGEOEHWkoK6jraOke coZxJKxpJs5222ImR5/ihhroR/uTPRCx1L5ltgx1iobIpocwWr2XGRsCcBGOJVoLblwhGovhwq rVvEusmKmLAjw6+64573aY1PFZb3YwHJxCXiDOUPG1XWfpjqJTiUo+/LlpXWQ1N7bGkJZdMLDg Z0nfJLvQvcMtzGbDtaQDTUsM17d+QWaHO0ub4F9zhh3oKN3VqXJpcWxqwT27HdXtuLH87PsfIc Gng= X-IronPort-AV: E=Sophos;i="5.63,466,1557158400"; d="scan'208";a="117296118" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 09 Jul 2019 02:47:40 +0800 IronPort-SDR: XY0WglFWpV3/4cUYIQPdy3gAEJ1U7hNu/ZTMEPFc5d/tspiKCmICqDtJl6woC8v1V4ESqRz9ea fObvbAADRwUIsRZZHTZY3FIedLrwK+tQVvjf4XsaKFVZRnK+DVx9VyO5sUkfRVkoA8kRnmsMRo 867YXe48p8YCoQJZcEZABolp07mxoMyqXf0yoIdrWHlO6Z1f1XxrI/n9OjDGimCiYTK87cS9DP i+819Bp48BCkWsjAM3JeqPXuXzTZkWhWSmQA1MhEl3d2xtgsZ0TVbACOUQXdkbtWrEYVEhwq88 EHQCMzYgcY4J3NDWEvCMxtsZ Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 08 Jul 2019 11:46:28 -0700 IronPort-SDR: e+wnXG2Mz3gtPkzW6JVqDomjkR+WsCClgTYVA68ZPRVD1/JbzvZKAnfiawuajy721alH/4cYAz 83R6mt/izAcA3wYqxabLbqAjyVd0jNtKCxpgAgTCPzpasYEs7lbnvuC3N4aFMecDj6sBrnSifF 82Ij40bI/YXlgLYOhl/4Oh93z3ngwfXd/OnW7O5HcGk/NS0jd+rAtkLqTzWO6jaL9i1E18+AqJ 7S99xr7IczGeGB6g7ryoF5o2/SFFru90R9W1IEnAhWc+kyfKs7iZ6KzcqN/cZ5rpgMFzYrCS1q EiI= Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip02.wdc.com with ESMTP; 08 Jul 2019 11:47:39 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Date: Mon, 8 Jul 2019 11:47:06 -0700 Message-Id: <20190708184711.2984-5-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20190708184711.2984-1-chaitanya.kulkarni@wdc.com> References: <20190708184711.2984-1-chaitanya.kulkarni@wdc.com> Subject: [Xen-devel] [PATCH V4 4/9] blk-zoned: update blkdev_reset_zones() with helper X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: damien.lemoal@wdc.com, linux-btrace@vger.kernel.org, bvanassche@acm.org, linux-scsi@vger.kernel.org, konrad.wilk@oracle.com, Chaitanya Kulkarni , yuchao0@huawei.com, colyli@suse.de, linux-bcache@vger.kernel.org, jaegeuk@kernel.org, xen-devel@lists.xenproject.org, kent.overstreet@gmail.com, roger.pau@citrix.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch updates the blkdev_reset_zones() with newly introduced helper function to read the nr_sects from block device's hd_parts with the help of part_nr_sects_read(). Signed-off-by: Chaitanya Kulkarni --- block/blk-zoned.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 9faf4488339d..e7f2874b5d37 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -229,7 +229,7 @@ int blkdev_reset_zones(struct block_device *bdev, if (bdev_read_only(bdev)) return -EPERM; - if (!nr_sectors || end_sector > bdev->bd_part->nr_sects) + if (!nr_sectors || end_sector > bdev_nr_sects(bdev)) /* Out of range */ return -EINVAL; @@ -239,7 +239,7 @@ int blkdev_reset_zones(struct block_device *bdev, return -EINVAL; if ((nr_sectors & (zone_sectors - 1)) && - end_sector != bdev->bd_part->nr_sects) + end_sector != bdev_nr_sects(bdev)) return -EINVAL; blk_start_plug(&plug);