From patchwork Fri Nov 4 00:03:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shaohua Li X-Patchwork-Id: 9411667 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 1958B601C2 for ; Fri, 4 Nov 2016 00:04:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B0F72AFCD for ; Fri, 4 Nov 2016 00:04:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3A382AFD4; Fri, 4 Nov 2016 00:04:02 +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 50FE52AFD4 for ; Fri, 4 Nov 2016 00:04:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759023AbcKDAD7 (ORCPT ); Thu, 3 Nov 2016 20:03:59 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:48036 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752892AbcKDAD6 (ORCPT ); Thu, 3 Nov 2016 20:03:58 -0400 Received: from pps.filterd (m0001255.ppops.net [127.0.0.1]) by mx0b-00082601.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uA401Jrx013077 for ; Thu, 3 Nov 2016 17:03:57 -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=FbuNeOwOG7XPe+x7XBLjR+QNIHh+c+6sO3ad93yVXPM=; b=V3rLurT1r6hZ3uaVoW2OFcXC5KoBkP+D3DJ+lQ0ZwP0jS0ctHRlUP8SgupWrwvC9RcOu L16RZSNpz8hlzqx49qUuIcDHaR+XJSBhWpQXkTkj14mpawLDMXZW7FxW4V+WkBphtB/j xvXWQz73rlVubDaf46J9m0fN0/BtZ04YRDQ= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0b-00082601.pphosted.com with ESMTP id 26g4uex57w-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 03 Nov 2016 17:03:57 -0700 Received: from mx-out.facebook.com (192.168.52.123) by PRN-CHUB05.TheFacebook.com (192.168.16.15) with Microsoft SMTP Server (TLS) id 14.3.294.0; Thu, 3 Nov 2016 17:03:55 -0700 Received: from facebook.com (2401:db00:21:603d:face:0:19:0) by mx-out.facebook.com (10.222.219.45) with ESMTP id 2d5d4f92a22211e6aa3d24be05904660-c1ff8a50 for ; Thu, 03 Nov 2016 17:03:55 -0700 Received: by devbig638.prn2.facebook.com (Postfix, from userid 11222) id 067C04254DA2; Thu, 3 Nov 2016 17:03:54 -0700 (PDT) From: Shaohua Li To: , CC: , Subject: [PATCH V2 2/2] blk-mq: immediately dispatch big size request Date: Thu, 3 Nov 2016 17:03:54 -0700 Message-ID: <6297c9a39cf21c94c65d5a9b3a19e54ba5b8b573.1478217671.git.shli@fb.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <05e8cb8c7e09903c7db36e81a6bbd0b39b24deff.1478217670.git.shli@fb.com> References: <05e8cb8c7e09903c7db36e81a6bbd0b39b24deff.1478217670.git.shli@fb.com> 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-11-03_06:, , 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..a72538a 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 *last = NULL; + blk_mq_bio_to_request(rq, bio); if (!request_count) trace_block_plug(q); + else + last = list_entry_rq(plug->mq_list.prev); blk_mq_put_ctx(data.ctx); - if (request_count >= BLK_MAX_REQUEST_COUNT) { + if (request_count >= BLK_MAX_REQUEST_COUNT || (last && + blk_rq_bytes(last) >= BLK_PLUG_FLUSH_SIZE)) { blk_flush_plug_list(plug, false); trace_block_plug(q); }