From patchwork Wed Aug 21 06:14:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11105537 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 67BB814DB for ; Wed, 21 Aug 2019 06:16:46 +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 438C6216F4 for ; Wed, 21 Aug 2019 06:16:46 +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="pn/JINVj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 438C6216F4 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 1i0Jtg-000449-KY; Wed, 21 Aug 2019 06:15:04 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i0Jte-000434-Ku for xen-devel@lists.xenproject.org; Wed, 21 Aug 2019 06:15:02 +0000 X-Inumbo-ID: 01e03874-c3db-11e9-b95f-bc764e2007e4 Received: from esa6.hgst.iphmx.com (unknown [216.71.154.45]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 01e03874-c3db-11e9-b95f-bc764e2007e4; Wed, 21 Aug 2019 06:15:01 +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=1566368101; x=1597904101; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=TWIY4zyMbnSdbPfWCQisLpNGsxuN7LEVg7rZifVilrc=; b=pn/JINVjgUqubKHvgPvCNqgn7pG3wqXXyOaw89kYE6ytO+EPzlFvjK9V 3iUNRRjXj71UT7gIWihPDYKnV3rxqa4ZDe2qoP4pA7IndBzTobT0giYbV LLQdhQ+rv6fnm93evU89aKSfc7WIZ4pYOVamQxRFf1XrEkiA5t9CY1ilM djcJPOWsOD7PmMVEqtT1ofT0nVjjvTIgg0heIFQ9riXXr/Wv5U75eb4ZU 59fJm7TwRDGdP9TRjZc5+ikZqmC9t5feZQV2veIJ54bfxZNehNK74jjDM ce8Pv3EKPgImkhNKEeCNJKoWJHVHYNZ621V3kvkrFI3L68RHvdnB1zWNG A==; IronPort-SDR: 4+JRm2EKlRPM7Eie4NTCXUmVv7g4sQu1v79uXll+BfVC2gZP2JgUyTaj/N/MrDbtE4rrVHvPQl fmNhIrf+okpm2ApU4ufXgTSo+t0AaVhwipAVgCES8Tck/+uS6CZhdZaXNPs2ctTJmI4U19qMqE J0juTdEpZmZy377gWYrB8z/ENK3GsRXn3JkXX5i4Y3p+kFev3yjNET96uhUTDcXkCmy6s+DZdW otZZVDynd0OWjxgwKcbTAUjasbxULVH2J1chOFHYRraPxUv/5a5jpS8bGDdM2HrnTMwOC2KQKL wrg= X-IronPort-AV: E=Sophos;i="5.64,411,1559491200"; d="scan'208";a="117904710" 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; 21 Aug 2019 14:15:00 +0800 IronPort-SDR: lO/l1zblGUq94kn9nZ48rBDYJUUay1zBSyRMbRSkGHJHg5RPyfcMoRBeqUCOp3gEk2siFpYa5f xfoV9q+gUNZgkSijYA9UzISQxROE2FT/lqcPsYsPg9p3RncjmljoUQljQHzjsfExMx3l/U80Il BaPZN7age0Hdp1xcnE+dZ8CP2DNbnAoMKk+TH4FUtY/9xZfCtVp8ynBhsuwBKzRIaEwLvraDUp P5W9ZC/1O61u3ktX5/8XNJF7kt4QD2TXF9jsNHiSmu/+xow9qlXFVEFN7G5oT8cN2OTo1GoQ8W 6/OnikgphnBdFRgtaz7EeYtM 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:12:22 -0700 IronPort-SDR: 5/S77yaPX7vIPc8Ykudto5lXNWJHWMf9k8eRp3VA22ShuUnIWyO7HBQ+5tzxRnuB/rl895d70I 86QpiaX1uJ/JbLojGMgXm9WeY140bDRfoabDuUfUsNls8qwqFznkr5GENwDhjTPYv9YElxi/x5 5nW/zc6pDo9no7FW7MUum92rzmL3Z3p7aRGH12FMJl75j77cAWHqi4J3a7DmFbACMIS2GPs3g5 uX4v7+k8k0zwseAE//uhMbrgJlegwYblO909AXAa1Kdxm8kkfVOoN1UvJESvG3Wy20saiTR79E CZ4= WDCIronportException: Internal Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip01.wdc.com with ESMTP; 20 Aug 2019 23:15:00 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Date: Tue, 20 Aug 2019 23:14:19 -0700 Message-Id: <20190821061423.3408-6-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 5/9] bcache: update cached_dev_init() 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" In the bcache when initializing the cached device we don't actually use any sort of locking when reading the number of sectors from the part. This patch updates the cached_dev_init() with newly introduced helper function to read the nr_sects from block device's hd_parts with the help of part_nr_sects_read(). Acked-by: Coly Li Signed-off-by: Chaitanya Kulkarni --- drivers/md/bcache/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 20ed838e9413..79c848fa5912 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1305,7 +1305,7 @@ static int cached_dev_init(struct cached_dev *dc, unsigned int block_size) q->limits.raid_partial_stripes_expensive; ret = bcache_device_init(&dc->disk, block_size, - dc->bdev->bd_part->nr_sects - dc->sb.data_offset); + bdev_nr_sects(dc->bdev) - dc->sb.data_offset); if (ret) return ret;