From patchwork Mon Oct 24 11:27:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9005 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp440418wru; Mon, 24 Oct 2022 06:04:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5aHBcdeSHWI8hOHklwG3ZYVuiJF5fYjoyZFc0evPBf3VTu+jg5xR52iUZH9hfSA/MFc/r9 X-Received: by 2002:a17:90a:ab06:b0:20d:8764:b97a with SMTP id m6-20020a17090aab0600b0020d8764b97amr39061934pjq.7.1666616644352; Mon, 24 Oct 2022 06:04:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616644; cv=none; d=google.com; s=arc-20160816; b=cUd6YpW/SCsGoY7MkB8LGXfHsUryKg0xRvXXPfGfL3ZoyBjL+FZ4G2V6AFiXxkHyVA SeEUgU8iyWHm4WWtkwizLewTyglI5+K6MwWStr0Kj1huCvRHX0FdbmZWGsU27bzcF1qJ WVYvbDdb4QQ7/2jUkEzPQrPjdpdfSUpO7Q6BRiq5DwtVHLz7UUFJ1EiMcvBUDFBehJwM OCuzDaLSQfPJZOMobryQEslbEQGVP1w6HyKIOXL5q/Za25wvxhPnmy0sVK05MC0zdBRX X1mnV+zjm6mejhl2Z76Sk41bO+IE2ZHD/dYEpgtfo4XCnQ5smQJzqoxu0AyZ2kVKR3e9 v23w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AmsdnmlkCJ/HuzVv0W09SYfLcNT0Qmgjudw7/HO50BQ=; b=v1KyfiOgR534XIur+GCzxd1/d8lecF19k7IhHc1SWIg0khtAcc1zq/WNIMvC3mzRRo yJKphlhQy7G3+4O7lH/b/DXg9ju57ZSNr10vnZKajg0vaCxX52WqTyjUrfneUoVMy9Kn JP35lRAoYjygtB8NNQdkQincwpPLyU7jnUDU9DKf2R5kVAPa41sJQmINogGozcU9gnTb YpXxya3+SVDDXza8VgSiMg5qOpjsrPvgb0loaSJlmeswv+NiiMWzsBbzgxVzAnMvv6Ro bv0NaiZl8ogLMg0TSYEtHWuYIo83uiIEb8sIainZiyoJOz9XgWQnDV10Fw1tKoM0Ag9v Y5BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YOEkcqVR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 71-20020a63054a000000b0045c16005914si35741750pgf.423.2022.10.24.06.03.24; Mon, 24 Oct 2022 06:04:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YOEkcqVR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235077AbiJXNC2 (ORCPT + 99 others); Mon, 24 Oct 2022 09:02:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235172AbiJXM7d (ORCPT ); Mon, 24 Oct 2022 08:59:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 695619AC31; Mon, 24 Oct 2022 05:18:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7FD2561311; Mon, 24 Oct 2022 12:17:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D077C433D6; Mon, 24 Oct 2022 12:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613860; bh=E8zRWJgVGId9cs8kWTiDR2jfYW9wv4Ht58bFMgmBLW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YOEkcqVRdBQ6KQipBUpNxjinP93lEFcEjwRDl3N7OPP2EHCUL5/8H86A8Aw7RlM0f G8CUY8xsCjIv5rSuhizrgoTJwZmdhrS/LjJrwP5OiqAY6gt+5fwCEYAUWWgI6yAByV BtBPU11LRK1eemZvePpIDPvTg6wSpaBd6X6Q3G2Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeffle Xu , Christoph Hellwig , Jens Axboe , Khazhismel Kumykov Subject: [PATCH 5.10 041/390] block: fix inflight statistics of part0 Date: Mon, 24 Oct 2022 13:27:18 +0200 Message-Id: <20221024113024.353587445@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574214363258512?= X-GMAIL-MSGID: =?utf-8?q?1747574214363258512?= From: Jeffle Xu commit b0d97557ebfc9d5ba5f2939339a9fdd267abafeb upstream. The inflight of partition 0 doesn't include inflight IOs to all sub-partitions, since currently mq calculates inflight of specific partition by simply camparing the value of the partition pointer. Thus the following case is possible: $ cat /sys/block/vda/inflight        0        0 $ cat /sys/block/vda/vda1/inflight        0      128 While single queue device (on a previous version, e.g. v3.10) has no this issue: $cat /sys/block/sda/sda3/inflight 0 33 $cat /sys/block/sda/inflight 0 33 Partition 0 should be specially handled since it represents the whole disk. This issue is introduced since commit bf0ddaba65dd ("blk-mq: fix sysfs inflight counter"). Besides, this patch can also fix the inflight statistics of part 0 in /proc/diskstats. Before this patch, the inflight statistics of part 0 doesn't include that of sub partitions. (I have marked the 'inflight' field with asterisk.) $cat /proc/diskstats 259 0 nvme0n1 45974469 0 367814768 6445794 1 0 1 0 *0* 111062 6445794 0 0 0 0 0 0 259 2 nvme0n1p1 45974058 0 367797952 6445727 0 0 0 0 *33* 111001 6445727 0 0 0 0 0 0 This is introduced since commit f299b7c7a9de ("blk-mq: provide internal in-flight variant"). Fixes: bf0ddaba65dd ("blk-mq: fix sysfs inflight counter") Fixes: f299b7c7a9de ("blk-mq: provide internal in-flight variant") Signed-off-by: Jeffle Xu Reviewed-by: Christoph Hellwig [axboe: adapt for 5.11 partition change] Signed-off-by: Jens Axboe [khazhy: adapt for 5.10 partition] Signed-off-by: Khazhismel Kumykov Signed-off-by: Greg Kroah-Hartman --- block/blk-mq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -105,7 +105,8 @@ static bool blk_mq_check_inflight(struct { struct mq_inflight *mi = priv; - if (rq->part == mi->part && blk_mq_rq_state(rq) == MQ_RQ_IN_FLIGHT) + if ((!mi->part->partno || rq->part == mi->part) && + blk_mq_rq_state(rq) == MQ_RQ_IN_FLIGHT) mi->inflight[rq_data_dir(rq)]++; return true;