From patchwork Fri Mar 16 17:31:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10289655 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 B684C601A0 for ; Fri, 16 Mar 2018 17:31:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8456287B7 for ; Fri, 16 Mar 2018 17:31:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9CC7E28FED; Fri, 16 Mar 2018 17:31:16 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 07184287B7 for ; Fri, 16 Mar 2018 17:31:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753402AbeCPRbN (ORCPT ); Fri, 16 Mar 2018 13:31:13 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:6542 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753129AbeCPRbM (ORCPT ); Fri, 16 Mar 2018 13:31:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1521221473; x=1552757473; h=from:to:cc:subject:date:message-id; bh=pjhLrmUgYcLCNDWrNR/fGOc+10OZwB2ubokk6lggotA=; b=Xnq2KquPTGw02FZDa/3o05UPHkg+7cl5O8OGS/3sUXuqdASL/BJaGmmJ 2UDnXkS0ZCMmfcDwb0RPKN8OsHSvuVE43BvZnDxCnB6qkdgeF0arW4Zy7 i4v7u8T+HnQnEiWyDNLmY2DjnmVSKXzM+RsmJme9hQOO6lNDr8lFjJOel 1ZwWTQEcOP52/JT+V7YOBIQcrymZNzFLa/b6A+vXNnaEHpXJJsfgL1MMT YR0FmNyqoYjIe2oDBJGk3tP2oAoR3j09+7ogLabj3mFZ9rWJsUIcEs289 akMZAQSzE86KsLd5B2TS60cRPCpILF7tvp+MARoDYLWhIEFF7nmA8zO03 A==; X-IronPort-AV: E=Sophos;i="5.47,471,1515427200"; d="scan'208";a="74367659" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 17 Mar 2018 01:31:13 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 16 Mar 2018 10:24:44 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.171.236]) by uls-op-cesaip01.wdc.com with ESMTP; 16 Mar 2018 10:31:12 -0700 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Tejun Heo Subject: [PATCH v2] blk-mq-debugfs: Show more request state information Date: Fri, 16 Mar 2018 10:31:11 -0700 Message-Id: <20180316173111.2221-1-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.16.2 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 Since commit 634f9e4631a8 ("blk-mq: remove REQ_ATOM_COMPLETE usages from blk-mq") blk_rq_is_complete() only reports whether or not a request has completed for legacy queues. Hence modify the blk-mq-debugfs code such that it shows the blk-mq request state again. Fixes: 634f9e4631a8 ("blk-mq: remove REQ_ATOM_COMPLETE usages from blk-mq") Signed-off-by: Bart Van Assche Cc: Tejun Heo --- Changes compared to v1: - Added an out-of-bounds check to the access of the request state name array as requested by Jens. block/blk-mq-debugfs.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index bd21d5b9f65f..58b3b79cbe83 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -350,6 +350,20 @@ static const char *const rqf_name[] = { }; #undef RQF_NAME +static const char *const blk_mq_rq_state_name_array[] = { + [MQ_RQ_IDLE] = "idle", + [MQ_RQ_IN_FLIGHT] = "in_flight", + [MQ_RQ_COMPLETE] = "complete", +}; + +static const char *blk_mq_rq_state_name(enum mq_rq_state rq_state) +{ + if (WARN_ON_ONCE((unsigned int)rq_state > + ARRAY_SIZE(blk_mq_rq_state_name_array))) + return "(?)"; + return blk_mq_rq_state_name_array[rq_state]; +} + int __blk_mq_debugfs_rq_show(struct seq_file *m, struct request *rq) { const struct blk_mq_ops *const mq_ops = rq->q->mq_ops; @@ -366,7 +380,7 @@ int __blk_mq_debugfs_rq_show(struct seq_file *m, struct request *rq) seq_puts(m, ", .rq_flags="); blk_flags_show(m, (__force unsigned int)rq->rq_flags, rqf_name, ARRAY_SIZE(rqf_name)); - seq_printf(m, ", complete=%d", blk_rq_is_complete(rq)); + seq_printf(m, ", .state=%s", blk_mq_rq_state_name(blk_mq_rq_state(rq))); seq_printf(m, ", .tag=%d, .internal_tag=%d", rq->tag, rq->internal_tag); if (mq_ops->show_rq)