Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3064498rdb; Wed, 13 Sep 2023 00:17:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEyiIfB2Llpb211s4cQ1M5NjlrcDxZtFsn6YgH8fU7Ma1zk504J4TaapgD5TcsaLZygIaJm X-Received: by 2002:a05:6a20:1593:b0:133:5da8:2fa7 with SMTP id h19-20020a056a20159300b001335da82fa7mr6776388pzj.25.1694589474126; Wed, 13 Sep 2023 00:17:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694589474; cv=none; d=google.com; s=arc-20160816; b=G8fVCNivknko9zQG9DFX/fNN8StMzzJj0AEBEG80kbYYu2j7IvOy+6A0obD78ax/h4 0EBbsFSWHO0sBwWFgf+1t8THTiLbLVD5G4V27JoUuB+SS5at2C5/Gg9RPzmgf0Bn4D+7 eXT3+Au7ARG+4MDbavob7X2BAQOHLD4fb/ypJd3upFowS35+3rTDvMboFbiRT1IJ6CTi d/XeVQ92CV78xl8CBIXyiaEu2PCP+3BbJhGUjzhPfXXQRafCNovqm9Fo+G1RrfSNmJ0M BDUi52HkfhaVtSpCOY8jMBP4/nMoFaZ6r1u8yJEngRv4kAbc31oPeolLYpAGxuWKFaGB lhSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Wk0aXTAElE79+EX7YkShEQJOBh1Ww7m9AhWaKXcP+HU=; fh=0kSCNnJ+Dz7/k19JqdLGTHBnZxdhAtg5C+lF7soNwhs=; b=yD0+Iysi6R6is3kX/eLEKOunP6NpAkp02lYVghUX/uCe5fvbfEezHMYJMxPAgwF2TW xNhMp40Aj4TDvdOoQTBMxJVpjCZ/g2bCCu+W5lP+lBBdZz1/ixKW13Bjr1TKfdO/Zs4j NxUiMDZX7qdep7foybMENvKfSI//OPB6+05lQu6AuQYw4vBBDGI3i1Ye10AffCx9xezp oqnSl3e4drJJBeq2D/WrtWzD7iVVfelU8MWJ9BGCBEArgcYL/Nm5qjJVzpipL0Uj80iL e/PlFgxt1H+jqr7hymJ7nFcE5g9ru03naya+LZbBfMehOTpwXlLuePekyJXTiARbhvA8 9bLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=xAb+4CRX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id d20-20020a656214000000b00565e39e7b80si9060851pgv.678.2023.09.13.00.17.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 00:17:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=xAb+4CRX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id D0B2281B5AA9; Tue, 12 Sep 2023 20:51:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233304AbjIMDvL (ORCPT + 99 others); Tue, 12 Sep 2023 23:51:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232749AbjIMDvK (ORCPT ); Tue, 12 Sep 2023 23:51:10 -0400 Received: from out-220.mta0.migadu.com (out-220.mta0.migadu.com [IPv6:2001:41d0:1004:224b::dc]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 394E8172B for ; Tue, 12 Sep 2023 20:51:06 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1694577064; 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=Wk0aXTAElE79+EX7YkShEQJOBh1Ww7m9AhWaKXcP+HU=; b=xAb+4CRXl0hHZ6+fRJK4pT0roSElfuf4R2pSRDncD3ZGoXAM/BCgeVEQJfzSO4+mjVolxj HBS0nBYli2a5V2fjVt0n3kZnfC9beSXrsOpRbZratcNVg4jSHuAw1d+UDv6syvmKfA35Z6 sxHV1/I88dkcpLLzcZVbdmLPJLHNeGs= From: chengming.zhou@linux.dev To: axboe@kernel.dk, ming.lei@redhat.com, bvanassche@acm.org, hch@lst.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, chengming.zhou@linux.dev, Chengming Zhou Subject: [PATCH v4 1/6] blk-mq-tag: support queue filter in bt_tags_iter() Date: Wed, 13 Sep 2023 03:50:28 +0000 Message-Id: <20230913035033.1549277-2-chengming.zhou@linux.dev> In-Reply-To: <20230913035033.1549277-1-chengming.zhou@linux.dev> References: <20230913035033.1549277-1-chengming.zhou@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 12 Sep 2023 20:51:23 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email From: Chengming Zhou The only user of bt_for_each() is blk_mq_queue_tag_busy_iter(), which need to filter queue when iterate the tags. In preparation of removing bt_for_each(), support queue filter in bt_tags_iter(). Reviewed-by: Bart Van Assche Signed-off-by: Chengming Zhou --- block/blk-mq-tag.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index cc57e2dd9a0b..3cf3cf72cd54 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c @@ -329,6 +329,7 @@ struct bt_tags_iter_data { busy_tag_iter_fn *fn; void *data; unsigned int flags; + struct request_queue *q; }; #define BT_TAG_ITER_RESERVED (1 << 0) @@ -357,9 +358,13 @@ static bool bt_tags_iter(struct sbitmap *bitmap, unsigned int bitnr, void *data) if (!rq) return true; + if (iter_data->q && iter_data->q != rq->q) + goto out; + if (!(iter_data->flags & BT_TAG_ITER_STARTED) || blk_mq_request_started(rq)) ret = iter_data->fn(rq, iter_data->data); +out: if (!iter_static_rqs) blk_mq_put_rq_ref(rq); return ret; -- 2.40.1