From patchwork Fri Oct 28 22:52:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shaohua Li X-Patchwork-Id: 9402801 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D5CB26022E for ; Fri, 28 Oct 2016 22:52:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C51C82A8D5 for ; Fri, 28 Oct 2016 22:52:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B9B8F2A8D8; Fri, 28 Oct 2016 22:52:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3826E2A8D5 for ; Fri, 28 Oct 2016 22:52:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756867AbcJ1Wwk (ORCPT ); Fri, 28 Oct 2016 18:52:40 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:46831 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756744AbcJ1Wwj (ORCPT ); Fri, 28 Oct 2016 18:52:39 -0400 Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9SMnhd3005336 for ; Fri, 28 Oct 2016 15:52:38 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=+7H6kAKFIge/hmW7ejWxOpn3CK7cdd8e12jAA/VwTkg=; b=ee0s4h7w0jwDFVwvjC1caqlw3LUe2UBntShXkdgHXSfgw7xvFdwnXygoKqYefcz6hxs6 ZssXh5weD7hl7U4xsyWvq/YHPZPRI8tqbbO63ubQyKyv59HIztg0poHRQrcz2ku0Om7H Afjbpg5A2xFNSAdFN86qjkSlCQ8Q4VD9Lfo= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 26cbr42ba1-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Fri, 28 Oct 2016 15:52:38 -0700 Received: from mx-out.facebook.com (192.168.52.123) by PRN-CHUB02.TheFacebook.com (192.168.16.12) with Microsoft SMTP Server (TLS) id 14.3.294.0; Fri, 28 Oct 2016 15:52:38 -0700 Received: from facebook.com (2401:db00:21:603d:face:0:19:0) by mx-out.facebook.com (10.212.236.87) with ESMTP id 38fbbc789d6111e6b97e0002c9521c9e-f0ff6a50 for ; Fri, 28 Oct 2016 15:52:37 -0700 Received: by devbig638.prn2.facebook.com (Postfix, from userid 11222) id F3E0E42C5931; Fri, 28 Oct 2016 15:52:36 -0700 (PDT) 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 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-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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); }