Commit 6b7b181b authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

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: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 5ff9f192
...@@ -105,10 +105,7 @@ EXPORT_SYMBOL(invalidate_bdev); ...@@ -105,10 +105,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); bdev->bd_inode->i_blkbits = blksize_bits(bdev_logical_block_size(bdev));
bdev->bd_block_size = bsize;
bdev->bd_inode->i_blkbits = blksize_bits(bsize);
} }
int set_blocksize(struct block_device *bdev, int size) int set_blocksize(struct block_device *bdev, int size)
...@@ -122,9 +119,8 @@ int set_blocksize(struct block_device *bdev, int size) ...@@ -122,9 +119,8 @@ int set_blocksize(struct block_device *bdev, int size)
return -EINVAL; return -EINVAL;
/* Don't change the size if it is same as current */ /* 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); sync_blockdev(bdev);
bdev->bd_block_size = size;
bdev->bd_inode->i_blkbits = blksize_bits(size); bdev->bd_inode->i_blkbits = blksize_bits(size);
kill_bdev(bdev); kill_bdev(bdev);
} }
...@@ -889,7 +885,6 @@ struct block_device *bdget(dev_t dev) ...@@ -889,7 +885,6 @@ struct block_device *bdget(dev_t dev)
bdev->bd_contains = NULL; bdev->bd_contains = NULL;
bdev->bd_super = NULL; bdev->bd_super = NULL;
bdev->bd_inode = inode; bdev->bd_inode = inode;
bdev->bd_block_size = i_blocksize(inode);
bdev->bd_part_count = 0; bdev->bd_part_count = 0;
bdev->bd_invalidated = 0; bdev->bd_invalidated = 0;
inode->i_mode = S_IFBLK; inode->i_mode = S_IFBLK;
......
...@@ -33,7 +33,6 @@ struct block_device { ...@@ -33,7 +33,6 @@ struct block_device {
struct list_head bd_holder_disks; struct list_head bd_holder_disks;
#endif #endif
struct block_device * bd_contains; struct block_device * bd_contains;
unsigned bd_block_size;
u8 bd_partno; u8 bd_partno;
struct hd_struct * bd_part; struct hd_struct * bd_part;
/* number of times partitions within this device have been opened. */ /* number of times partitions within this device have been opened. */
......
...@@ -1543,7 +1543,7 @@ static inline unsigned int blksize_bits(unsigned int size) ...@@ -1543,7 +1543,7 @@ static inline unsigned int blksize_bits(unsigned int size)
static inline unsigned int block_size(struct block_device *bdev) static inline unsigned int block_size(struct block_device *bdev)
{ {
return bdev->bd_block_size; return 1 << bdev->bd_inode->i_blkbits;
} }
int kblockd_schedule_work(struct work_struct *work); int kblockd_schedule_work(struct work_struct *work);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment