From patchwork Thu Apr 20 22:59:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Bates X-Patchwork-Id: 9691475 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 7368C600C8 for ; Thu, 20 Apr 2017 22:59:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64D2E28468 for ; Thu, 20 Apr 2017 22:59:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 598D02846A; Thu, 20 Apr 2017 22:59:24 +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=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 BA5512846C for ; Thu, 20 Apr 2017 22:59:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032866AbdDTW7W (ORCPT ); Thu, 20 Apr 2017 18:59:22 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:34938 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032864AbdDTW7W (ORCPT ); Thu, 20 Apr 2017 18:59:22 -0400 Received: by mail-io0-f193.google.com with SMTP id d203so22029499iof.2 for ; Thu, 20 Apr 2017 15:59:21 -0700 (PDT) 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; bh=sqYY5xMy8HeSahpvKXByRteWpUH9aGjvr1sI5JAO7hw=; b=VGwdtN3knRjx5udxkBdnFAurwPem0+IBbwtgwzq3RgmlsVTgyOCRVNkdHm9/YPiPtv XVgGgDlQGS3dVb15Q/WvmcMICggP4d7/MAqnUPUzmg18+fMvqEHtKoK091bfqY3VMSya mU2LIfxb8LENE+1TaUx8cucXA3LXEmgYh9yS89Lo4u7IZZBb2xMo6o+Z5AqJtL2ZBBeQ h8XIVSF7htkfm8hH8XG6y0/TfrjuU08QtPFjS61shc2jaXCpVvyLQO9xAO94+jy99unF 42sBXsplM/77rlJT3+ZXVJaW/rSe/jtYkijnQMPVfH0+jaxAmXs7F671hh9EG37b2I3b 8Ztg== X-Gm-Message-State: AN3rC/6m9zTYDBVFrVbt2BJ4GhhanPqHRc5no5wxRARexmUJ5RTUubH8 TLrZf/LPdYeNtw== X-Received: by 10.36.138.129 with SMTP id v123mr6926572itd.108.1492729156210; Thu, 20 Apr 2017 15:59:16 -0700 (PDT) Received: from ubuntu64-batesste.cn.shawcable.net (S0106001cf0c4cfac.cn.shawcable.net. [70.65.232.47]) by smtp.gmail.com with ESMTPSA id i11sm317394itf.10.2017.04.20.15.59.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Apr 2017 15:59:15 -0700 (PDT) From: sbates@raithlin.com To: axboe@kernel.dk Cc: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Damien.LeMoal@wdc.com, osandov@osandov.com, sbates@raithlin.com, sagi@grimberg.me Subject: [PATCH] blk-mq: Fix poll_stat for new size-based bucketing. Date: Thu, 20 Apr 2017 16:59:11 -0600 Message-Id: <1492729151-20983-1-git-send-email-sbates@raithlin.com> X-Mailer: git-send-email 2.7.4 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: Stephen Bates Fixes an issue where the size of the poll_stat array in request_queue does not match the size expected by the new size based bucketing for IO completion polling. Should be applied on top of commit 720b8ccc4500 ("blk-mq: Add a polling specific stats function"). Signed-off-by: Stephen Bates --- block/blk-mq-debugfs.c | 15 +++++++++------ block/blk-mq.c | 8 ++++---- include/linux/blkdev.h | 5 ++++- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index df9b688..3057641 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -159,14 +159,17 @@ static void print_stat(struct seq_file *m, struct blk_rq_stat *stat) static int queue_poll_stat_show(struct seq_file *m, void *v) { struct request_queue *q = m->private; + int bucket; - seq_puts(m, "read: "); - print_stat(m, &q->poll_stat[READ]); - seq_puts(m, "\n"); + for (bucket = 0; bucket < BLK_MQ_POLL_STATS_BKTS/2; bucket++) { + seq_printf(m, "read (%d Bytes): ", 1 << (9+bucket)); + print_stat(m, &q->poll_stat[2*bucket]); + seq_puts(m, "\n"); - seq_puts(m, "write: "); - print_stat(m, &q->poll_stat[WRITE]); - seq_puts(m, "\n"); + seq_printf(m, "write (%d Bytes): ", 1 << (9+bucket)); + print_stat(m, &q->poll_stat[2*bucket+1]); + seq_puts(m, "\n"); + } return 0; } diff --git a/block/blk-mq.c b/block/blk-mq.c index 9d7645f..81f7c99 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -42,8 +42,6 @@ static LIST_HEAD(all_q_list); static void blk_mq_poll_stats_start(struct request_queue *q); static void blk_mq_poll_stats_fn(struct blk_stat_callback *cb); -/* Must be consisitent with function below */ -#define BLK_MQ_POLL_STATS_BKTS 16 static int blk_mq_poll_stats_bkt(const struct request *rq) { int ddir, bytes, bucket; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 6c4ab0d..6c24786 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -46,6 +46,9 @@ struct blk_stat_callback; #define BLKDEV_MIN_RQ 4 #define BLKDEV_MAX_RQ 128 /* Default maximum */ +/* Must be consisitent with blk_mq_poll_stats_bkt() */ +#define BLK_MQ_POLL_STATS_BKTS 16 + /* * Maximum number of blkcg policies allowed to be registered concurrently. * Defined here to simplify include dependency. @@ -517,7 +520,7 @@ struct request_queue { int poll_nsec; struct blk_stat_callback *poll_cb; - struct blk_rq_stat poll_stat[2]; + struct blk_rq_stat poll_stat[BLK_MQ_POLL_STATS_BKTS]; struct timer_list timeout; struct work_struct timeout_work;