From patchwork Wed Aug 21 06:14:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11105535 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 903061813 for ; Wed, 21 Aug 2019 06:16:37 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 68FD5216F4 for ; Wed, 21 Aug 2019 06:16:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="A9anQx6b" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 68FD5216F4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i0JtZ-00040i-0U; Wed, 21 Aug 2019 06:14:57 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i0JtX-0003zY-IU for xen-devel@lists.xenproject.org; Wed, 21 Aug 2019 06:14:55 +0000 X-Inumbo-ID: fdb66a7b-c3da-11e9-adc0-12813bfff9fa Received: from esa2.hgst.iphmx.com (unknown [68.232.143.124]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id fdb66a7b-c3da-11e9-adc0-12813bfff9fa; Wed, 21 Aug 2019 06:14:54 +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=1566368126; x=1597904126; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=dNQR+/WArddUJx9huMcsBlSubmN9JNdoAJJzC4US2gU=; b=A9anQx6bIO4naC5PB1G9WXevQd/HRRBu1/MN7ZPY1YP0VlF7VKcKzVDq iEtAzmPWNSx94PvQIdjXajbn/7AFMF+jsaHxfnuXnwOQWBEgaHutbh3ME gQp52am86gTMkVd/kBQ+3A2/TQtan68hTByVfFeSAEuqqmXGBnkn1/z8E pqPEDEPt+V4mvYXpHBoQukzAhvVtI874YBtTSRZ9z2B7WJOZTwX5At89D WiJwt516+cdJESYRYFwAlwe9iZuDWPtMD1IoGSu2jQvajg6d9k9PXJ1lM mHxg5JdG/uwuNZefBM6Zrwzn9ZhKEodzW2oHR2eCdBguKFxD+o/Rkg1pO w==; IronPort-SDR: rfiKeW2PSYgY1/818PQmlT0ItGSPJZJNGJTe8z9Zk11wlKBKkDWqUeWUjaZyqkl1xH3iikMixj cpIWlCumZ+QwTYN6CH1/DrCrQZV6dgIyVXf4k7y6xJoU1ZxilHHxcc5jog7lybNGoLPpaSw0A1 UzW+g3XAhqzyLQH7jqdmhREErTpulFnfuKwxtvT7e3CnFYoYDGT6pt9ky0GfyFmCTgTanmuYEn 0ymn4QoOR1305DiFAZpsZNrTDqfwTmPQJhJlzH3V7+agtKhXz/dH5B8Xuu8dc1D/lqpaKDmD/d g+c= X-IronPort-AV: E=Sophos;i="5.64,411,1559491200"; d="scan'208";a="216721088" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 21 Aug 2019 14:15:25 +0800 IronPort-SDR: xuF51Ei9CYb8jjqtod4lAhT87w4TmEBmkRgt0ChoLDr8emBvuOUaNtnQbkQlM6j7HS3WIFflem jnF+4oFYMkqGJwx7eUk+VgzAcI+4mzQDGqzRrPD9KESvTjg7dF76hsMQWbNeZZ2eDxrv8Bt51E obdoa7HCz5RqE3oq9szN3Qvb97s9PzOcxCY8XTQtik01weJ2xbitadoucyvK1Fz0YsuROBJBUc oDyANNgZ+e5oqev2oSIj2IjXJERBlz435/5LzbR8xaKArmnwrtXmgiyXEkTIOYG8Y4cIB0mwj4 mVPFucG6OfK4rhNopnkcDrs1 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Aug 2019 23:12:15 -0700 IronPort-SDR: WGDSV7zozYwbRlbZcH9Vsh+dYPGAeQLVyYHbXF8UemtuqeBj1gbc3L2/qhUPOCHpvgps3+qYTw 6KCzf/ZLXk78xFV6cdmLogFtTGmboLlw3XK2ceoI6b2c+M7ALIPJEQThmicDSyitL7i3yOytT1 v+4Y82D+aKvlSZujII8U7Id+Kevc5LUiaZ6XBwmp2zgzzCpxiE2eRE2BNPGklnoPiudQmcQiOV UcqacoGyWtWWVgxu10FPvyFGi3BggvrpIAb2Pyel4K/An3TBhmBU9rAfhfEJ4/GlAyYSvjR3bp +mc= WDCIronportException: Internal Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip01.wdc.com with ESMTP; 20 Aug 2019 23:14:53 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Date: Tue, 20 Aug 2019 23:14:18 -0700 Message-Id: <20190821061423.3408-5-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20190821061423.3408-1-chaitanya.kulkarni@wdc.com> References: <20190821061423.3408-1-chaitanya.kulkarni@wdc.com> Subject: [Xen-devel] [PATCH V5 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" 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(). Reviewed-by: Minwoo Im 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 7e0c0b54d194..53f9df376cfb 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -267,7 +267,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; @@ -280,7 +280,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);