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

Signed-off-by: Christoph Hellwig <hch@lst.de>
fs/pstore/blk.c

index 04ce58c939a0ba156dd73c4a259b108552e8cd76..f43009cb2ec82c3994eaf4c155888af7994909ed 100644 (file)
@@ -223,8 +223,8 @@ static int __register_pstore_blk(struct pstore_device_info *dev,
                goto err_fput;
        }
 
-       inode = I_BDEV(psblk_file->f_mapping->host)->bd_inode;
-       dev->zone.total_size = i_size_read(inode);
+       inode = psblk_file->f_mapping->host;
+       dev->zone.total_size = bdev_nr_sectors(I_BDEV(inode)) << SECTOR_SHIFT;
 
        ret = __register_pstore_device(dev);
        if (ret)