From patchwork Mon Jul 8 18:47:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11035651 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 638D3112C for ; Mon, 8 Jul 2019 18:49:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 51786285C7 for ; Mon, 8 Jul 2019 18:49:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4408328658; Mon, 8 Jul 2019 18:49:29 +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 EDF09285C7 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 1hkYfd-00053t-55; Mon, 08 Jul 2019 18:47:25 +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 1hkYfb-00053o-Sh for xen-devel@lists.xenproject.org; Mon, 08 Jul 2019 18:47:23 +0000 X-Inumbo-ID: d1ded1b8-a1b0-11e9-88ff-97e218bd4d55 Received: from esa2.hgst.iphmx.com (unknown [68.232.143.124]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d1ded1b8-a1b0-11e9-88ff-97e218bd4d55; Mon, 08 Jul 2019 18:47:22 +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=1562611658; x=1594147658; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=ynS3SVE1xBuxWEb/5le/J5u09MnENI/7CT28vcHZjn8=; b=dgROoCEx8szqPlDFJAXg/gzCWyyaELw4nZ/gmWFwoCHcc17Ae2Fbhyq0 RJmwhpIDbveOF9EizS9yvMDWoFMnL/mGn1UXamGDa0BXs5eOz58+tkUY7 NhL3kK7KiYjGqZrPWIwNxhQlhUstpdidYgKAu7doPtzhFruJbSxlKRQuz ANerYOoyv31NxdvhFiHGerIVtvIozNdg87dvs5K/b4GEHnUPr9HiArFDi iCV8BmJwaMSePtEgXMOGd4yGjK97tEnqqy4kvIsX9qU5uiDq4EEzL/1BG TIH+LazYUPJ++gPBwhy/FuJQ88BjgQSBTCPZdrYl309AcbdgQu6xuMPu3 Q==; IronPort-SDR: fm6ACR9UpYEWEsBTDAm7kKsL/g89sja6WpY5G5pXQpAoXqcODzhp7797orqCz6+z7hod5CBMnx XuEkGpz5xjR0cLsnpWKO/yjwdAQiQQF4Wh07IJOrPGA4lno4zMiSq9NGjxMXJC0cPIUoKpYcnr O7BD1Qda3I6BjJ8zeYu70JNKUKjAsOPcFHzE0pDRTs86jEtsKaQU6ZjL4DbYJnlgCm9gv8U4Y+ pvuPrZqazORuCs1QqJEFmEO82A8h4lWMf301JeBH6XorldSfGHlWxLKWJcGVPRPEedxagLikJu aFg= X-IronPort-AV: E=Sophos;i="5.63,466,1557158400"; d="scan'208";a="212364697" 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:38 +0800 IronPort-SDR: 4OAezxRywqaHiBAjJNVkwnNNZ9/MUN+98Nme5GlkgXgqUyulmzemJinaVWi+enewDYY+rH4EZa sd4Fdug2x5XDlrOhIqlmankqmHEdTCQwoWnicw1hsp02zX0itu1Zc4lX2rNtbCNGyl7APRDm3q +mQ8OAAglQ3wE44NO2fmnlnkigQUz62JyCi/Z0z/CClXAKQbloid8V16Xkl8p8XPDqKzv5mM3T oXGNWrHpDUSr63OCxcyZIjCh0JOa9A1ePASHs8MMMufb8NN8wVag9/+nLdbE9ALyAQXw2J5LPa TLGGD6FjWgOuTNRzv4bnVrV1 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 08 Jul 2019 11:46:09 -0700 IronPort-SDR: XdrWNX/tHtwcbFCNAB6UtpjebhDmq2dIv5jQgtYneGZQJU5abS18Xxpst5IKOao5xF9DCI0hfE xaNjjXfl7Gy+wJkpahPgBFEUFq0XxSkv0wuJyr5ATn74oeIFo5FlSPmRmUkSaDm6J4qhHKgvbj fCx5bhYCef4cpXOOhHrym3RKYWASi8n2UtTD0M6qXFVWYaJt0b3P0NNZ/V/Th9cTV6+fg3R8cP bGRKiR96Ui7ZbwZSEA4GoKxvYPky8Mm2Rk9rD/6gna+OoY7JIG6rdt9GtjZ7CveE6MEpnuLfkT GXg= Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip02.wdc.com with ESMTP; 08 Jul 2019 11:47:21 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Date: Mon, 8 Jul 2019 11:47:03 -0700 Message-Id: <20190708184711.2984-2-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 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: Martin K. Petersen --- include/linux/blkdev.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 0c482371c8b3..578383712093 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1464,6 +1464,11 @@ static inline void put_dev_sector(Sector p) put_page(p.v); } +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);