Those will go straight to issue inside blk-mq, so don't bother setting up a block plug for them.
Unified · Split
| @@ -330,6 +330,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) · 329 unmodified lines | ||
| 330 | 330 | struct blk_plug plug; |
| 331 | 331 | struct blkdev_dio *dio; |
| 332 | 332 | struct bio *bio; |
| 333 | + bool is_poll = (iocb->ki_flags & IOCB_HIPRI) != 0; | |
| 333 | 334 | bool is_read = (iov_iter_rw(iter) == READ), is_sync; |
| 334 | 335 | loff_t pos = iocb->ki_pos; |
| 335 | 336 | blk_qc_t qc = BLK_QC_T_NONE; |
| @@ -353,7 +354,13 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) · 17 unmodified lines | ||
| 353 | 354 | dio->multi_bio = false; |
| 354 | 355 | dio->should_dirty = is_read && iter_is_iovec(iter); |
| 355 | 356 | |
| 356 | − blk_start_plug(&plug); | |
| 357 | + /* | |
| 358 | + * Don't plug for HIPRI/polled IO, as those should go straight | |
| 359 | + * to issue | |
| 360 | + */ | |
| 361 | + if (!is_poll) | |
| 362 | + blk_start_plug(&plug); | |
| 363 | + | |
| 357 | 364 | for (;;) { |
| 358 | 365 | bio_set_dev(bio, bdev); |
| 359 | 366 | bio->bi_iter.bi_sector = pos >> 9; |
| @@ -400,7 +407,9 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) · 40 unmodified lines | ||
| 400 | 407 | submit_bio(bio); |
| 401 | 408 | bio = bio_alloc(GFP_KERNEL, nr_pages); |
| 402 | 409 | } |
| 403 | − blk_finish_plug(&plug); | |
| 410 | + | |
| 411 | + if (!is_poll) | |
| 412 | + blk_finish_plug(&plug); | |
| 404 | 413 | |
| 405 | 414 | if (!is_sync) |
| 406 | 415 | return -EIOCBQUEUED; |