* [PATCH] block: use new bdev_nr_bytes() helper for blkdev_{read,write}_iter()
@ 2021-11-04 21:13 Jens Axboe
2021-11-05 5:41 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Jens Axboe @ 2021-11-04 21:13 UTC (permalink / raw)
To: linux-block
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 <axboe@kernel.dk>
---
diff --git a/block/fops.c b/block/fops.c
index a2f492e50782..d5de5451fb08 100644
--- a/block/fops.c
+++ b/block/fops.c
@@ -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;
--
Jens Axboe
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] block: use new bdev_nr_bytes() helper for blkdev_{read,write}_iter()
2021-11-04 21:13 [PATCH] block: use new bdev_nr_bytes() helper for blkdev_{read,write}_iter() Jens Axboe
@ 2021-11-05 5:41 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2021-11-05 5:41 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block
On Thu, Nov 04, 2021 at 03:13:17PM -0600, Jens Axboe wrote:
> 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 <axboe@kernel.dk>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-05 5:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-04 21:13 [PATCH] block: use new bdev_nr_bytes() helper for blkdev_{read,write}_iter() Jens Axboe
2021-11-05 5:41 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).