From patchwork Mon Oct 9 23:13:57 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: 9994609 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 5861260223 for ; Mon, 9 Oct 2017 23:14:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4306B1FF1D for ; Mon, 9 Oct 2017 23:14:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3779020007; Mon, 9 Oct 2017 23:14:29 +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 D35B61FF1D for ; Mon, 9 Oct 2017 23:14:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755747AbdJIXO1 (ORCPT ); Mon, 9 Oct 2017 19:14:27 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:4992 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755622AbdJIXOI (ORCPT ); Mon, 9 Oct 2017 19:14:08 -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=1507590848; x=1539126848; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=I61zOVi5T6vhbuoWy+yQU5pCZIEfKzBNjfY0Df3c8zw=; b=LAv332k40q0nHfOwYcJl+A60iJFMa7iSTQiH3nep1Mllw3tfEWH2nIVR /yTLqD6uR5hmSZj7f2LoM8yEd0xxh74f3sffz0UF/PQ+ZCFuQQVvhq2/n exunvd2oU4J5Yqxyp7UW+k/vaYZmgMHOxbkEwlj2sERRHaGGpbuWa3wWS 0xRuuc40IjjcyZAJjLxj3EVRPeq4r4dhYNY7vPniVBAfqfElY7Dkt/xrn Zvb7AMtbU6bM1Tw0g+5P0ayb29YnWc3Hw0yrDU4JzphLoTGYGwkTSxH01 AGpq0soaUUg1xc1qOueL+PmnTfduGEDIxysxOq4a+FxF9DolNsfnAhnDN w==; X-IronPort-AV: E=Sophos;i="5.42,501,1500912000"; d="scan'208";a="159653531" Received: from sjappemgw11.hgst.com (HELO sjappemgw12.hgst.com) ([199.255.44.62]) by ob1.hgst.iphmx.com with ESMTP; 10 Oct 2017 07:14:06 +0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.172.152]) by sjappemgw12.hgst.com with ESMTP; 09 Oct 2017 16:14:02 -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 , "Luis R . Rodriguez" , Ming Lei , Bart Van Assche , Hannes Reinecke , Johannes Thumshirn Subject: [PATCH v7 6/9] block: Introduce BLK_MQ_REQ_PREEMPT Date: Mon, 9 Oct 2017 16:13:57 -0700 Message-Id: <20171009231400.562-7-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171009231400.562-1-bart.vanassche@wdc.com> References: <20171009231400.562-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 Cc: Christoph Hellwig Cc: Ming Lei Cc: Hannes Reinecke Cc: Johannes Thumshirn --- 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 03156d9ede94..842e67e0b7ab 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 8766587ae8b8..bdbfe760bda0 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 50c6485cb04f..ee9fc3fb7fca 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -200,6 +200,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,