Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp807951pxb; Fri, 15 Oct 2021 16:58:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlDvvpViomqvydtM3Jgl1wsnVCKDcaE1qdLdJQJaHA1O4jKVPmN9UVhZ0FjQqrXSOyAVo2 X-Received: by 2002:a17:906:2bc7:: with SMTP id n7mr10352896ejg.238.1634342309294; 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=wAxa58Mz1BGGUm9PkC0lTUdEcmA8ICwbQqUrZROnWcHPeMpCalZ6RlVzlUIqqgDHxZ efcgAdVV7ddjLu1XWT8lZXpo2i2DksOy1izT7rPN/btP/zzIZziA0Z7JW86FFpLJlLmv g/u+pXKohDboXjcLmvfa/Qte2feE6San6k9cwg+0Nl5OkhxkVinagJ7csnKpINVkfklR eE/qlNrF4jxRxFE+5woUBeHnDlFYdTxHFeAWOJL/W98J6q6wKhV/x0olRYFZtvYEFsiv mrmpOZgVuz7b2eeByQvyQRI30xVUyFv3frkaATs0djsjh5Ak5m+CBFgFmohUdCpmz+c2 RPtg== 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=+2yJxJ+hf9XUBY4z1V99jSIIsm/dOzULx7L59VG8I+E=; b=0V1b4NIaWat1mcZJ3c4mMCBbe/5oab82cDtQEzCK+pEHI5WcLBspyHxZNmki34Xkyp 7TCrV/lMjX3VLA26HvRTeQOwdhAirTxKACkFRI7astHDct1dMTpT8gC2McdFLEtHDdeR PB0DaMXHSBKvxGVWzeh2vPtfTvNfIQWzOSZ3e+ovqgPWvtqdQCIpt87vc3GfWb7iDL7N ksvRtAmBSuTlrrJlbdi/hs9WmrKoyIQzoBa7owfN9UuFubKMkcc3wfvuTg51rHkyh1Yw TBC++374tAoZdnEP34IcTp3832LxI2RQ/dXpiunMU7C4Igrwf3Pyz7cpmB6YJ5WIZp2/ Rm7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=crPCTzLf; 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 v7si9566680ejx.484.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=crPCTzLf; 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 S239465AbhJON31 (ORCPT + 99 others); Fri, 15 Oct 2021 09:29:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239415AbhJON3S (ORCPT ); Fri, 15 Oct 2021 09:29:18 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1392BC061762; Fri, 15 Oct 2021 06:27:12 -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=+2yJxJ+hf9XUBY4z1V99jSIIsm/dOzULx7L59VG8I+E=; b=crPCTzLfFokh6HdWRPl/DSRFmP 4NrnDcgsWiCSPgK6k5zMFdXvTDT/BeZQNIIvwB0L8L+iFpx9EQHAYnotAiy3eAvJX/OHX41MHwWog ZgnJAvYhmgw98+t1qKUnThY/iMc7ATdEVFq/VdV+F02dIRkc73iSoxtQgzlzKUMG4EYQeWBq7rKXo nmgQ2taJ6bPmWVwuia8aMR3e7QNEvG5M/aYVrSr8/1hfnC+cXjiCDGqzTeqSI72B9dyj7cx6ib/18 SoJ78LcvB2/t1JkfFCu4kii4mB88+ArYpsAoIM3r/cYpn1fAVs5uFaOXIax82VvWBJBVIPThhduVB F59/wepw==; 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 1mbNEb-007CgS-N2; Fri, 15 Oct 2021 13:26:54 +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 Subject: [PATCH 03/30] bcache: remove bdev_sectors Date: Fri, 15 Oct 2021 15:26:16 +0200 Message-Id: <20211015132643.1621913-4-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 equivalent block layer helper instead. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook Acked-by: Coly Li --- drivers/md/bcache/super.c | 2 +- drivers/md/bcache/util.h | 4 ---- drivers/md/bcache/writeback.c | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index f2874c77ff797..4f89985abe4b7 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1002,7 +1002,7 @@ static void calc_cached_dev_sectors(struct cache_set *c) struct cached_dev *dc; list_for_each_entry(dc, &c->cached_devs, list) - sectors += bdev_sectors(dc->bdev); + sectors += bdev_nr_sectors(dc->bdev); c->cached_dev_sectors = sectors; } diff --git a/drivers/md/bcache/util.h b/drivers/md/bcache/util.h index b64460a762677..a7da7930a7fda 100644 --- a/drivers/md/bcache/util.h +++ b/drivers/md/bcache/util.h @@ -584,8 +584,4 @@ static inline unsigned int fract_exp_two(unsigned int x, void bch_bio_map(struct bio *bio, void *base); int bch_bio_alloc_pages(struct bio *bio, gfp_t gfp_mask); -static inline sector_t bdev_sectors(struct block_device *bdev) -{ - return bdev->bd_inode->i_size >> 9; -} #endif /* _BCACHE_UTIL_H */ diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c index 8120da278161e..c7560f66dca88 100644 --- a/drivers/md/bcache/writeback.c +++ b/drivers/md/bcache/writeback.c @@ -45,7 +45,7 @@ static uint64_t __calc_target_rate(struct cached_dev *dc) * backing volume uses about 2% of the cache for dirty data. */ uint32_t bdev_share = - div64_u64(bdev_sectors(dc->bdev) << WRITEBACK_SHARE_SHIFT, + div64_u64(bdev_nr_sectors(dc->bdev) << WRITEBACK_SHARE_SHIFT, c->cached_dev_sectors); uint64_t cache_dirty_target = -- 2.30.2