From patchwork Thu Apr 26 07:21:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10364819 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6841F601D3 for ; Thu, 26 Apr 2018 07:22:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 512052905F for ; Thu, 26 Apr 2018 07:22:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4582E29069; Thu, 26 Apr 2018 07:22:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFCC629063 for ; Thu, 26 Apr 2018 07:22:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753351AbeDZHWJ (ORCPT ); Thu, 26 Apr 2018 03:22:09 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:35288 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752148AbeDZHWI (ORCPT ); Thu, 26 Apr 2018 03:22:08 -0400 Received: by mail-it0-f66.google.com with SMTP id 186-v6so22538020itu.0 for ; Thu, 26 Apr 2018 00:22:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=kWoYTjITakzdWvIxH2edEkaQwoeYYIr3LNQ7lUzwRY0=; b=kvV1C7J9X+g5aWzeD+mtCVr94tkzKqcxZkvcBd9obw4Du881tx67kx4fFPW3ILHROu fsJzaWSZ3kx3MexQEXpjZM8en3HZNj9Pl6D1W0MxeFM8SpXTrIqu6QH8MTWKFtnfr1uA CoaFyo6O+Gw1PcSal/v0i81/3wvb9IxPqY7TWBzK3yEkxHLvAnr1VEqc8JS+1gjEvR88 AOwbhu9AsNEw894M9r6d5EsWhqqW1LnRdalJMBPu58FnSPLPJ/jS+OpbdSSmj6qxZm3r tBvaaQXpKIEV4C7F93JvSfeFVL03pii0HYA47xH6a2el1Getlzoz24PrffaxaMrHq1Xi +qAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=kWoYTjITakzdWvIxH2edEkaQwoeYYIr3LNQ7lUzwRY0=; b=QwX9s1jkuieFMOfyEjOUdGq1SjFB7RufEIVo3hkCAIUxCcS0QRCy2TCp/+4nw06ml2 F4y+RkP/wIQG+wI/jzqOZapeXCBncIYnABzZqWOCwTckCm5KOpBNl/UBhjZMPUoGVkEm lz8G06PoBr3EMdg0hPvSaj3o4dhMsOaMUNJAiP0/i9/dEBje/ofANBT3az1OsC28N9bX kbKFJvZdsZobANw+FwlXXyhw2pqAHFMfr/QN70F/MCFsiALuqdOp6gU0t+QihfVcQnZ+ Qb1quFP++k88EPB8gOESkfSt00hIWzzyTllgh7LzNVLSjKJBjbz8utxGFCP97hLu5P/P ah/Q== X-Gm-Message-State: ALQs6tC9gqPZ/xwefSXjnYUsooVwQQl6CqE+fWCvIYv+79q2mvVOjlXP wyJhl1VKbjtuhS8vNGkvKpSMeUHJATk= X-Google-Smtp-Source: AB8JxZoYSpWpjdkSu1O1DMevQZOczssq5T7Bu0OjM+C/3Un3NHhasOkDFRkowwjny71fXqfPUnbj6Q== X-Received: by 2002:a24:6ec4:: with SMTP id w187-v6mr27340302itc.67.1524727327531; Thu, 26 Apr 2018 00:22:07 -0700 (PDT) Received: from vader.Home (174-23-136-226.slkc.qwest.net. [174.23.136.226]) by smtp.gmail.com with ESMTPSA id d135-v6sm7594742ita.15.2018.04.26.00.22.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Apr 2018 00:22:07 -0700 (PDT) From: Omar Sandoval To: linux-block@vger.kernel.org Cc: Jens Axboe , kernel-team@fb.com Subject: [PATCH 1/2] blk-mq: count allocated but not started requests in iostats inflight Date: Thu, 26 Apr 2018 00:21:58 -0700 Message-Id: <17d1ebc9d396ecc15bace2ed79a55ec754165979.1524727168.git.osandov@fb.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Omar Sandoval In the legacy block case, we increment the counter right after we allocate the request, not when the driver handles it. In both the legacy and blk-mq cases, part_inc_in_flight() is called from blk_account_io_start() right after we've allocated the request. blk-mq only considers requests started requests as inflight, but this is inconsistent with the legacy definition and the intention in the code. This removes the started condition and instead counts all allocated requests. Fixes: f299b7c7a9de ("blk-mq: provide internal in-flight variant") Signed-off-by: Omar Sandoval --- block/blk-mq.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index c3621453ad87..5450cbc61f8d 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -95,18 +95,15 @@ static void blk_mq_check_inflight(struct blk_mq_hw_ctx *hctx, { struct mq_inflight *mi = priv; - if (blk_mq_rq_state(rq) == MQ_RQ_IN_FLIGHT) { - /* - * index[0] counts the specific partition that was asked - * for. index[1] counts the ones that are active on the - * whole device, so increment that if mi->part is indeed - * a partition, and not a whole device. - */ - if (rq->part == mi->part) - mi->inflight[0]++; - if (mi->part->partno) - mi->inflight[1]++; - } + /* + * index[0] counts the specific partition that was asked for. index[1] + * counts the ones that are active on the whole device, so increment + * that if mi->part is indeed a partition, and not a whole device. + */ + if (rq->part == mi->part) + mi->inflight[0]++; + if (mi->part->partno) + mi->inflight[1]++; } void blk_mq_in_flight(struct request_queue *q, struct hd_struct *part,