Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp827594pxb; Fri, 15 Oct 2021 17:27:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMD7div386sCmq7CEYBZu84c5HT0WnyTIQTgktdTId+WdBXuCn4I4t9XRnTdBZliO7t5K4 X-Received: by 2002:a05:6402:2684:: with SMTP id w4mr22342727edd.108.1634344042750; Fri, 15 Oct 2021 17:27:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634344042; cv=none; d=google.com; s=arc-20160816; b=eJFauwK5b4m8eh+GTwFr0IISrFyxBUIlqdJoUYt8PfhrDnLVCF7XwjVIfFylK1Eu/V yzoVlpeAgGtD0veFHu4z1aJNAFrfGlSmZfCCV+xtQWWOW1AcG25+LMGXb391phBARHJb jXVarGSlebZ6JFJXOYTnW8eMWFipad9Vik3QWsLKgGdtctZS+iELWoPtIUE3B4n7A2hQ RxRGI0zBa7p2Fv79DBpf1FYwP0VfjDCjgwRttGRDi2xhmkqLapaRUVkxB12K+pXc49PM 6OeTKQv4eMhGWhxP4A498uO+XFn2CiYthdd+qCn5Brt0ReNqWoNcYqOkT4kQRmA00Cin oOWw== 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=79IfCL0cwBZyl3TQ005uMyV6UFeBUdi+0xEOD4Xebrg=; b=czu5zP/kkucsHaQOI+iGsD2HGNKFgXWgY4Z7VIVoytdjQ1dM+3daVgHlnaQeaLmiLh xvIeg4/InHB8DWul3BJ+0a5HKYAFk8Rk/txBEr6xoGflphE7NszUBKQ3LgGn9sQ8GnWa pALuUO6jpil+WEQ1Lhel2pPjerD+qRwaQiUi7Ocj77WZNQ5XMET1RUJUQNAGghOiZzjx c6F3f1iZfKlk/vBQFZ5UgUAnfOxFg/lZdZfOjb2dLrZCkXeTJWEg2w1UECwez8FVBSx5 v6I1YCT4UgXFNqMNgdTqEwSPMog552jvntad4G7wrkxDu0/MvrW5pVDowfl7LMfvqiDw 0E9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=484wuo5A; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-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 88si9091649edf.116.2021.10.15.17.26.58; Fri, 15 Oct 2021 17:27:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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=484wuo5A; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239744AbhJONcB (ORCPT + 99 others); Fri, 15 Oct 2021 09:32:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239689AbhJONav (ORCPT ); Fri, 15 Oct 2021 09:30:51 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 141AEC061766; Fri, 15 Oct 2021 06:27:51 -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=79IfCL0cwBZyl3TQ005uMyV6UFeBUdi+0xEOD4Xebrg=; b=484wuo5ApXYHJ1gwVkbfmaWvz0 Psc3ElysSbrWt3zDOEnzImuxkoRsCZi+k7KdvirlXuxk3kYtIzBGIRiCVQDNq4qFi6wH207IhosnU TODkbz2vxD0rg9jjrkgDJG/zPZAV/1eGwDzlDjli6KEeRQtBCM7/pf/M/PYlq9SiRTIlbRpr9SceV n2ZblPKQ0vvPIPNkfWMAToJq2ahTA8qnMUg77IxuZKyIbWw47aFK9+EZstiD6ZFb4/uqP3965SSkF TOplTd77vyoEt068L0rP0zmi0mU0fQ1o+LDGesDwE7a9qSyur0k7qqt1sv1T/4uL1oSdK5oBtoxMs 5mLeYUiQ==; 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 1mbNFH-007DOn-Bg; Fri, 15 Oct 2021 13:27:35 +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 19/30] nilfs2: use bdev_nr_bytes instead of open coding it Date: Fri, 15 Oct 2021 15:26:32 +0200 Message-Id: <20211015132643.1621913-20-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-nfs@vger.kernel.org Use the proper helper to read the block device size. Signed-off-by: Christoph Hellwig --- fs/nilfs2/ioctl.c | 2 +- fs/nilfs2/super.c | 2 +- fs/nilfs2/the_nilfs.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c index 640ac8fe891e6..1d0583cfd9701 100644 --- a/fs/nilfs2/ioctl.c +++ b/fs/nilfs2/ioctl.c @@ -1107,7 +1107,7 @@ static int nilfs_ioctl_set_alloc_range(struct inode *inode, void __user *argp) goto out; ret = -ERANGE; - if (range[1] > i_size_read(inode->i_sb->s_bdev->bd_inode)) + if (range[1] > bdev_nr_bytes(inode->i_sb->s_bdev)) goto out; segbytes = nilfs->ns_blocks_per_segment * nilfs->ns_blocksize; diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index f6b2d280aab5a..3134c0e42fd46 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c @@ -403,7 +403,7 @@ int nilfs_resize_fs(struct super_block *sb, __u64 newsize) int ret; ret = -ERANGE; - devsize = i_size_read(sb->s_bdev->bd_inode); + devsize = bdev_nr_bytes(sb->s_bdev); if (newsize > devsize) goto out; diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c index c8bfc01da5d71..1bfcb5d3ea480 100644 --- a/fs/nilfs2/the_nilfs.c +++ b/fs/nilfs2/the_nilfs.c @@ -489,7 +489,7 @@ static int nilfs_load_super_block(struct the_nilfs *nilfs, { struct nilfs_super_block **sbp = nilfs->ns_sbp; struct buffer_head **sbh = nilfs->ns_sbh; - u64 sb2off = NILFS_SB2_OFFSET_BYTES(nilfs->ns_bdev->bd_inode->i_size); + u64 sb2off = NILFS_SB2_OFFSET_BYTES(bdev_nr_bytes(nilfs->ns_bdev)); int valid[2], swp = 0; sbp[0] = nilfs_read_super_block(sb, NILFS_SB_OFFSET_BYTES, blocksize, -- 2.30.2