summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-10-18 12:11:18 +0200
committerJens Axboe <axboe@kernel.dk>2021-10-18 14:43:23 -0600
commit6e50e781fe8873610f2e4011848f8b8d7406ee96 (patch)
treeaf39eb75efce25c8321d2cdd44c17d12c430102b
parent74e157e6a499ef47edc39cff8c37f77d01c0d155 (diff)
nfs/blocklayout: use bdev_nr_bytes instead of open coding it
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> Link: https://lore.kernel.org/r/20211018101130.1838532-19-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--fs/nfs/blocklayout/dev.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/nfs/blocklayout/dev.c b/fs/nfs/blocklayout/dev.c
index acb1d22907da..5e56da748b2a 100644
--- a/fs/nfs/blocklayout/dev.c
+++ b/fs/nfs/blocklayout/dev.c
@@ -252,7 +252,7 @@ bl_parse_simple(struct nfs_server *server, struct pnfs_block_dev *d,
d->bdev = bdev;
- d->len = i_size_read(d->bdev->bd_inode);
+ d->len = bdev_nr_bytes(d->bdev);
d->map = bl_map_simple;
printk(KERN_INFO "pNFS: using block device %s\n",
@@ -367,7 +367,7 @@ bl_parse_scsi(struct nfs_server *server, struct pnfs_block_dev *d,
return PTR_ERR(bdev);
d->bdev = bdev;
- d->len = i_size_read(d->bdev->bd_inode);
+ d->len = bdev_nr_bytes(d->bdev);
d->map = bl_map_simple;
d->pr_key = v->scsi.pr_key;