From patchwork Wed Jan 25 16:06:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 9537381 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 D4F006042C for ; Wed, 25 Jan 2017 16:07:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C688328174 for ; Wed, 25 Jan 2017 16:07:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB5992819A; Wed, 25 Jan 2017 16:07:36 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 4167E28178 for ; Wed, 25 Jan 2017 16:07:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751479AbdAYQHb (ORCPT ); Wed, 25 Jan 2017 11:07:31 -0500 Received: from mail-pf0-f180.google.com ([209.85.192.180]:33130 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751460AbdAYQH2 (ORCPT ); Wed, 25 Jan 2017 11:07:28 -0500 Received: by mail-pf0-f180.google.com with SMTP id y143so59229346pfb.0 for ; Wed, 25 Jan 2017 08:07:28 -0800 (PST) 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=SkcpqSGXtLLI8QiYaKdYm19OAA3SAlnoWuM/ZKMv/IE=; b=pt0up3mfzlJzShat4Sxp2TirgBK0Y6u0VSvzGbjFQKktMBDsJMo4XPLzk0lJyx9Va5 hBFMfKBvyplmO/OqtvEXGHSSEfiq4nMFN6veXvOT7XwEx+OEm+uF/0vhkN1OYc+OQeU7 9HWupp4L25R6K6TlTpZFFh54dCgxx6pqwEp86TJn60dR0nX0UbZlM4SrFnbPw7ipA2rw /wrnEXrzQN6tpKWGkqxk4ZuR4oYqRPCxJy+rAb2GBVh6lqs2WJxc/r2/gAUHsLpa5vst fqbSyHd32+lG55zKX87zq/vv5eSQZZ28bKrp8bg8T8KJItwOLp9aQ4cQKPoI9M1HERyL cUqw== 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=SkcpqSGXtLLI8QiYaKdYm19OAA3SAlnoWuM/ZKMv/IE=; b=R4gLhmc0cxhjOBZDk/Vmfll114jR43LX8aeGVU6Ct6zZeXHd/zcKBhOCqZUTN6jmhP cF0whKucrm3cdqI/JqBQssMTo46SEx15VCzZmlptZYKFLvAjQzg3aQfxv6bSP6Zf7IcB kzVvZFM0d+rNeRiQTXH1NkhhRNaEJLK6EmRGfkgQJ/KIkLmYET2McVyRzb3A7CZHFJeC UYOnbbI3fUQSLEkTmVxKxuWI32BUA7JNXadpHPPiwajf6Q8nPFJ1GG/Yk1OA+FrzyIVn h8AvkUC0RNt4p/gb9D1gEC9ekv28JfwsRkUBe6TdwrsM+urYwPBrpvhHhFTqFRAecyaY T/Tw== X-Gm-Message-State: AIkVDXJNqW/kqCytczkeqWFRK1dUYeJa7vkCKdMsyJj9/IERXoWlAoOzsv/+Q5vBnydFCDi3 X-Received: by 10.99.228.69 with SMTP id i5mr47998546pgk.63.1485360442845; Wed, 25 Jan 2017 08:07:22 -0800 (PST) Received: from localhost.localdomain ([2601:602:8801:8110:e6a7:a0ff:fe0b:c9a8]) by smtp.gmail.com with ESMTPSA id d68sm2270588pfj.92.2017.01.25.08.07.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jan 2017 08:07:22 -0800 (PST) From: Omar Sandoval To: Jens Axboe , linux-block@vger.kernel.org Cc: kernel-team@fb.com Subject: [PATCH v2 02/10] blk-mq: add hctx->{state,flags} to debugfs Date: Wed, 25 Jan 2017 08:06:41 -0800 Message-Id: <0e6807961ff10fc30f9362a226db4870d71e076e.1485360145.git.osandov@fb.com> X-Mailer: git-send-email 2.11.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 hctx->state could come in handy for bugs where the hardware queue gets stuck in the stopped state, and hctx->flags is just useful to know. Signed-off-by: Omar Sandoval --- block/blk-mq-debugfs.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index 01711bbf5ade..0c14511fa9e0 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -29,7 +29,49 @@ struct blk_mq_debugfs_attr { static struct dentry *block_debugfs_root; +static int hctx_state_show(struct seq_file *m, void *v) +{ + struct blk_mq_hw_ctx *hctx = m->private; + + seq_printf(m, "0x%lx\n", hctx->state); + return 0; +} + +static int hctx_state_open(struct inode *inode, struct file *file) +{ + return single_open(file, hctx_state_show, inode->i_private); +} + +static const struct file_operations hctx_state_fops = { + .open = hctx_state_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int hctx_flags_show(struct seq_file *m, void *v) +{ + struct blk_mq_hw_ctx *hctx = m->private; + + seq_printf(m, "0x%lx\n", hctx->flags); + return 0; +} + +static int hctx_flags_open(struct inode *inode, struct file *file) +{ + return single_open(file, hctx_flags_show, inode->i_private); +} + +static const struct file_operations hctx_flags_fops = { + .open = hctx_flags_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + static const struct blk_mq_debugfs_attr blk_mq_debugfs_hctx_attrs[] = { + {"state", 0400, &hctx_state_fops}, + {"flags", 0400, &hctx_flags_fops}, }; static const struct blk_mq_debugfs_attr blk_mq_debugfs_ctx_attrs[] = {