From: Christoph Hellwig Subject: [PATCH 01/19] block: don't call blk_throtl_stat_add for non-READ/WRITE commands Date: Fri, 3 Feb 2023 16:03:42 +0100 Message-ID: <20230203150400.3199230-2-hch@lst.de> References: <20230203150400.3199230-1-hch@lst.de> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Return-path: 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=nNSsjjHnpiCO8ynHR2sTvVWi+uZiLpOH3GN8oxsiI8E=; b=qLV0Y8kwF8rcqDOU2wNTh2ZQ+q Bod+a2KKPJPNnVyLitbzhZpzXLcqSJ7EX55TiUgoGli+dQbwXWKKt/9VX/g5fDvh7slXgpf7hwHrr KdCd7kQxbnkDDf2Jv/0QG7OOLYdJbtJlyYlQ7Bn8P3CtQ2STc08OMJrWS8tmcgAcjJ56KiIYutu29 bN1MINpozFoPks+BQxShtsyDyzu27H4qgvLHmnASg3l54bgy+7tTowTD/3mP7G84c7cr/cCETIH71 D0++JiUEcVeQVG59DLerKyov1KN3LYSMiHRQlO1nt3kVlSQk4urRvLjrLJ+ilY5lhpzTNVYpFdusB TCAC7Y2Q==; In-Reply-To: <20230203150400.3199230-1-hch-jcswGhMUV9g@public.gmane.org> List-ID: Content-Type: text/plain; charset="us-ascii" To: Jens Axboe , Tejun Heo , Josef Bacik Cc: linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Andreas Herrmann 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 gendisk associated with them. Signed-off-by: Christoph Hellwig Reviewed-by: Andreas Herrmann Acked-by: Tejun Heo --- 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(); -- 2.39.0