]> www.infradead.org Git - users/hch/block.git/commitdiff
partitions/efi: use bdev_nr_sectors instead of open coding it
authorChristoph Hellwig <hch@lst.de>
Tue, 12 Oct 2021 08:34:27 +0000 (10:34 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 12 Oct 2021 08:34:27 +0000 (10:34 +0200)
Use the proper helper to read the block device size.

Signed-off-by: Christoph Hellwig <hch@lst.de>
block/partitions/efi.c

index 7ca5c4c374d4d51775c8a789055506973da3604e..6ad1cd99633e989421eb38444a60f04dbe5892e1 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_sectors(disk->part0) << SECTOR_SHIFT,
                       queue_logical_block_size(disk->queue)) - 1ULL;
 }