Commit 64d656a1 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: add back plugging in __blkdev_direct_IO

This allows sending larger than 1 MB requests to devices that support
large I/O sizes.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reported-by: default avatarLaurence Oberman <loberman@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 50f6584e
...@@ -328,6 +328,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) ...@@ -328,6 +328,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
struct file *file = iocb->ki_filp; struct file *file = iocb->ki_filp;
struct inode *inode = bdev_file_inode(file); struct inode *inode = bdev_file_inode(file);
struct block_device *bdev = I_BDEV(inode); struct block_device *bdev = I_BDEV(inode);
struct blk_plug plug;
struct blkdev_dio *dio; struct blkdev_dio *dio;
struct bio *bio; struct bio *bio;
bool is_read = (iov_iter_rw(iter) == READ); bool is_read = (iov_iter_rw(iter) == READ);
...@@ -353,6 +354,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) ...@@ -353,6 +354,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
dio->multi_bio = false; dio->multi_bio = false;
dio->should_dirty = is_read && (iter->type == ITER_IOVEC); dio->should_dirty = is_read && (iter->type == ITER_IOVEC);
blk_start_plug(&plug);
for (;;) { for (;;) {
bio->bi_bdev = bdev; bio->bi_bdev = bdev;
bio->bi_iter.bi_sector = pos >> 9; bio->bi_iter.bi_sector = pos >> 9;
...@@ -394,6 +396,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) ...@@ -394,6 +396,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
submit_bio(bio); submit_bio(bio);
bio = bio_alloc(GFP_KERNEL, nr_pages); bio = bio_alloc(GFP_KERNEL, nr_pages);
} }
blk_finish_plug(&plug);
if (!dio->is_sync) if (!dio->is_sync)
return -EIOCBQUEUED; return -EIOCBQUEUED;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment