Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp807953pxb; Fri, 15 Oct 2021 16:58:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwON6joHXaSRoaC3yaf1c/mLH6jOPkjy90hNWCcSsPnGEu4UjDu4e2MMLol2SGR5Tf00aA8 X-Received: by 2002:a17:907:2dac:: with SMTP id gt44mr10841304ejc.265.1634342309439; Fri, 15 Oct 2021 16:58:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634342309; cv=none; d=google.com; s=arc-20160816; b=C6GTlGgNs2IdTYuXDcyHC8VqF8poVyPcIDFYUsnUnHce/4QWoZzJWNSE+4y6lRww7x Vxnhecme+a/GBWXzw66ziIIT4i7fySXGZV2yMX2GNRIAmW0cYwaNvFZ/7ojRFDIrtXy9 FK1a/pOpIrhP1mSyNttFLXnJOI2Fp4gClMXCgonwvffZG7URoCmoMSvMJTFDTZzVV2gD QJsAEBySloDN5OjPW+CrP+zvfUuHiRt5rXyWG8UipdOxwkdpaf9Te9pRMLpYLmzV330C o9JOQzaf0GIFSHtnKROjOaVa4FsLri/0iFGZI5vZOgC/8JqO021N0VdRR3XvfxELTHms ErGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sRz3ktGyKoN3l7m+veOu47xjytoh4FxLpztSQgTc2E4=; b=JQTFuchsw66SYyLfauyIo97LZ6bYPEaG5YVSHn4BUEq4K2xaWOpkBJodUWKL3ZSzdZ Tj+kTPFit6rnBmoskJfGOpsW+6eR2KUIJlLSfYKsYEF3+H/f3HlRjw16txQVz5SphT0v FhT4+5gyPT/tnwDYYeb0zNrgLaJ50qg88fqLE8+fcuHOqG2r3cRyTGBeWGfLc1Zoy+0n tWBUo1RES6Z7qggDWk2YdNlvCJ0Qxmc7YephKT6mQDleVSaZivXSAmJeoWqaZ3Ph0VdD GtsIm2QXE2VJyS9WOLLOfC/xi+4gQZjwyQ4LcMx+H/TsooUByNfHMC69MEvfLLemv34x O3Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="2Hl1p/KJ"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y17si8719179edv.613.2021.10.15.16.58.06; Fri, 15 Oct 2021 16:58:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="2Hl1p/KJ"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239472AbhJON32 (ORCPT + 99 others); Fri, 15 Oct 2021 09:29:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239429AbhJON3U (ORCPT ); Fri, 15 Oct 2021 09:29:20 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5A9BC061570; Fri, 15 Oct 2021 06:27:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=sRz3ktGyKoN3l7m+veOu47xjytoh4FxLpztSQgTc2E4=; b=2Hl1p/KJtE+43LsxTKrPI56Tp8 Z1u+/nKEpjLeDRsVPz1SlqoWGEAiGFveyGkqNqrDzwiS8vMbIEnifQ9GKxFW4loCtgmo6f/H29/3P AK5NgH4FJfKgTpOGnPNqvOG5Jo7ina885H6Jio3wLA9OoS7K7N2U8G6RoDNn1rlPvWuSwFnf3fXYP 9bl6S1SU1fq17NHsCqHIPkC9ocMvzizEmjdReZFGk67McOTn5rGLXmFDzdoWna6qkYjsI/v973sMK HVTm4g6kp1gKcvshrk1c7E/XrmY6kmJcG9L9srP+/nGz0DPmAWB2s2dUQVPShEk277OD1aJw9QVen 6LK82y4w==; Received: from [2001:4bb8:199:73c5:ddfe:9587:819b:83b0] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbNEe-007Cim-8V; Fri, 15 Oct 2021 13:26:56 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Coly Li , Mike Snitzer , Song Liu , David Sterba , Josef Bacik , "Theodore Ts'o" , OGAWA Hirofumi , Dave Kleikamp , Ryusuke Konishi , Anton Altaparmakov , Konstantin Komarov , Kees Cook , Phillip Lougher , Jan Kara , linux-block@vger.kernel.org, dm-devel@redhat.com, drbd-dev@lists.linbit.com, linux-bcache@vger.kernel.org, linux-raid@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, jfs-discussion@lists.sourceforge.net, linux-nfs@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-ntfs-dev@lists.sourceforge.net, ntfs3@lists.linux.dev, reiserfs-devel@vger.kernel.org, Chaitanya Kulkarni Subject: [PATCH 04/30] drbd: use bdev_nr_sectors instead of open coding it Date: Fri, 15 Oct 2021 15:26:17 +0200 Message-Id: <20211015132643.1621913-5-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211015132643.1621913-1-hch@lst.de> References: <20211015132643.1621913-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Use the proper helper to read the block device size. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook Reviewed-by: Chaitanya Kulkarni --- drivers/block/drbd/drbd_int.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index 5d9181382ce19..75fda53eed8cf 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h @@ -1826,8 +1826,7 @@ static inline sector_t drbd_md_last_sector(struct drbd_backing_dev *bdev) /* Returns the number of 512 byte sectors of the device */ static inline sector_t drbd_get_capacity(struct block_device *bdev) { - /* return bdev ? get_capacity(bdev->bd_disk) : 0; */ - return bdev ? i_size_read(bdev->bd_inode) >> 9 : 0; + return bdev ? bdev_nr_sectors(bdev) : 0; } /** -- 2.30.2