From patchwork Tue Jan 17 08:12:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13104281 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4CC0C3DA78 for ; Tue, 17 Jan 2023 08:13:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235978AbjAQINM (ORCPT ); Tue, 17 Jan 2023 03:13:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236005AbjAQINI (ORCPT ); Tue, 17 Jan 2023 03:13:08 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3F6827D50; Tue, 17 Jan 2023 00:13:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=e9Arp5RM4CCeR3MmtiJCpPNVM3nlSN3oV3EiRKPIghc=; b=raeXDpMzlYcPThhhm0YOsU8B8h AtTxMPPF3m3v5OLyvKqt0SfM9NR25/PhYlhAlYQgQ4eveW0mScFF8zReCVS4RZkhlz8XZwtb+lYDS FctszAZg7hOvOvQS9jfjNUyaXFtiY9wMgErRYISz93QJscq3kbjR5h/nzIXohzrmqMSw2jAOV1mSW JwPYtndYx2kBjC2MN9obFL9jgg4KHtaiUzNnXp9Aa+C3CwhMaIDbSi3PvAWzg2hanTer6s0VZ6sar TKHrvluWnveptjzijlo8eUB9bDeHbJfRex3Dk9qxR/DuRaFAkD6WQ+xnHgxm20UPoTFv1oX4nLWqs kVsGDORg==; Received: from [2001:4bb8:19a:2039:eaa2:3b9e:be2e:bd2a] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHh5d-00DHhD-En; Tue, 17 Jan 2023 08:13:05 +0000 From: Christoph Hellwig To: Jens Axboe , Tejun Heo , Josef Bacik Cc: linux-block@vger.kernel.org, cgroups@vger.kernel.org Subject: [PATCH 02/15] block: don't call blk_throtl_stat_add for non-READ/WRITE commands Date: Tue, 17 Jan 2023 09:12:44 +0100 Message-Id: <20230117081257.3089859-3-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230117081257.3089859-1-hch@lst.de> References: <20230117081257.3089859-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org blk_throtl_stat_add is called from blk_stat_add explicitly, unlike the other stats that go through q->stats->callbacks. To prepare for cgroup data moving to the gendisk, ensure blk_throtl_stat_add is only called for the plain READ and WRITE commands that it actually handles internally, as blk_stat_add can also be called for passthrough commands on queues that do not have a genisk associated with them. Signed-off-by: Christoph Hellwig Reviewed-by: Andreas Herrmann Reviewed-by: Hannes Reinecke --- block/blk-stat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/blk-stat.c b/block/blk-stat.c index 2ea01b5c1aca04..c6ca16abf911e2 100644 --- a/block/blk-stat.c +++ b/block/blk-stat.c @@ -58,7 +58,8 @@ void blk_stat_add(struct request *rq, u64 now) value = (now >= rq->io_start_time_ns) ? now - rq->io_start_time_ns : 0; - blk_throtl_stat_add(rq, value); + if (req_op(rq) == REQ_OP_READ || req_op(rq) == REQ_OP_WRITE) + blk_throtl_stat_add(rq, value); rcu_read_lock(); cpu = get_cpu();