ext4: use sb_bdev_nr_blocks
authorChristoph Hellwig <hch@lst.de>
Mon, 11 Oct 2021 14:47:47 +0000 (16:47 +0200)
committerChristoph Hellwig <hch@lst.de>
Mon, 18 Oct 2021 04:56:54 +0000 (06:56 +0200)
Use the sb_bdev_nr_blocks helper instead of open coding it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Acked-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/super.c

index 0775950ee84e311980d29fb8fca95385cb8e10ff..3dde8be5df4903018af23d591b5759b029070d12 100644 (file)
@@ -4468,7 +4468,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
                goto cantfind_ext4;
 
        /* check blocks count against device size */
-       blocks_count = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits;
+       blocks_count = sb_bdev_nr_blocks(sb);
        if (blocks_count && ext4_blocks_count(es) > blocks_count) {
                ext4_msg(sb, KERN_WARNING, "bad geometry: block count %llu "
                       "exceeds size of device (%llu blocks)",