From patchwork Tue Jul 2 17:42:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11028477 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 502C614C0 for ; Tue, 2 Jul 2019 17:46:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B1EB288DC for ; Tue, 2 Jul 2019 17:46:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DC1228927; Tue, 2 Jul 2019 17:46:07 +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 D1E84288DC for ; Tue, 2 Jul 2019 17:46:06 +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 1hiMpe-0007ms-5P; Tue, 02 Jul 2019 17:44:42 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hiMoN-0007ga-0y for xen-devel@lists.xenproject.org; Tue, 02 Jul 2019 17:43:23 +0000 X-Inumbo-ID: e25591db-9cf0-11e9-8980-bc764e045a96 Received: from esa1.hgst.iphmx.com (unknown [68.232.141.245]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id e25591db-9cf0-11e9-8980-bc764e045a96; Tue, 02 Jul 2019 17:43:21 +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=1562089401; x=1593625401; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=0UgEtdIHm7+hH9Kxhy5WBonEw4nU5YoTIqQ0fdsN3UA=; b=lOcGA1qjpfFQ2aDY1c/LcEDb7gBvNxtK07AO4QrRNFDU4+HWJVi5TKco DBQUdFnzV535u03zhCArlKP+hKhy9LHkIxDR4yqdwYdN1MUu9jDBkXfSE sxrZpXjaBC9Dc+jVwzTEkqCYNkPdPerDjZK+cx2VNnGwgoDUMw4RjHV9n KFGoS2LE/wtnxleQ7jcYmaaPG1pp/m9kpG/1v2am2SnpsOg/13MH9pUkN T+piw3FMdueJzPzyuYdhWrAzzK5ykrSN/yuoxg9BgVtWJMnZOdN33mep1 AnXF8g8TW71d/+JEmU7DxGGn2kJmxUArC3nV0ASK+mBbUZ/3OyilffVIf w==; IronPort-SDR: Est5czJKx0ZLuLlhD46yi07ZSFqIOOrVuznzaayyAaYXxUcMtm4xBVlKVBQuckIlmIjiepGZJ9 LJoe6P/H9jXB3LoSgcoX6s/zHmFujZ5QLKMv0h37+bIW3fOFxfoCFnbxMtipxxZ7TLIW0gRQ7g 4L1pBqcbybkSY+c/GSIF+WDBR+IfSZ+m8gW/i6iLmPL0328u9G7ZsUZn3KrFhv74ZW8attDRKo RXYlVLP0hhjIAyXj0tVivoGaJ6P+4Zhg6JJrFWUNuRE95rWTAx0ZCnmgiDMqcrnyEwAmyM0Yvj J/o= X-IronPort-AV: E=Sophos;i="5.63,444,1557158400"; d="scan'208";a="218460019" 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:43:21 +0800 IronPort-SDR: O4vg4I65mT8nzYC/3TARPI6Zd8NKC6WLpFt2mPaPVZh+DUdDBPFfHF7KPprkts3ZH0803UEIMg jmJtYK4SGBGpanJsBLpluq9CMj3K71Y4q2JKAmeiWt8t/H+BO+o7qk7BrcdbA5gInJs8Bqqc6u R+Vj4OpI5kGAfV37oOtpfj0t77W55Q9K5w0C4dZBka+urhq2te8v0cZxZLe/+I/QwMapvj01fU hF0RVQMZglt0YmKfEgymvB6CEp4rVCwf+iw/Uhi/jJXOEkJzo6WRgwcDpkFbqIsTR9C5xzrw/u ofNX8vjqDVmcqiXqlppRabiP Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 02 Jul 2019 10:42:20 -0700 IronPort-SDR: dsdfrG+O+D0YYUKDQmR4iE3UN3zVh/hsdwUfa6x7YhTtUiGIL8CpmfkBwMDTgt0WzdLK9m8IAG jYsHWpvDyzppL1pgzcvOiz9dvRaFzp+UV4DGE2Qj6epyYaGFA0N+k406z9PObsn/0+cPUjLQ/X WE1E455mHT1sBW+V63HZhc7EKmX80L5NAxQo4WHs+RnjTp6Exnns3m6jjZroXcgog5MKSTbJER ZZjwX0UI2MDh6Rwc5quokKaI99tN9VzJI2KH+raddvpBf/NohnJUIwwJVnZcacJhGyuYPLliiT GoM= Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip02.wdc.com with ESMTP; 02 Jul 2019 10:43:20 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Date: Tue, 2 Jul 2019 10:42:31 -0700 Message-Id: <20190702174236.3332-6-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 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" X-Virus-Scanned: ClamAV using ClamSMTP 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 1b63ac876169..6a29ba89dae1 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1263,7 +1263,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;