]> www.infradead.org Git - users/hch/block.git/commitdiff
fs: use bdev_nr_bytes instead of open coding it in blkdev_max_block
authorChristoph Hellwig <hch@lst.de>
Mon, 11 Oct 2021 11:36:06 +0000 (13:36 +0200)
committerChristoph Hellwig <hch@lst.de>
Mon, 18 Oct 2021 04:53:44 +0000 (06:53 +0200)
Use the proper helper to read the block device size.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
fs/buffer.c

index c615387aedcae8bd9e94fbc3faef44a2bbb2496b..156358977249f6aaf260df393cfe2a823985eb19 100644 (file)
@@ -878,7 +878,7 @@ link_dev_buffers(struct page *page, struct buffer_head *head)
 static sector_t blkdev_max_block(struct block_device *bdev, unsigned int size)
 {
        sector_t retval = ~((sector_t)0);
-       loff_t sz = i_size_read(bdev->bd_inode);
+       loff_t sz = bdev_nr_bytes(bdev);
 
        if (sz) {
                unsigned int sizebits = blksize_bits(size);