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=-17.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 6CBF3C433DB for ; Wed, 3 Feb 2021 16:10:24 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C3BFB64E2E for ; Wed, 3 Feb 2021 16:10:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C3BFB64E2E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612368622; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=+f66qfNxXOpMZGXwGtxnx6zPxmJeWh7ZevqUuV5H0YY=; b=cFd82hYDpgjnvQYRODoWZzSthdLMn2/pjxk9Qr6hSzkD2CqoFERyYieritI4GsxlTkh+ak RZVyfHDJXg/lEoPA7giV/2XiuygriYoqzr6zZsIfLW8sANFIT1oOsXvIO9zfb90TL9pzQJ f4LUhwWhP2IBI5iGjkwv9l/THyAamnQ= 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-457-AXekGQ2cMV6e-lJZEGETnw-1; Wed, 03 Feb 2021 11:10:20 -0500 X-MC-Unique: AXekGQ2cMV6e-lJZEGETnw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BA532107ACF2; Wed, 3 Feb 2021 16:10:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 910355885D; Wed, 3 Feb 2021 16:10:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 309E618095CB; Wed, 3 Feb 2021 16:10:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 113GA3Cl011208 for ; Wed, 3 Feb 2021 11:10:03 -0500 Received: by smtp.corp.redhat.com (Postfix) id 067D41E6; Wed, 3 Feb 2021 16:10:03 +0000 (UTC) Received: from localhost (unknown [10.18.25.174]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7AF005FC3A; Wed, 3 Feb 2021 16:09:56 +0000 (UTC) Date: Wed, 3 Feb 2021 11:09:55 -0500 From: Mike Snitzer To: Sergei Shtepa Message-ID: <20210203160955.GA21359@redhat.com> References: <1612367638-3794-1-git-send-email-sergei.shtepa@veeam.com> <1612367638-3794-4-git-send-email-sergei.shtepa@veeam.com> MIME-Version: 1.0 In-Reply-To: <1612367638-3794-4-git-send-email-sergei.shtepa@veeam.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: dm-devel@redhat.com Cc: axboe@kernel.dk, Damien.LeMoal@wdc.com, jack@suse.cz, corbet@lwn.net, johannes.thumshirn@wdc.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, ming.lei@redhat.com, linux-block@vger.kernel.org, dm-devel@redhat.com, gregkh@linuxfoundation.org, steve@sk2.org, koct9i@gmail.com, agk@redhat.com, pavgel.tide@veeam.com Subject: Re: [dm-devel] [PATCH v4 3/6] block: add blk_mq_is_queue_frozen() X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Wed, Feb 03 2021 at 10:53am -0500, Sergei Shtepa wrote: > blk_mq_is_queue_frozen() allow to assert that the queue is frozen. > > Signed-off-by: Sergei Shtepa > --- > block/blk-mq.c | 13 +++++++++++++ > include/linux/blk-mq.h | 1 + > 2 files changed, 14 insertions(+) > > diff --git a/block/blk-mq.c b/block/blk-mq.c > index f285a9123a8b..924ec26fae5f 100644 > --- a/block/blk-mq.c > +++ b/block/blk-mq.c > @@ -161,6 +161,19 @@ int blk_mq_freeze_queue_wait_timeout(struct request_queue *q, > } > EXPORT_SYMBOL_GPL(blk_mq_freeze_queue_wait_timeout); > > + > +bool blk_mq_is_queue_frozen(struct request_queue *q) > +{ > + bool ret; > + > + mutex_lock(&q->mq_freeze_lock); > + ret = percpu_ref_is_dying(&q->q_usage_counter) && percpu_ref_is_zero(&q->q_usage_counter); > + mutex_unlock(&q->mq_freeze_lock); > + > + return ret; > +} > +EXPORT_SYMBOL_GPL(blk_mq_is_queue_frozen); > + > /* > * Guarantee no request is in use, so we can change any data structure of > * the queue afterward. > diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h > index d705b174d346..9d1e8c4e922e 100644 > --- a/include/linux/blk-mq.h > +++ b/include/linux/blk-mq.h > @@ -525,6 +525,7 @@ void blk_freeze_queue_start(struct request_queue *q); > void blk_mq_freeze_queue_wait(struct request_queue *q); > int blk_mq_freeze_queue_wait_timeout(struct request_queue *q, > unsigned long timeout); > +bool blk_mq_is_queue_frozen(struct request_queue *q); > > int blk_mq_map_queues(struct blk_mq_queue_map *qmap); > void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues); > -- > 2.20.1 > This needs to come before patch 2 (since patch 2 uses it). Mike -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel 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=-17.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 8EB88C433E0 for ; Wed, 3 Feb 2021 16:12:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4DC9A64FA4 for ; Wed, 3 Feb 2021 16:12:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234996AbhBCQLv (ORCPT ); Wed, 3 Feb 2021 11:11:51 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53662 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234974AbhBCQLd (ORCPT ); Wed, 3 Feb 2021 11:11:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612368607; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Md5deGFTlNwWnMdHSwnNKkej1rIsSFXY3oqRw/3YWT0=; b=X6gbIKBafEZd8jRT/mWB4eOU98QBFCFx54FN327P2WNz972oF3SSuwWM3xNB7Gg2MZd+gm d9x30K+C3Gk1jILIhLRpAPtb9XInCIWa+lcknirLejAFHVgOFdLd22pEmzWJuXh+Dm/A9j /dWqJUUk+uMpkxhi+F9eSA8MRDS/xf4= 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-401-Cw8jCwDsPEmEHOoAb7OFcw-1; Wed, 03 Feb 2021 11:10:05 -0500 X-MC-Unique: Cw8jCwDsPEmEHOoAb7OFcw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 07BEE6D4E0; Wed, 3 Feb 2021 16:10:03 +0000 (UTC) Received: from localhost (unknown [10.18.25.174]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7AF005FC3A; Wed, 3 Feb 2021 16:09:56 +0000 (UTC) Date: Wed, 3 Feb 2021 11:09:55 -0500 From: Mike Snitzer To: Sergei Shtepa Cc: Damien.LeMoal@wdc.com, hare@suse.de, ming.lei@redhat.com, agk@redhat.com, corbet@lwn.net, axboe@kernel.dk, jack@suse.cz, johannes.thumshirn@wdc.com, gregkh@linuxfoundation.org, koct9i@gmail.com, steve@sk2.org, dm-devel@redhat.com, linux-block@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, pavgel.tide@veeam.com Subject: Re: [PATCH v4 3/6] block: add blk_mq_is_queue_frozen() Message-ID: <20210203160955.GA21359@redhat.com> References: <1612367638-3794-1-git-send-email-sergei.shtepa@veeam.com> <1612367638-3794-4-git-send-email-sergei.shtepa@veeam.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1612367638-3794-4-git-send-email-sergei.shtepa@veeam.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On Wed, Feb 03 2021 at 10:53am -0500, Sergei Shtepa wrote: > blk_mq_is_queue_frozen() allow to assert that the queue is frozen. > > Signed-off-by: Sergei Shtepa > --- > block/blk-mq.c | 13 +++++++++++++ > include/linux/blk-mq.h | 1 + > 2 files changed, 14 insertions(+) > > diff --git a/block/blk-mq.c b/block/blk-mq.c > index f285a9123a8b..924ec26fae5f 100644 > --- a/block/blk-mq.c > +++ b/block/blk-mq.c > @@ -161,6 +161,19 @@ int blk_mq_freeze_queue_wait_timeout(struct request_queue *q, > } > EXPORT_SYMBOL_GPL(blk_mq_freeze_queue_wait_timeout); > > + > +bool blk_mq_is_queue_frozen(struct request_queue *q) > +{ > + bool ret; > + > + mutex_lock(&q->mq_freeze_lock); > + ret = percpu_ref_is_dying(&q->q_usage_counter) && percpu_ref_is_zero(&q->q_usage_counter); > + mutex_unlock(&q->mq_freeze_lock); > + > + return ret; > +} > +EXPORT_SYMBOL_GPL(blk_mq_is_queue_frozen); > + > /* > * Guarantee no request is in use, so we can change any data structure of > * the queue afterward. > diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h > index d705b174d346..9d1e8c4e922e 100644 > --- a/include/linux/blk-mq.h > +++ b/include/linux/blk-mq.h > @@ -525,6 +525,7 @@ void blk_freeze_queue_start(struct request_queue *q); > void blk_mq_freeze_queue_wait(struct request_queue *q); > int blk_mq_freeze_queue_wait_timeout(struct request_queue *q, > unsigned long timeout); > +bool blk_mq_is_queue_frozen(struct request_queue *q); > > int blk_mq_map_queues(struct blk_mq_queue_map *qmap); > void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues); > -- > 2.20.1 > This needs to come before patch 2 (since patch 2 uses it). Mike