summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-06-26 10:01:55 +0200
committerJens Axboe <axboe@kernel.dk>2020-07-01 16:08:17 +0200
commit6b7b181b67aa8177e57732723106a0411570a86d (patch)
tree652706d27ce5969d0d77798b9d6ec44698a3a02a /fs
parentblock: simplify set_init_blocksize (diff)
downloadlinux-6b7b181b67aa8177e57732723106a0411570a86d.tar.xz
linux-6b7b181b67aa8177e57732723106a0411570a86d.zip
block: remove the bd_block_size field from struct block_device
We can trivially calculate the block size from the inodes i_blkbits variable. Use that instead of keeping two redundant copies of the information in slightly different formats. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs')
-rw-r--r--fs/block_dev.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 8b7a9c76d33e..06d31e459048 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -105,10 +105,7 @@ EXPORT_SYMBOL(invalidate_bdev);
static void set_init_blocksize(struct block_device *bdev)
{
- unsigned bsize = bdev_logical_block_size(bdev);
-
- bdev->bd_block_size = bsize;
- bdev->bd_inode->i_blkbits = blksize_bits(bsize);
+ bdev->bd_inode->i_blkbits = blksize_bits(bdev_logical_block_size(bdev));
}
int set_blocksize(struct block_device *bdev, int size)
@@ -122,9 +119,8 @@ int set_blocksize(struct block_device *bdev, int size)
return -EINVAL;
/* Don't change the size if it is same as current */
- if (bdev->bd_block_size != size) {
+ if (bdev->bd_inode->i_blkbits != blksize_bits(size)) {
sync_blockdev(bdev);
- bdev->bd_block_size = size;
bdev->bd_inode->i_blkbits = blksize_bits(size);
kill_bdev(bdev);
}
@@ -889,7 +885,6 @@ struct block_device *bdget(dev_t dev)
bdev->bd_contains = NULL;
bdev->bd_super = NULL;
bdev->bd_inode = inode;
- bdev->bd_block_size = i_blocksize(inode);
bdev->bd_part_count = 0;
bdev->bd_invalidated = 0;
inode->i_mode = S_IFBLK;