From patchwork Tue Jul 2 17:42:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11028475 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 10B5414C0 for ; Tue, 2 Jul 2019 17:46:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF191288DC for ; Tue, 2 Jul 2019 17:46:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E26BB28927; Tue, 2 Jul 2019 17:46:05 +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 95AA2288DC for ; Tue, 2 Jul 2019 17:46:05 +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 1hiMpc-0007mU-TQ; Tue, 02 Jul 2019 17:44:40 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hiMnp-0007fK-60 for xen-devel@lists.xenproject.org; Tue, 02 Jul 2019 17:42:49 +0000 X-Inumbo-ID: cd90e234-9cf0-11e9-8980-bc764e045a96 Received: from esa3.hgst.iphmx.com (unknown [216.71.153.141]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id cd90e234-9cf0-11e9-8980-bc764e045a96; Tue, 02 Jul 2019 17:42:47 +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=1562089367; x=1593625367; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=nzpq2q6z+7BZy2jXxkdotmkGvF20O6oeceGehTa8YQ8=; b=aZMZtH1m5/y+e/PLk/YP39cvhrVB6sYhlC1sBM8KllwtnFeulHnkQgm7 x6Bc9EL37GeL+WzLi42DojhAHbxAk1/ju4HDovdutdOsh4XNEfJ+VFW4D lGOuCeiwT/kwNE6r6124LygxEGL7///QaXv5SJRCm/M3YeeqilZB7t1Yu Pt/wO1RnpSXR2VqyANWkA9idYpoMVsbpWx/MZ2K0XcDHLcDLzDjBu8etn rt7qICFdZl4LIVbsGyJO2jnb/uN40Tmr2j0BK9RBaa2CZEgh0CC8mBJlA zgps7nQ02EtXZT73A9/lMOaZCsOtj45VotVxpqvMDC/iAey9eNgg6+smY g==; IronPort-SDR: ECiyRcIB2FAaIJDzsti6JDTbFe4YHYMEBg91pFuysCyANcEKud5fZ2p8b9agtr4sD/e1bFaP3+ fj9/3r0ZNWhclFuqiu1FT7pA+gc1GkdOHhfkG+9tOK1Nx6KfRuqVo0Y8eCnOU+JfZQwhYxYM/S jjrjIQUfGmta9GniU8HCc4OkmvnFRKowMZpffAvrmcClYnlhnM2SRdSkFFKvJKxw51PXhMun6a qpiV+2QmaooYpmceC6CEveRxMsXbjkQviUPZjP8anSZUF0zKr2Zo0E6t8weMaGsJbxAWa5cBlS bzQ= X-IronPort-AV: E=Sophos;i="5.63,444,1557158400"; d="scan'208";a="116916530" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 03 Jul 2019 01:42:47 +0800 IronPort-SDR: 7eiwyhzqxRlLi1tqea43WkbeHyECBbk7usevsD+Xz1biXrqGZ4L0silrVQTgvHS5w3vcRIyHo3 Ow9Bv2tAGqZYSmDV+kt+6Xr8YYF3/TUoYBv5xCBjGp5q6CN3GbQY6MuUWU5455FoMrPrs5gesg 3GMEFpHsdxcIYOkW3N3ZjA3JNajdZtH6KifkF5ZY2+Sv4Hq39OknS0bc8lySJNafyTtwHUci1J +eiRsS2i1tyMulnk3smAIHMIvyqyOdIgTAZx4rntA0+BpNM7ZWqudfQaKJmuLDhVPqBb6AypYD h+HRCF4peQFfWzLy7o3OMb6X Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 02 Jul 2019 10:41:45 -0700 IronPort-SDR: PULQy2lnpUjzZmGu5JhOPM0yZ067ec9EuCSAYxpuoeel4NTIXUCfgyS4rhbF25Q7yRUqnKjJjO CP1MdvtMJIn2BUXo8nmrX5ayVwfG45PvBnj1Se1hmqO/H2IJqLy+IP8Kg2K+s2Xj+EgkZWW02g anJeJj1nyY5U/2ClaYOMcnAe03Lwy49+x9vakB7tPIjcZZdty/SvzK2wSsXbiK+BxED3VRniEP eYYWAlSc535zS92ZL8AaU3F97Xew5XRNC2UFo/huZ0jIVGZ/OGA+nQC4AFOvTDhTQ795+4uCYY dd0= Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip02.wdc.com with ESMTP; 02 Jul 2019 10:42:45 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Date: Tue, 2 Jul 2019 10:42:27 -0700 Message-Id: <20190702174236.3332-2-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 1/9] block: add a helper function to read nr_setcs 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 introduces helper function to read the number of sectors from struct block_device->bd_part member. For more details Please refer to the comment in the include/linux/genhd.h for part_nr_sects_read(). Signed-off-by: Chaitanya Kulkarni Reviewed-by: Minwoo Im --- include/linux/blkdev.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 592669bcc536..be7ee5a0b0dd 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1475,6 +1475,12 @@ static inline void put_dev_sector(Sector p) put_page(p.v); } +/* Helper function to read the bdev->bd_part->nr_sects */ +static inline sector_t bdev_nr_sects(struct block_device *bdev) +{ + return part_nr_sects_read(bdev->bd_part); +} + int kblockd_schedule_work(struct work_struct *work); int kblockd_schedule_work_on(int cpu, struct work_struct *work); int kblockd_mod_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay);