From patchwork Wed Aug 21 06:14:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11105531 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 76FDA1399 for ; Wed, 21 Aug 2019 06:16:26 +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 5314D216F4 for ; Wed, 21 Aug 2019 06:16:26 +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="AZq4qqFD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5314D216F4 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 1i0JtH-0003vD-Cy; Wed, 21 Aug 2019 06:14:39 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i0JtG-0003v0-6D for xen-devel@lists.xenproject.org; Wed, 21 Aug 2019 06:14:38 +0000 X-Inumbo-ID: f3710142-c3da-11e9-8980-bc764e2007e4 Received: from esa3.hgst.iphmx.com (unknown [216.71.153.141]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id f3710142-c3da-11e9-8980-bc764e2007e4; Wed, 21 Aug 2019 06:14:37 +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=1566368077; x=1597904077; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=YxWj03mIGVcVbYKOln1UBPzCaYS0qRuFrw+e6W6O8fU=; b=AZq4qqFDmj2jz1DIlP2elmhJ736U9W2peFNz8VKlgCvLF8ycI63NWZlr gYvJsAo1RQrNmsNaaT0CgMN/B+/ohPuOzBhyFXvPKAIIwUSQLWuQJwR0f Y/+yOCvQymDLq5nP8WvRz0UFo2vzdj4zcv7tdLoIeP2idEAEPk19Q3pOJ 7JCe5dCOextv/kDlC74d3EmubmAcog3AKenLBh8Cu5dy2ZjDM0RGyRSdV nZPsWKjILbDBvlHO4r8eV88uchGhr1c5c0HR6hTR8E4cYBTzqoL5IKFz4 KIEuqPtaLnPM3SzZmXpfmp1Etaz24exSrO/RyPOLkrnkGtYrH6fHb223T A==; IronPort-SDR: MsVv/qeZcm0Ji7q/gXpc8i8DrO4rLySfr10vSgP4QDJmywDnNcKBffT7L2ZXxZZF22syJhmP5K MpVRCjXzaLyhFX3cWqzhFCin3j0PTltnF1d7LKKRT7nGeLdeVY8WUM2yCPmgQdTvcmnZnGrb+c OCt4xfDYQfh8Fa40IxHIWIrleRpHenhUlYu+eBfok9ujiM+9o9TxQsrP48AfRYuONwZ/sNOmz/ rbENHQJRwQ1Mwzdur4sW9iMl5w8ykeP7zZU3ibTw61pODMurc1aAyOXupw9X1Z6LawmcokEkg9 J4E= X-IronPort-AV: E=Sophos;i="5.64,411,1559491200"; d="scan'208";a="120898331" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 21 Aug 2019 14:14:34 +0800 IronPort-SDR: /x2WVFwhMssmG4YuCAUPOp71T5HaHEph5tsmSLnrIS/8Bft81w+S9EdUz8hkKcgQ4RwvHBfV06 CEq9lj4emOc45f/Aqmjf/tMfzXXi4VrHzVqsnm9DFb0vhCF4bKTz6OtrdyRnev4N/SVu16R0Ng 2Ww5YvZ/Rm0A/gZ5+0h8ZgcoF3X8neHkPY4zJtlJgsHJaRsfDrxvZ1PWkNG/VxczvKQqtzov2r a1bp/ktFheMqrgprUoWcnlNajrOc9mEZ8KUXo0/ggb/H+5ziMiKSulnIvlgu4Uh7U3Hwl+4iPP WZBK2JRLl6EFhz22hkPsvVwz Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Aug 2019 23:11:54 -0700 IronPort-SDR: J1I/5bgiTFIAu8nNl9kv6CSGMFr4yg0TlUcqLzMJdDy8EZZg8n4rfy/XPfR/JjpgmOnfkVltBx ssjiOGwNssK5XXLGHSuoQGzY72APilAq4AuufFX7XHX3TUf6fMAFSvIG+S4BOIvcE8H6g4FFk4 w6w8aEGbtPr28z7XjcaeIOJwLHNeebOJOnfEd1HlWA5+RnjTkgiUj/gkJ7B08lWbk1QlQ2RUaA iYA9zikhwLYCTW/T6a0mIofhJVPKp5ODf79l+YclGUXbyljEgCoXjsbem9ACoYAnj3ly4+ysyD mtk= WDCIronportException: Internal Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip01.wdc.com with ESMTP; 20 Aug 2019 23:14:32 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Date: Tue, 20 Aug 2019 23:14:15 -0700 Message-Id: <20190821061423.3408-2-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 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" 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(). Reviewed-by: Minwoo Im Reviewed-by: Martin K. Petersen Signed-off-by: Chaitanya Kulkarni --- include/linux/blkdev.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 4798bb25f1ee..aa5801c8ff73 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1468,6 +1468,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);