Thread (76 messages) 76 messages, 15 authors, 2021-10-14
STALE1719d

[PATCH 08/29] fs: use bdev_nr_sectors instead of open coding it in blkdev_max_block

From: Christoph Hellwig <hch@lst.de>
Date: 2021-10-13 05:23:18
Also in: dm-devel, linux-bcache, linux-block, linux-btrfs, linux-ext4, linux-fsdevel, linux-nfs, linux-nvme, linux-scsi, ntfs3, target-devel
Subsystem: filesystems (vfs and infrastructure), the rest · Maintainers: Alexander Viro, Christian Brauner, Linus Torvalds

Use the proper helper to read the block device size.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index c615387aedcae..3fb9c5b457ab6 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -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_sectors(bdev) << SECTOR_SHIFT;
 
 	if (sz) {
 		unsigned int sizebits = blksize_bits(size);
-- 
2.30.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help