]> www.infradead.org Git - users/hch/block.git/commitdiff
nvme-multipath: enable polled I/O bio-poll
authorChristoph Hellwig <hch@lst.de>
Wed, 28 Jul 2021 14:51:25 +0000 (16:51 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 12 Oct 2021 10:41:57 +0000 (12:41 +0200)
Set the poll queue flag to enable polling, given that the multipath
node just dispatches the bios to a lower queue.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Mark Wunderlich <mark.wunderlich@intel.com>
drivers/nvme/host/multipath.c

index 4a3252651f69e68be14903fc7a727ce40201806c..d5d7bbb1bc6ab8643db7cbef371fe8dd81a58282 100644 (file)
@@ -85,8 +85,13 @@ void nvme_failover_req(struct request *req)
        }
 
        spin_lock_irqsave(&ns->head->requeue_lock, flags);
-       for (bio = req->bio; bio; bio = bio->bi_next)
+       for (bio = req->bio; bio; bio = bio->bi_next) {
                bio_set_dev(bio, ns->head->disk->part0);
+               if (bio->bi_opf & REQ_POLLED) {
+                       bio->bi_opf &= ~REQ_POLLED;
+                       bio->bi_cookie = BLK_QC_T_NONE;
+               }
+       }
        blk_steal_bios(&ns->head->requeue_list, req);
        spin_unlock_irqrestore(&ns->head->requeue_lock, flags);
 
@@ -479,6 +484,15 @@ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struct nvme_ns_head *head)
 
        blk_queue_flag_set(QUEUE_FLAG_NONROT, head->disk->queue);
        blk_queue_flag_set(QUEUE_FLAG_NOWAIT, head->disk->queue);
+       /*
+        * This assumes all controllers that refer to a namespace either
+        * support poll queues or not.  That is not a strict guarantee,
+        * but if the assumption is wrong the effect is only suboptimal
+        * performance but not correctness problem.
+        */
+       if (ctrl->tagset->nr_maps > HCTX_TYPE_POLL &&
+           ctrl->tagset->map[HCTX_TYPE_POLL].nr_queues)
+               blk_queue_flag_set(QUEUE_FLAG_POLL, head->disk->queue);
 
        /* set to a default value of 512 until the disk is validated */
        blk_queue_logical_block_size(head->disk->queue, 512);