From patchwork Tue Jul 2 17:42:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11028473 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 E9D6B14F6 for ; Tue, 2 Jul 2019 17:46:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D03A7288DC for ; Tue, 2 Jul 2019 17:46:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C084528927; Tue, 2 Jul 2019 17:46:04 +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 6AEE6288DC for ; Tue, 2 Jul 2019 17:46:04 +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 1hiMpd-0007mg-HB; Tue, 02 Jul 2019 17:44:41 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hiMo4-0007fy-EY for xen-devel@lists.xenproject.org; Tue, 02 Jul 2019 17:43:04 +0000 X-Inumbo-ID: d759408e-9cf0-11e9-8980-bc764e045a96 Received: from esa6.hgst.iphmx.com (unknown [216.71.154.45]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id d759408e-9cf0-11e9-8980-bc764e045a96; Tue, 02 Jul 2019 17:43:03 +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=1562089384; x=1593625384; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=KhPmEM2AXyHo6PBofKblkM2Y3DIiKG3VMw18OQzTeBk=; b=Wsu/JRSchpA0HZepAJvUYAjPFAL1lw7mKIwsqO1jSCs8I1kcOLgXMM+J jCozEdqn5ZWeOFEN9/mOrut9YPLyh8KpEprKwY/VnH27090nhpvZyCY+i L1FMAhO9ubCbR6p9Az/rR9D+CJHqrRaosirnym3e1OMQKhdXM7HGlRIPh xKNWMAZvoqmS2UUjcMakehIAs6/9bjfuQZUh2dnt/Getclg/3w6soiEPC 88TLBnH3M9XrKvL7qrgzTrUVtzxtLO76EVrbPMFDuCswG+TU0umbqecth EW4PqYbFz1RizPXpt4ctS664pica0R/FS4tB/Su/gjDkfNInuBJhYmPHQ g==; IronPort-SDR: C/wlCSvWpLDX6k/xAiwPzfITCtg5VenrUkcmkHUo7TvYF3Yhy4HfO8P37gzlTuHc28s1R7xyEI yruN4tXLnCACNkwIZjnaukTqQBiUgz2myZwpHOV64Nv15AVT2J8CxjU6SmG8VafHe7d9tooU3O UjPU4ulUd0Kpu9XaVGAW/Nr0Wc84MdpehXxOjS78hGOHrNodjVj4PzEWmpHvVa2SVxWYGPU+j9 xRZK/yKd8FJJi2ioEVaCrS2KyESqpC9+t1kOKJ79eEl9kN+1kINTdC10Jitn4ExSDJ3gvBp+rI XFo= X-IronPort-AV: E=Sophos;i="5.63,444,1557158400"; d="scan'208";a="113690563" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 03 Jul 2019 01:43:03 +0800 IronPort-SDR: uzhcPah2vBJvzAcqeFHhqV4E01YDiDZfeAzv3Bn/XE117uM5JWoYvan1dpctbwD/H7pK6lI4af QZ9EV8eT1YY+kxonNcbxuJ22ylo/m8aE22b1DgswHDWcu5tdjg+icoJ/8WLXCo0Yxq0rn7dts5 MsSd2NvBAUK03G4mbBuLKWsn/Xd1FRCFM4Nb6xHsW4KdN5LECjhHmMhtyvTRNfvqoF/DtSln7M DmlKV+eVcX4xVtfquALmcOxIoaplyEjzWqK1vRyUoV0JJ6SNgQIzNjDEiPB0nCxQOetFhTzL8M jNx6RdFxtILQvbGVyYlsbbUv Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 02 Jul 2019 10:42:05 -0700 IronPort-SDR: 6aWxaTBrk+Kvq4wIRr/d70nXsFtKx/h2jTgYTYDzRuzGUwI1dcEHM6gt3ZHnktHhEjb4/JCped 7e+xcGWb4ezwmmGHsb8fy4es9zxYPMfyLKqFtHBs89QcpmRPHcClv/6L9uTwE25km1MSTeHUNh QXgH2y1PN79zjwD/6RQNH5TySuXd3fIM+krOne5dzLallo/yzl5xKvgKrBEtFd2qULXFTmMcoJ 4llbiUV8AaOXSwXTCZ4YfFaNEH7P4FlfrSIC/kH4vx7TiGF3X84yZ+VK0d22WjDH7jZa8SWEP6 qVo= Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip02.wdc.com with ESMTP; 02 Jul 2019 10:43:02 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Date: Tue, 2 Jul 2019 10:42:29 -0700 Message-Id: <20190702174236.3332-4-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20190702174236.3332-1-chaitanya.kulkarni@wdc.com> References: <20190702174236.3332-1-chaitanya.kulkarni@wdc.com> X-Mailman-Approved-At: Tue, 02 Jul 2019 17:44:39 +0000 Subject: [Xen-devel] [PATCH V3 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 Reviewed-by: Minwoo Im --- 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)