Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp987609pxb; Fri, 15 Oct 2021 22:18:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJws+6an1dpnTk3/Tb1/rOJz6T1UMJND5LoPRmDjU3VHT4vu3334xJUz4iCH+Aqw7+AlG2HP X-Received: by 2002:a17:906:d1d6:: with SMTP id bs22mr12570193ejb.554.1634361498238; Fri, 15 Oct 2021 22:18:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634361498; cv=none; d=google.com; s=arc-20160816; b=wEBrYMMnbaCFGMqxJYDh2pPud8QwY3wFPcI6gAZri7affYgkxKagHzzC3tPw4XcBuV O48UACUczSwR6KIPjFqyBRQC/kmKdrGbDyLcUJh5JRACTF8L1fBltCdEnoN+tgjyiQV/ 2YXre8AmGK9Th6whasorojLEzNi2mswWASJy7j1JxlaxoTZsKcfC3SSl+RCghTkMM+xA BYSgJ45HLwu2q2KIxyZLtdC4ReWdQFwxhYFXXGfhZN6yiKi1tCFXLMIZ25wqmiT5RfJ7 /sZkEJaKFL2TyKxu/NLq/VQd91zx5EZl1q6n6xdpooE1ZIrtCGX/2cioxTuTd27Q26j0 e2Lw== 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=sSdphJbx9SQw+wN4za3/OjMw3p4iKMeSjeY0No/E5ck=; b=yKI4mB7DWWX+FFHRp5LU5A+7ZoaDmTlCaXxPx1l3VB5oMJRjmD7WtTYDnr9YpmZNCa zzv0PXl+hH/e1CHjVsLxI/DiL6D4EcGyz9oLEwJVxXteW7zFPUiidwJZgT5CwGombUWS Rklc1K3OtE+gGHj3GLL9hAJLgBN1xJFf05Q42Hm0VYJqsxO+tVctqknL1Y4Ky9PgLHVH IQ1l93KZdu3EyPW6dQQxVT30rpcX7cTjkFRVdgPPynbVJI417TkAJ8oMLa1Fj1LzsFD6 wWdCKx0TSUBjLlal9jwU0XNMQ+lomWfr8Q58xFai0X586a12hz8AcNKi0g1/gfcbOM+t T/Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=mYVi+DfM; 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 ry6si15016938ejc.180.2021.10.15.22.17.54; Fri, 15 Oct 2021 22:18:18 -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=mYVi+DfM; 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 S239926AbhJONdd (ORCPT + 99 others); Fri, 15 Oct 2021 09:33:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239576AbhJONb7 (ORCPT ); Fri, 15 Oct 2021 09:31:59 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8156C06176D; Fri, 15 Oct 2021 06:28:14 -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=sSdphJbx9SQw+wN4za3/OjMw3p4iKMeSjeY0No/E5ck=; b=mYVi+DfMh2Flgl87jrezDtyvd3 a2zTmGuRiUkEY5OqSus37P7PJYNXJeYvs4CIR89NSDvWd9hOZQRGpUq2eivUob8wqq1laQh8TrUCx 2ExLwQDsks/B9O8nP075TlWszILX5iQAAszlnb1d+Cx3e++65QhdSbskGgfjcqUh4xc5arb1PJ6D0 Qpb8qV4s18gZHs48YP3w/oR7US7tPckLc5rhfJeTdTDk8rAuiPsomrve+M6uLU7Sly4/q32G5x+4Q mq6XEPFdhNmj992DCRiM2LNJN0THqGgoA1kAepm/r9IZrWZv3xlxj1K04lBAmw4bNnmJkVkLvjFJ6 osyWQ5Kg==; 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 1mbNFj-007Dux-Lc; Fri, 15 Oct 2021 13:28:04 +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, Jan Kara Subject: [PATCH 30/30] udf: use sb_bdev_nr_blocks Date: Fri, 15 Oct 2021 15:26:43 +0200 Message-Id: <20211015132643.1621913-31-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. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook Reviewed-by: Jan Kara --- fs/udf/lowlevel.c | 5 ++--- fs/udf/super.c | 9 +++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/fs/udf/lowlevel.c b/fs/udf/lowlevel.c index f1094cdcd6cde..46d6971721975 100644 --- a/fs/udf/lowlevel.c +++ b/fs/udf/lowlevel.c @@ -47,8 +47,7 @@ unsigned int udf_get_last_session(struct super_block *sb) unsigned long udf_get_last_block(struct super_block *sb) { - struct block_device *bdev = sb->s_bdev; - struct cdrom_device_info *cdi = disk_to_cdi(bdev->bd_disk); + struct cdrom_device_info *cdi = disk_to_cdi(sb->s_bdev->bd_disk); unsigned long lblock = 0; /* @@ -56,7 +55,7 @@ unsigned long udf_get_last_block(struct super_block *sb) * Try using the device size... */ if (!cdi || cdrom_get_last_written(cdi, &lblock) || lblock == 0) - lblock = i_size_read(bdev->bd_inode) >> sb->s_blocksize_bits; + lblock = sb_bdev_nr_blocks(sb); if (lblock) return lblock - 1; diff --git a/fs/udf/super.c b/fs/udf/super.c index b2d7c57d06881..34247fba6df91 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -1175,8 +1175,7 @@ static int udf_load_vat(struct super_block *sb, int p_index, int type1_index) struct udf_inode_info *vati; uint32_t pos; struct virtualAllocationTable20 *vat20; - sector_t blocks = i_size_read(sb->s_bdev->bd_inode) >> - sb->s_blocksize_bits; + sector_t blocks = sb_bdev_nr_blocks(sb); udf_find_vat_block(sb, p_index, type1_index, sbi->s_last_block); if (!sbi->s_vat_inode && @@ -1838,8 +1837,7 @@ static int udf_check_anchor_block(struct super_block *sb, sector_t block, int ret; if (UDF_QUERY_FLAG(sb, UDF_FLAG_VARCONV) && - udf_fixed_to_variable(block) >= - i_size_read(sb->s_bdev->bd_inode) >> sb->s_blocksize_bits) + udf_fixed_to_variable(block) >= sb_bdev_nr_blocks(sb)) return -EAGAIN; bh = udf_read_tagged(sb, block, block, &ident); @@ -1901,8 +1899,7 @@ static int udf_scan_anchors(struct super_block *sb, sector_t *lastblock, last[last_count++] = *lastblock - 152; for (i = 0; i < last_count; i++) { - if (last[i] >= i_size_read(sb->s_bdev->bd_inode) >> - sb->s_blocksize_bits) + if (last[i] >= sb_bdev_nr_blocks(sb)) continue; ret = udf_check_anchor_block(sb, last[i], fileset); if (ret != -EAGAIN) { -- 2.30.2