Skip to content

Commit 4646198

Browse files
Christoph Hellwigaxboe
authored andcommitted
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 <[email protected]> Acked-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent d54f13a commit 4646198

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

fs/pstore/blk.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ static ssize_t psblk_generic_blk_write(const char *buf, size_t bytes,
205205
static int __register_pstore_blk(struct pstore_device_info *dev,
206206
const char *devpath)
207207
{
208-
struct inode *inode;
209208
int ret = -ENODEV;
210209

211210
lockdep_assert_held(&pstore_blk_lock);
@@ -217,14 +216,13 @@ static int __register_pstore_blk(struct pstore_device_info *dev,
217216
goto err;
218217
}
219218

220-
inode = file_inode(psblk_file);
221-
if (!S_ISBLK(inode->i_mode)) {
219+
if (!S_ISBLK(file_inode(psblk_file)->i_mode)) {
222220
pr_err("'%s' is not block device!\n", devpath);
223221
goto err_fput;
224222
}
225223

226-
inode = I_BDEV(psblk_file->f_mapping->host)->bd_inode;
227-
dev->zone.total_size = i_size_read(inode);
224+
dev->zone.total_size =
225+
bdev_nr_bytes(I_BDEV(psblk_file->f_mapping->host));
228226

229227
ret = __register_pstore_device(dev);
230228
if (ret)

0 commit comments

Comments
 (0)