partitions/efi: use bdev_nr_bytes instead of open coding it
authorChristoph Hellwig <hch@lst.de>
Tue, 19 Oct 2021 06:20:23 +0000 (08:20 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 19 Oct 2021 12:16:50 +0000 (06:16 -0600)
Use the proper helper to read the block device size.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20211019062024.2171074-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/partitions/efi.c

index 7ca5c4c374d4d51775c8a789055506973da3604e..5e9be13a56a82a704aa4819bc23f235b2f4e8361 100644 (file)
@@ -133,7 +133,7 @@ efi_crc32(const void *buf, unsigned long len)
  */
 static u64 last_lba(struct gendisk *disk)
 {
-       return div_u64(disk->part0->bd_inode->i_size,
+       return div_u64(bdev_nr_bytes(disk->part0),
                       queue_logical_block_size(disk->queue)) - 1ULL;
 }