Skip to content

Commit

Permalink
nfs/blocklayout: use bdev_nr_bytes instead of open coding it
Browse files Browse the repository at this point in the history
Use the proper helper to read the block device size.

Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and axboe committed Oct 18, 2021
1 parent 74e157e commit 6e50e78
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/nfs/blocklayout/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 6e50e78

Please sign in to comment.