From patchwork Mon Jul 8 18:47:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11035653 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 5312D112C for ; Mon, 8 Jul 2019 18:49:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44C35285B3 for ; Mon, 8 Jul 2019 18:49:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 395D728628; Mon, 8 Jul 2019 18:49:30 +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 ED8CB285B3 for ; Mon, 8 Jul 2019 18:49:28 +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 1hkYfn-00054q-OO; Mon, 08 Jul 2019 18:47:35 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hkYfm-00054b-Km for xen-devel@lists.xenproject.org; Mon, 08 Jul 2019 18:47:34 +0000 X-Inumbo-ID: d8d4e5aa-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 d8d4e5aa-a1b0-11e9-8980-bc764e045a96; Mon, 08 Jul 2019 18:47:33 +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=1562611654; x=1594147654; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=/pc9L2crAxHB7hq+ujlWtvkrNrky6qYpFgcsaAJbQKc=; b=Bqm87qlCyL2Ehz0kxOAWgxgFp2pN7X76BVbm70RgdYEQXfRiiByEi8xQ ZR1hiyubKVEkghaC/diTJw83/f/UTdZBu4d9S5zSUWynjbWZeCrYOqw+D WRGQt63z/Qks0DwGqpHnEaGFkGelpLliDi8BTqI46+TGVfBtyCTSxHOTO yVNrsQ9N/Tz4ZGL6LbWEAErO7z/UFVj5F7138wPa9TeDTprTRX5DxVOne JhPb3joJeR++B4KqQekodM2wB6MLZlEZXS1f88zmRN1eNpeGkL2t8uycg dZA4TSgbS8Dra8xY/JQ5Hgh4cFJDc+8Nf2WQo+/2oR+hcUkqRIdZQO9nv A==; IronPort-SDR: M4YTdtCeevV5EVQ8JSFk1BW41CnfqZISY6utxO+ACiGTQKZB6MPGGkSt611NuDqC5tz7z7+Htn HZ91SNhGW/Q78W3etUMt5B6+eokUl7osufYY3n51iJOGapGyO+JEuxG2Q+rOFFt0+LcGUcBNde s+rITEIgHpdC9lIUdHntChbMQBMF6p8UdgvPAJdVyF1UXJfnpFUkt1gzI7+FRhGWR6OO1xvhqZ cHQdCpWfEOhCoosrQjiuOAyTANpn9XTLK+z73mF+lWB6fxNBxqZFgg+YT0dQyS0mNRKzxeMxZH tCk= X-IronPort-AV: E=Sophos;i="5.63,466,1557158400"; d="scan'208";a="117296113" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 09 Jul 2019 02:47:34 +0800 IronPort-SDR: 6ETWBfH2N5AsdrFNNzy7z623JrLbMaV2O8ZnTu+em5k76Dfv9v50IRHdiw2SLA77ZRMWBZwYGA Rm45wBvpf80uiBbQKDMroSa4AuSlNQvZUwRnHjs3vgu9CsKrI3edzVZMXt/L1f1bc7yUAyQP72 SLo7CIs1H2uPrRGH3f0Ez3byjKo2FYKSOtL2ur9jvxdiIrA8XW6Jtlc1QCF7TXg60dVqWcsXD3 MeeCMFp+HQ9XxGwJVZAg2rNhrZP5dgc1ORD9fosJQtKlAlV05fmmEJAhh7kJRtdb+zC90XnZPK TfQ0B+MiBXTZx316XhRjtK3O Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 08 Jul 2019 11:46:21 -0700 IronPort-SDR: jWdfh5Z5t7pjUC0B9fFgAyqOLuJnVq8Y8Vuwuw3p7a+MWysaGbZwoaQwzshB2rHxKcfqUwLipY XVsaf4oWX0EjvpBNWkaZZfPekQOryyganAT5TONr5hleW1fklSNaogTOGJf93qqApcdI8fz9mz KfZHtl2vopgSzLQ1sb5TTaY8qXUFTJ18FRvM4b3y9NCSYdEddF3MpV9glHcmCofAwi4dZkmIVC gaihu23gkcHfYLTnJNU0ZelUPMn6wHyW13Dx7Ze2Ij6N6zfOw7fSaRbNf+nH3JXFZwBS4Rrg8p HLQ= Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip02.wdc.com with ESMTP; 08 Jul 2019 11:47:33 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Date: Mon, 8 Jul 2019 11:47:05 -0700 Message-Id: <20190708184711.2984-4-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 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" X-Virus-Scanned: ClamAV using ClamSMTP 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(). 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 5051db35c3fd..9faf4488339d 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -106,7 +106,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) @@ -176,13 +176,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, gfp_mask); if (ret)