From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8BE6C43461 for ; Fri, 11 Sep 2020 02:42:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8290B2076D for ; Fri, 11 Sep 2020 02:42:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="h+62xvkF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725550AbgIKCmG (ORCPT ); Thu, 10 Sep 2020 22:42:06 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:24968 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725300AbgIKCmE (ORCPT ); Thu, 10 Sep 2020 22:42:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599792123; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xbG1GA7EmxIM6OFuKoLm0uEGcjT5hmviO9SzGOkDFtQ=; b=h+62xvkFTaD2dMvDbt9cVXKRXH/NFVHQqaIP6TZX9DTE33oNmfgFi/bzk3vaOWWNpOz6u3 R8oNiUh6yOl43C7utB0YiwNBZWVpybbRIOlEGuyOIJUrlrioLtia5YtYgn3hR4W5cz1pCl WtSHO+QJKVmda1wm8uPT6Z426Hb8cWs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-22-OIQcsDiQMkK0Na6gG4eMnA-1; Thu, 10 Sep 2020 22:41:59 -0400 X-MC-Unique: OIQcsDiQMkK0Na6gG4eMnA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CDE072FD02; Fri, 11 Sep 2020 02:41:57 +0000 (UTC) Received: from localhost (ovpn-13-69.pek2.redhat.com [10.72.13.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3667D7512A; Fri, 11 Sep 2020 02:41:53 +0000 (UTC) From: Ming Lei To: Jens Axboe , linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Christoph Hellwig , Keith Busch Cc: Sagi Grimberg , Hannes Reinecke , Bart Van Assche , Johannes Thumshirn , Chao Leng , Ming Lei Subject: [PATCH V5 4/4] nvme: use blk_mq_[un]quiesce_tagset Date: Fri, 11 Sep 2020 10:41:17 +0800 Message-Id: <20200911024117.62480-5-ming.lei@redhat.com> In-Reply-To: <20200911024117.62480-1-ming.lei@redhat.com> References: <20200911024117.62480-1-ming.lei@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Sagi Grimberg All controller namespaces share the same tagset, so we can use this interface which does the optimal operation for parallel quiesce based on the tagset type (e.g. blocking tagsets and non-blocking tagsets). Reviewed-by: Hannes Reinecke Cc: Sagi Grimberg Cc: Bart Van Assche Cc: Johannes Thumshirn Cc: Chao Leng Add code to unquiesce ctrl->connect_q in nvme_stop_queues(), meantime avoid to call blk_mq_quiesce_tagset()/blk_mq_unquiesce_tagset() if this tagset isn't initialized. Signed-off-by: Ming Lei Signed-off-by: Sagi Grimberg --- drivers/nvme/host/core.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index ea1fa41fbba8..a6af8978a3ba 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -4623,23 +4623,22 @@ EXPORT_SYMBOL_GPL(nvme_start_freeze); void nvme_stop_queues(struct nvme_ctrl *ctrl) { - struct nvme_ns *ns; + if (list_empty_careful(&ctrl->namespaces)) + return; - down_read(&ctrl->namespaces_rwsem); - list_for_each_entry(ns, &ctrl->namespaces, list) - blk_mq_quiesce_queue(ns->queue); - up_read(&ctrl->namespaces_rwsem); + blk_mq_quiesce_tagset(ctrl->tagset); + + if (ctrl->connect_q) + blk_mq_unquiesce_queue(ctrl->connect_q); } EXPORT_SYMBOL_GPL(nvme_stop_queues); void nvme_start_queues(struct nvme_ctrl *ctrl) { - struct nvme_ns *ns; + if (list_empty_careful(&ctrl->namespaces)) + return; - down_read(&ctrl->namespaces_rwsem); - list_for_each_entry(ns, &ctrl->namespaces, list) - blk_mq_unquiesce_queue(ns->queue); - up_read(&ctrl->namespaces_rwsem); + blk_mq_unquiesce_tagset(ctrl->tagset); } EXPORT_SYMBOL_GPL(nvme_start_queues); -- 2.25.2