Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761967AbcJ1Wwm (ORCPT ); Fri, 28 Oct 2016 18:52:42 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:46830 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753245AbcJ1Wwj (ORCPT ); Fri, 28 Oct 2016 18:52:39 -0400 From: Shaohua Li To: , CC: , Subject: [PATCH 2/2] blk-mq: immediately dispatch big size request Date: Fri, 28 Oct 2016 15:52:36 -0700 Message-ID: <8896812b5cb9bd32e35e91d7f9aad4ccc368b2fc.1477694963.git.shli@fb.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: References: X-FB-Internal: Safe MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-10-28_12:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 958 Lines: 34 This is corresponding part for blk-mq. Disk with multiple hardware queues doesn't need this as we only hold 1 request at most. Signed-off-by: Shaohua Li --- block/blk-mq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index f3d27a6..9612306 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1401,13 +1401,18 @@ static blk_qc_t blk_sq_make_request(struct request_queue *q, struct bio *bio) */ plug = current->plug; if (plug) { + struct request *first = NULL; + blk_mq_bio_to_request(rq, bio); if (!request_count) trace_block_plug(q); + else + first = list_entry_rq(plug->mq_list.next); blk_mq_put_ctx(data.ctx); - if (request_count >= BLK_MAX_REQUEST_COUNT) { + if (request_count >= BLK_MAX_REQUEST_COUNT || (first && + blk_rq_bytes(first) >= BLK_PLUG_FLUSH_SIZE)) { blk_flush_plug_list(plug, false); trace_block_plug(q); } -- 2.9.3