Commit c68f3ef7 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

nvmet: use bdev_nr_bytes instead of open coding it

Use the proper helper to read the block device size.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
Link: https://lore.kernel.org/r/20211018101130.1838532-8-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 0fe80347
...@@ -87,7 +87,7 @@ int nvmet_bdev_ns_enable(struct nvmet_ns *ns) ...@@ -87,7 +87,7 @@ int nvmet_bdev_ns_enable(struct nvmet_ns *ns)
ns->bdev = NULL; ns->bdev = NULL;
return ret; return ret;
} }
ns->size = i_size_read(ns->bdev->bd_inode); ns->size = bdev_nr_bytes(ns->bdev);
ns->blksize_shift = blksize_bits(bdev_logical_block_size(ns->bdev)); ns->blksize_shift = blksize_bits(bdev_logical_block_size(ns->bdev));
ns->pi_type = 0; ns->pi_type = 0;
...@@ -108,7 +108,7 @@ int nvmet_bdev_ns_enable(struct nvmet_ns *ns) ...@@ -108,7 +108,7 @@ int nvmet_bdev_ns_enable(struct nvmet_ns *ns)
void nvmet_bdev_ns_revalidate(struct nvmet_ns *ns) void nvmet_bdev_ns_revalidate(struct nvmet_ns *ns)
{ {
ns->size = i_size_read(ns->bdev->bd_inode); ns->size = bdev_nr_bytes(ns->bdev);
} }
u16 blk_to_nvme_status(struct nvmet_req *req, blk_status_t blk_sts) u16 blk_to_nvme_status(struct nvmet_req *req, blk_status_t blk_sts)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment