From patchwork Mon Oct 16 23:29:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10010205 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 E162D604D7 for ; Mon, 16 Oct 2017 23:30:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D477828717 for ; Mon, 16 Oct 2017 23:30:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C8BBB2871C; Mon, 16 Oct 2017 23:30:17 +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=unavailable 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 7ACE228717 for ; Mon, 16 Oct 2017 23:30:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932850AbdJPXaP (ORCPT ); Mon, 16 Oct 2017 19:30:15 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:46353 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932600AbdJPX3Y (ORCPT ); Mon, 16 Oct 2017 19:29:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1508196565; x=1539732565; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=0ImTkIiA9vhax970kUw5S0ohImw5FPmNagwdIcmsEZU=; b=PMlww2A25BCReaDL1eRZVOeESxpvB4CziaxlzeJzR4/eIVSQwaTWm7La e5YKKz0XlPnfp0IKf+CLL13NaT8R2p/OmTIa0ieFTdv42FbATYmeNzrbP 3CE25d/HN4709aUj/ijcavAPmN1+RNUjOyrNwjanBVx6A2JAVBFfE3QUk a6+gmOXrt5jUbcJoO4Qx9xuPdSw/hsqfnIFtAH2xUb6PnkYTiCruyKXjx PXOnAWPQvK4ZnwFPdo9v2nCgpVnAyuKnlJg29wM+sq3MnpjJSztxeuybm MmcLEFndL8KCOtf+ablv2ts898fe8bAHSeyBm0FwtOz7vUnJ+eKa+60Bp A==; X-IronPort-AV: E=Sophos;i="5.43,388,1503331200"; d="scan'208";a="58270483" Received: from sjappemgw12.hgst.com (HELO sjappemgw11.hgst.com) ([199.255.44.66]) by ob1.hgst.iphmx.com with ESMTP; 17 Oct 2017 07:29:23 +0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.172.152]) by sjappemgw11.hgst.com with ESMTP; 16 Oct 2017 16:29:06 -0700 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, Christoph Hellwig , "Martin K . Petersen" , Oleksandr Natalenko , Ming Lei , Bart Van Assche , Hannes Reinecke , Johannes Thumshirn Subject: [PATCH v9 06/10] block: Introduce BLK_MQ_REQ_PREEMPT Date: Mon, 16 Oct 2017 16:29:01 -0700 Message-Id: <20171016232905.5047-7-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171016232905.5047-1-bart.vanassche@wdc.com> References: <20171016232905.5047-1-bart.vanassche@wdc.com> 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 Set RQF_PREEMPT if BLK_MQ_REQ_PREEMPT is passed to blk_get_request_flags(). Signed-off-by: Bart Van Assche Tested-by: Martin Steigerwald Cc: Christoph Hellwig Cc: Ming Lei Cc: Hannes Reinecke Cc: Johannes Thumshirn Reviewed-by: Hannes Reinecke --- block/blk-core.c | 4 +++- block/blk-mq.c | 2 ++ include/linux/blk-mq.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/block/blk-core.c b/block/blk-core.c index 559818be8e02..ab835d3c2f39 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1260,6 +1260,8 @@ static struct request *__get_request(struct request_list *rl, unsigned int op, blk_rq_set_rl(rq, rl); rq->cmd_flags = op; rq->rq_flags = rq_flags; + if (flags & BLK_MQ_REQ_PREEMPT) + rq->rq_flags |= RQF_PREEMPT; /* init elvpriv */ if (rq_flags & RQF_ELVPRIV) { @@ -1441,7 +1443,7 @@ struct request *blk_get_request_flags(struct request_queue *q, unsigned int op, struct request *req; WARN_ON_ONCE(op & REQ_NOWAIT); - WARN_ON_ONCE(flags & ~BLK_MQ_REQ_NOWAIT); + WARN_ON_ONCE(flags & ~(BLK_MQ_REQ_NOWAIT | BLK_MQ_REQ_PREEMPT)); if (q->mq_ops) { req = blk_mq_alloc_request(q, op, flags); diff --git a/block/blk-mq.c b/block/blk-mq.c index 59b7de6b616b..6a025b17caac 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -290,6 +290,8 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data, rq->q = data->q; rq->mq_ctx = data->ctx; rq->cmd_flags = op; + if (data->flags & BLK_MQ_REQ_PREEMPT) + rq->rq_flags |= RQF_PREEMPT; if (blk_queue_io_stat(data->q)) rq->rq_flags |= RQF_IO_STAT; /* do not touch atomic flags, it needs atomic ops against the timer */ diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index e5e6becd57d3..22c7f36745fc 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -213,6 +213,7 @@ enum { BLK_MQ_REQ_NOWAIT = (1 << 0), /* return when out of requests */ BLK_MQ_REQ_RESERVED = (1 << 1), /* allocate from reserved pool */ BLK_MQ_REQ_INTERNAL = (1 << 2), /* allocate internal/sched tag */ + BLK_MQ_REQ_PREEMPT = (1 << 3), /* set RQF_PREEMPT */ }; struct request *blk_mq_alloc_request(struct request_queue *q, unsigned int op,