Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp859561ybh; Tue, 10 Mar 2020 09:34:11 -0700 (PDT) X-Google-Smtp-Source: ADFU+vu5suA6X4eCOUsZbfRnsZnYZ2GJ4zofSbbXoY9ESe9SBskADvJWTsVZnEVT7OsO74fbBvUF X-Received: by 2002:a05:6830:57b:: with SMTP id f27mr11749685otc.363.1583858051519; Tue, 10 Mar 2020 09:34:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583858051; cv=none; d=google.com; s=arc-20160816; b=ADPMPLfxBHbhqYpLpUMfPse3cDwM20k3+THJHUJ3JEn+OsdI0Kc3RCR0NrSQwQA7Ao xpcZpqR48oPlUC5eUKCqXx45RmuUw4qHof+XC+X0sYXknkE4GJpCl+LXd0x8INj4OR5E 9LM5DezlCwdLsyehv4spWUsKZeESkNvfWL2hZltW/d3iVe3QytbfnUW6wOndRaKIiiFu SgQB1/JfD/jSVLJkc/5ibvCIMUO03YuNx62GYxmf3QtCidN43qrtj5+TBQDhwy09MtQ3 0rZRE9OZDpvwzxh/h2YP5FmNcePtotxbO3RHNTJxBQFZhZDVOPTwS05oXzmwfROPe71m bHlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=oqq6anJ4iBekNRyGxHGh3NLMNM4ExutznLCeva5HlXQ=; b=LRhk5Ft7vHu1jp6Li3MO57X4VJCwWvYBy6zKqDurjQjCM+2r9jbxiQjCt82UFv6Usp G0pHWMv6ubPOya+xImkV8vp39npz3y5lfqA4ab563HL8bXItjzyhCyxK21gAJ9gWEsjV 6YJiCwf1CFvGolk8TPIDaHslJW4ADG75mh0CVwcD5a4dMHYlgvoRCPNQmygoOlO9ddQy m5I8pjxyPFsuqYxWJV+/6GDs/lTBQ9Midb815apIx4WZrpIALtKNr9LxzOGqzBOf2YYq AvxXWVBojjHvUkiTlE5ZAF8cGVQOTc4vLEXfGpP5J6MGQ+TbzwLw1gqBTpqo95ZHZkK+ DcPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x14si3322340oto.47.2020.03.10.09.33.59; Tue, 10 Mar 2020 09:34:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727614AbgCJQbu (ORCPT + 99 others); Tue, 10 Mar 2020 12:31:50 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:35780 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727097AbgCJQap (ORCPT ); Tue, 10 Mar 2020 12:30:45 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 079F44E3E4A0CD650864; Wed, 11 Mar 2020 00:30:34 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Wed, 11 Mar 2020 00:30:24 +0800 From: John Garry To: , , , , , , CC: , , , , , , Hannes Reinecke Subject: [PATCH RFC v2 02/24] scsi: allocate separate queue for reserved commands Date: Wed, 11 Mar 2020 00:25:28 +0800 Message-ID: <1583857550-12049-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1583857550-12049-1-git-send-email-john.garry@huawei.com> References: <1583857550-12049-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hannes Reinecke Allocate a separate 'reserved_cmd_q' for sending reserved commands. Signed-off-by: Hannes Reinecke --- drivers/scsi/scsi_lib.c | 17 ++++++++++++++++- include/scsi/scsi_host.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 2967325df7a0..e809b0e30a11 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1881,6 +1881,7 @@ struct request_queue *scsi_mq_alloc_queue(struct scsi_device *sdev) int scsi_mq_setup_tags(struct Scsi_Host *shost) { unsigned int cmd_size, sgl_size; + int ret; sgl_size = max_t(unsigned int, sizeof(struct scatterlist), scsi_mq_inline_sgl_size(shost)); @@ -1904,11 +1905,25 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost) BLK_ALLOC_POLICY_TO_MQ_FLAG(shost->hostt->tag_alloc_policy); shost->tag_set.driver_data = shost; - return blk_mq_alloc_tag_set(&shost->tag_set); + ret = blk_mq_alloc_tag_set(&shost->tag_set); + if (ret) + return ret; + + if (shost->nr_reserved_cmds) { + shost->reserved_cmd_q = blk_mq_init_queue(&shost->tag_set); + if (IS_ERR(shost->reserved_cmd_q)) { + blk_mq_free_tag_set(&shost->tag_set); + ret = PTR_ERR(shost->reserved_cmd_q); + shost->reserved_cmd_q = NULL; + } + } + return ret; } void scsi_mq_destroy_tags(struct Scsi_Host *shost) { + if (shost->reserved_cmd_q) + blk_cleanup_queue(shost->reserved_cmd_q); blk_mq_free_tag_set(&shost->tag_set); } diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 3f860c8ad623..2258a4f7b4d8 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -604,6 +604,7 @@ struct Scsi_Host { * Number of reserved commands, if any. */ unsigned nr_reserved_cmds; + struct request_queue *reserved_cmd_q; unsigned active_mode:2; unsigned unchecked_isa_dma:1; -- 2.17.1