summaryrefslogtreecommitdiffstats
path: root/fs/pstore
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-10-18 12:11:21 +0200
committerJens Axboe <axboe@kernel.dk>2021-10-18 22:43:23 +0200
commit4646198519c9aaa1c307ec4750ac64e08507d936 (patch)
tree68a8a3f5945ea3b80c8e98dbd9c5f732525d2276 /fs/pstore
parentntfs3: use bdev_nr_bytes instead of open coding it (diff)
downloadlinux-4646198519c9aaa1c307ec4750ac64e08507d936.tar.xz
linux-4646198519c9aaa1c307ec4750ac64e08507d936.zip
pstore/blk: 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> Acked-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20211018101130.1838532-22-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/pstore')
-rw-r--r--fs/pstore/blk.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/pstore/blk.c b/fs/pstore/blk.c
index 04ce58c939a0..5d1fbaffd66a 100644
--- a/fs/pstore/blk.c
+++ b/fs/pstore/blk.c
@@ -205,7 +205,6 @@ static ssize_t psblk_generic_blk_write(const char *buf, size_t bytes,
static int __register_pstore_blk(struct pstore_device_info *dev,
const char *devpath)
{
- struct inode *inode;
int ret = -ENODEV;
lockdep_assert_held(&pstore_blk_lock);
@@ -217,14 +216,13 @@ static int __register_pstore_blk(struct pstore_device_info *dev,
goto err;
}
- inode = file_inode(psblk_file);
- if (!S_ISBLK(inode->i_mode)) {
+ if (!S_ISBLK(file_inode(psblk_file)->i_mode)) {
pr_err("'%s' is not block device!\n", devpath);
goto err_fput;
}
- inode = I_BDEV(psblk_file->f_mapping->host)->bd_inode;
- dev->zone.total_size = i_size_read(inode);
+ dev->zone.total_size =
+ bdev_nr_bytes(I_BDEV(psblk_file->f_mapping->host));
ret = __register_pstore_device(dev);
if (ret)