Skip to content

Commit

Permalink
block: use new bdev_nr_bytes() helper for blkdev_{read,write}_iter()
Browse files Browse the repository at this point in the history
We have new helpers for this, use them rather than the slower inode
size reads. This makes the read/write path consistent with most of
the rest of block as well.

Signed-off-by: Jens Axboe <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
axboe committed Nov 5, 2021
1 parent 2116274 commit 138c1a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions block/fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ static ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
{
struct block_device *bdev = iocb->ki_filp->private_data;
struct inode *bd_inode = bdev->bd_inode;
loff_t size = i_size_read(bd_inode);
loff_t size = bdev_nr_bytes(bdev);
struct blk_plug plug;
size_t shorted = 0;
ssize_t ret;
Expand Down Expand Up @@ -498,7 +498,7 @@ static ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
static ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to)
{
struct block_device *bdev = iocb->ki_filp->private_data;
loff_t size = i_size_read(bdev->bd_inode);
loff_t size = bdev_nr_bytes(bdev);
loff_t pos = iocb->ki_pos;
size_t shorted = 0;
ssize_t ret;
Expand Down

0 comments on commit 138c1a3

Please sign in to comment.