block: simplify set_init_blocksize

The loop to increase the initial block size doesn't really make any
sense, as the AND operation won't match for powers of two if it didn't
for the initial block size.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Christoph Hellwig 2020-06-26 10:01:54 +02:00 committed by Jens Axboe
parent 9011495c94
commit 5ff9f19231

View file

@ -106,13 +106,7 @@ EXPORT_SYMBOL(invalidate_bdev);
static void set_init_blocksize(struct block_device *bdev) static void set_init_blocksize(struct block_device *bdev)
{ {
unsigned bsize = bdev_logical_block_size(bdev); unsigned bsize = bdev_logical_block_size(bdev);
loff_t size = i_size_read(bdev->bd_inode);
while (bsize < PAGE_SIZE) {
if (size & bsize)
break;
bsize <<= 1;
}
bdev->bd_block_size = bsize; bdev->bd_block_size = bsize;
bdev->bd_inode->i_blkbits = blksize_bits(bsize); bdev->bd_inode->i_blkbits = blksize_bits(bsize);
} }