Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp986900pxb; Fri, 15 Oct 2021 22:17:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzsHwiO9ymQ8jjkpGGY5k0arGGIdMFjOBO+VJSsYPq4BzgYk3kQvrXAFgVK15PeHrqaQ0/ X-Received: by 2002:a50:be82:: with SMTP id b2mr23157210edk.56.1634361426557; Fri, 15 Oct 2021 22:17:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634361426; cv=none; d=google.com; s=arc-20160816; b=Bb8aeKNC0B+Gc0pIRiu9RAd3dxd/C5yfUFrhBNiueHwbc6RQtKoHlG2eEAtYKWt0Bh JR8bt1m4WRtLjjGIJh3NTCMYITFKsSs0VfTzK+p3xo41HotnlUbCIawnaIxB5ZQyVmQh wu7UPASFzt0M0ByXmrIrnaUMiU32h4KblkdWFqh7Xiu2RpVO2UmtpUYDmmz7QiGAQxaA kaqPcCPttGIwVdE3JMxjemFlnyYAGAucq20O3v+PlhOhlQYr5/6LwFAXlt98WrFobyOy tXaiHAXLBb0yRBPWQh9y5Q6akMSXHPVFRcUbRb+NYZyDgwA4A4/k51Hy6FN8r1wkraKv RhoQ== 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=CZsQopzZFCFutbkFSIGbqiyQrSSJ9R5UeOdpKBwhF7I=; b=w8OPfojWmsct+hj1GUzhhnUSs7knQwevFRQ340ScwV9Uqqx7C1tzg5Kt8vu5bfM6q4 Xn7L7pn/Yww2zOnn6P2ocEJ9lD+AuLQcgRGCneRUMg0j2cox1y/9Q6oQjVwqd4vMHOwV 50W7JMc4Zimn5Y4iI70yV4zJ5030gGNdiNn2aFoP3gQQVkKJvBoQrbIx5AOq3kVD07YR nRWPtz4vlGH6R29gcs1cBAcfDCdaoVwskjfLBSA2yG1XzWTqeDn88lphqXTK8di4gCV0 2u61uWW4rKrmg/XG5tZEivFzE5eQELTpJB6FkYjxDRd66FAMGJPnjOmJ7Be+MCofz+mw c6pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=Co6wYCF7; 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 q5si11104107ejb.580.2021.10.15.22.16.42; Fri, 15 Oct 2021 22:17:06 -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=Co6wYCF7; 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 S239908AbhJONdb (ORCPT + 99 others); Fri, 15 Oct 2021 09:33:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236255AbhJONb4 (ORCPT ); Fri, 15 Oct 2021 09:31:56 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D33D6C061783; Fri, 15 Oct 2021 06:28:09 -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=CZsQopzZFCFutbkFSIGbqiyQrSSJ9R5UeOdpKBwhF7I=; b=Co6wYCF7AhUPA5SRoUj9KvX3/0 OUn3XuYq99+ZapZrOXMaffeFLI7TIa10nOOoCaWcgLL5kjNEe5sv9dkk/zaDUmot0RLPv0lI/hAnk 7M81vrANNQXDfiAq2WguipC+mpmulBU5RRiB8/b7DqhGr+4guXJ9Ej4V5VeGc/G7rVZO9SorGuR+T PQ24zoBl4Bg21VmaY53qc3PeN9McWVjplMTfyC7lYJklwr+0VrYdNxsSMlZhKxS9gTKu3Ha+VxCrp ujA3+QjINJ5dGCbFEFzHRRb5BajJ2KLveWZN7ycQfU/bnNveEeiFh6YTv4CqPavfPVChHhMumcYka hL9l2MMA==; 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 1mbNFe-007Do9-Ir; Fri, 15 Oct 2021 13:27:58 +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 28/30] ntfs: use sb_bdev_nr_blocks Date: Fri, 15 Oct 2021 15:26:41 +0200 Message-Id: <20211015132643.1621913-29-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 sb_bdev_nr_blocks helper instead of open coding it and clean up ntfs_fill_super a bit by moving an assignment a little earlier that has no negative side effects. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook --- fs/ntfs/super.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 0d7e948cb29c9..5ae8de09b271b 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c @@ -2772,13 +2772,12 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) ntfs_debug("Set device block size to %i bytes (block size bits %i).", blocksize, sb->s_blocksize_bits); /* Determine the size of the device in units of block_size bytes. */ - if (!i_size_read(sb->s_bdev->bd_inode)) { + vol->nr_blocks = sb_bdev_nr_blocks(sb); + if (!vol->nr_blocks) { if (!silent) ntfs_error(sb, "Unable to determine device size."); goto err_out_now; } - vol->nr_blocks = i_size_read(sb->s_bdev->bd_inode) >> - sb->s_blocksize_bits; /* Read the boot sector and return unlocked buffer head to it. */ if (!(bh = read_ntfs_boot_sector(sb, silent))) { if (!silent) @@ -2816,8 +2815,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) goto err_out_now; } BUG_ON(blocksize != sb->s_blocksize); - vol->nr_blocks = i_size_read(sb->s_bdev->bd_inode) >> - sb->s_blocksize_bits; + vol->nr_blocks = sb_bdev_nr_blocks(sb); ntfs_debug("Changed device block size to %i bytes (block size " "bits %i) to match volume sector size.", blocksize, sb->s_blocksize_bits); -- 2.30.2