block: use new bdev_nr_bytes() helper for blkdev_{read,write}_iter()
Jens Axboe
maintainerPATCH 1/1 block: use new bdev_nr_bytes() helper for blkdev_{read,write}_iter()
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]>
---
block/fops.c +2 -2
@@ -527,7 +527,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;
@@ -565,7 +565,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;
Signature · 1 line
Jens Axboe
Quoted 5 lines · Jens Axboe
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]>
Looks good,
Reviewed-by Christoph Hellwig <[email protected]>