From patchwork Wed Aug 21 06:14:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11105525 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 DD02514DE for ; Wed, 21 Aug 2019 06:16:06 +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 B8F5B216F4 for ; Wed, 21 Aug 2019 06:16:06 +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="kOEkZG8s" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B8F5B216F4 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 1i0JtS-0003xY-Mt; Wed, 21 Aug 2019 06:14:50 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i0JtR-0003xJ-ND for xen-devel@lists.xenproject.org; Wed, 21 Aug 2019 06:14:49 +0000 X-Inumbo-ID: f9fbab8e-c3da-11e9-8980-bc764e2007e4 Received: from esa1.hgst.iphmx.com (unknown [68.232.141.245]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id f9fbab8e-c3da-11e9-8980-bc764e2007e4; Wed, 21 Aug 2019 06:14:48 +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=1566368088; x=1597904088; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=fAftc0jXLF+PYgBKMR7sJr2letplG8FiARgg+iOt4Mk=; b=kOEkZG8s4DslUbNnuq6fEsITInDsbekOalx3uxL6EHbIusecf7sgQ9+i GJsyAXnnudLERdFZd0NY1e1hpcWWpcTdIytR/frtwiHK2TIXAFjtglcrF 2eUckx5FcNbJFIpwXy+4ZljKjYwrMWNEa8OMBylTNu/lx9nzE9tNvVRAC oPXGzUe5MakxXEQ8FbiqkGWGS314xD4DnwZT3A2MIySTmUYFHrhPy1AvS Od7EvnWiPEgvOlGk6XtnLFuTeAFIM5Q6wHbioMeos9NW5fEvbRMDFf+gw KN98zCQY5PV1Uk3auepW89Zd0z6jRcR/iAwse6ORjN+nBwgOiO2ixEF3j w==; IronPort-SDR: FVb9DtIC19fDSWK5eoeMb2oYg3TR4U/0Y6UWJDtJJX709E8VgETEkLdtlmL7EiLBVgrSQA+O0X VSrhyqpkfDAQsCqNI7gzMnoSlnn3lc0i3cxQFg91mVX+/9vHIuIdgfVw+K4a3pxV0tB3izP3wO QVYxAv+QD6v9MmNW0xOmtxtzoEQFeLjjA6QV5Zo6iAR7RAC9sduUh7g7b8dIZHcfKFpzr0fHo0 qjfwbKcKx46A8LoASCCF/ao6ecTD6uqWveLSuvFgx4lXYN1ex1xO0Da3mLGksy1HBdbPm+mfnh hX4= X-IronPort-AV: E=Sophos;i="5.64,411,1559491200"; d="scan'208";a="222880789" 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:14:47 +0800 IronPort-SDR: Q/VIHExfI1uKQGKfaJkPgo0rKRmbxh733orgHp6u5yWTFppE49jVGqKIFWmysrOWU8ppRyelZB 3zseTYVTqUeHetjuS6iRfZVZPF8n5SWWK/jZ4qNvqBJi75+H9q1a6fk8/TFWYbcY6VqyV7unzk fj5wQgtpL1U8BSTRr1EcFy3Y1F3FhxGmH5Oc1uuut5MybWp8RVFfZm0MbHgvP8Gc7To2dXtkM2 5dvYmC3rva7Rkcbp8DXWG8JN6/u558nKXENCMv2OjDlx2+kO+g5sQeahHavZ1WZvQ2tRhV/3uB 7FqZVX+tW62v3io5Hfw/zSO0 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:09 -0700 IronPort-SDR: 5VdlNZVMNPdB4YJKi8PvEuaTgpLYyJfh2G/rBJ/AFXXZQlCBvtiNoYa7ESeeEq6JoKhDakQyQ3 bzj4rf3rS5gKcHvy0LSRr1h325MA8E4vMf0unZpmXiHbj6LGx2U6Y9bgmSHdFLKdRjPf4RGA9+ HwIzbBlZS6rNLPIocY2VAP2a1yR7H1bp99zjaHM6EqIEWm1ysT1yq9XJYu1XdiXk7/3pAgpb4V uRKAxSzSii+HX5bHYsNUptuuDX0oQ0jdvrOp+F5m95Slc4aGqzUCOtNlfEJhQ7uyeuvqUB4rIT KXg= WDCIronportException: Internal Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip01.wdc.com with ESMTP; 20 Aug 2019 23:14:47 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Date: Tue, 20 Aug 2019 23:14:17 -0700 Message-Id: <20190821061423.3408-4-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 3/9] blk-zoned: update blkdev_report_zone() 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_report_zone(s)() 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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 3f5e9bf03486..7e0c0b54d194 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -109,7 +109,7 @@ static bool blkdev_report_zone(struct block_device *bdev, struct blk_zone *rep) return false; rep->start -= offset; - if (rep->start + rep->len > bdev->bd_part->nr_sects) + if (rep->start + rep->len > bdev_nr_sects(bdev)) return false; if (rep->type == BLK_ZONE_TYPE_CONVENTIONAL) @@ -178,13 +178,13 @@ int blkdev_report_zones(struct block_device *bdev, sector_t sector, if (WARN_ON_ONCE(!bdev->bd_disk->fops->report_zones)) return -EOPNOTSUPP; - if (!*nr_zones || sector >= bdev->bd_part->nr_sects) { + if (!*nr_zones || sector >= bdev_nr_sects(bdev)) { *nr_zones = 0; return 0; } nrz = min(*nr_zones, - __blkdev_nr_zones(q, bdev->bd_part->nr_sects - sector)); + __blkdev_nr_zones(q, bdev_nr_sects(bdev) - sector)); ret = blk_report_zones(bdev->bd_disk, get_start_sect(bdev) + sector, zones, &nrz); if (ret)