Skip to content

Commit dc0fdfc

Browse files
author
Al Viro
committed
dm-vdo: use bdev_nr_bytes(bdev) instead of i_size_read(bdev->bd_inode)
going to be faster, actually - shift is cheaper than dereference... Signed-off-by: Al Viro <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Matthew Sakai <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 39c3b4e commit dc0fdfc

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

drivers/md/dm-vdo/dm-vdo-target.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ static int parse_device_config(int argc, char **argv, struct dm_target *ti,
878878
}
879879

880880
if (config->version == 0) {
881-
u64 device_size = i_size_read(config->owned_device->bdev->bd_inode);
881+
u64 device_size = bdev_nr_bytes(config->owned_device->bdev);
882882

883883
config->physical_blocks = device_size / VDO_BLOCK_SIZE;
884884
}
@@ -1011,7 +1011,7 @@ static void vdo_status(struct dm_target *ti, status_type_t status_type,
10111011

10121012
static block_count_t __must_check get_underlying_device_block_count(const struct vdo *vdo)
10131013
{
1014-
return i_size_read(vdo_get_backing_device(vdo)->bd_inode) / VDO_BLOCK_SIZE;
1014+
return bdev_nr_bytes(vdo_get_backing_device(vdo)) / VDO_BLOCK_SIZE;
10151015
}
10161016

10171017
static int __must_check process_vdo_message_locked(struct vdo *vdo, unsigned int argc,

drivers/md/dm-vdo/indexer/io-factory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void uds_put_io_factory(struct io_factory *factory)
9090

9191
size_t uds_get_writable_size(struct io_factory *factory)
9292
{
93-
return i_size_read(factory->bdev->bd_inode);
93+
return bdev_nr_bytes(factory->bdev);
9494
}
9595

9696
/* Create a struct dm_bufio_client for an index region starting at offset. */

0 commit comments

Comments
 (0)