Thread (42 messages) 42 messages, 5 authors, 2018-11-29

Re: [PATCH 8/8] blk-mq: add plug case for devices that implement ->commits_rqs()

From: Jens Axboe <axboe@kernel.dk>
Date: 2018-11-28 13:11:37
Also in: linux-nvme

On 11/28/18 12:26 AM, Christoph Hellwig wrote:
quoted
+	} else if (plug && q->mq_ops->commit_rqs) {
+		/*
+		 * If we have a ->commit_rqs(), then we know the driver can
+		 * batch submission doorbell updates. Add rq to plug list,
+		 * and flush if we exceed the plug count only.
+		 */
+		blk_mq_bio_to_request(rq, bio);
+		blk_mq_put_ctx(data.ctx);
+
+		/*
+		 * If we have requests for more than one queue here, we
+		 * should sort the list when it's flushed.
+		 */
+		if (!plug->do_sort && !list_empty(&plug->mq_list)) {
+			same_queue_rq = list_first_entry(&plug->mq_list,
+						struct request, queuelist);
+			if (same_queue_rq->q != q)
+				plug->do_sort = true;
+		}
+
+		list_add_tail(&rq->queuelist, &plug->mq_list);
+		plug->rq_count++;
+		if (plug->rq_count >= BLK_MAX_REQUEST_COUNT) {
+			blk_flush_plug_list(plug, false);
+			trace_block_plug(q);
+		}
This seems like a slight variation of the the single queue plug
case.  Can we share the code instead of having slightly differing
logic?
I'll see if I can fold them.
Also that should this respect blk_queue_nomerges?
It doesn't do any merging at all, it's just batching for the list
inserts. In terms of plug merging, if nomerges isn't true, then we would
have done that further up.

-- 
Jens Axboe
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help