From patchwork Wed Jun 19 17:12:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11004815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E9CA814E5 for ; Wed, 19 Jun 2019 17:13:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D899B28528 for ; Wed, 19 Jun 2019 17:13:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC58E285D5; Wed, 19 Jun 2019 17:13:53 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 6D6B028606 for ; Wed, 19 Jun 2019 17:13:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726091AbfFSRNw (ORCPT ); Wed, 19 Jun 2019 13:13:52 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:10796 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730120AbfFSRNw (ORCPT ); Wed, 19 Jun 2019 13:13:52 -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=1560964433; x=1592500433; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mrjiBfA8h8qDNTOQO7p0HkeGNBRUV8HORopCFjU75pY=; b=lgBd+t9usNyoACa9C7sSIQnZBY4Jr/qD6BvG1BxG0WIaX2upLr7WWstS NkeG3qNp249G4C0vhxZ5fMt0rlGZoFH1Y9oc5PGU3/BR8/iPHYSyPbkbI M61jMFbSKXb/jJtqK7VjkhDVoHhrJh/0bymXeQDAGzf8XObgu87Lw8IcL 8I6ZZ86hY1S88LN1HEDONL01qJUGI21SH4jT9LMvushGxZ3WO8UGIAf3x eTPvq7gcz9RPk4nzQIw4bKFA56QiD21c7F6hnpqWijbY4kV9JYzkitu3q b+s4YGZ5lVsxG/tgPiGHXEmUfNnn2sOfu9pNvbzb0ew4f1QTdfbG/G/I0 Q==; X-IronPort-AV: E=Sophos;i="5.63,393,1557158400"; d="scan'208";a="115883801" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 20 Jun 2019 01:13:53 +0800 IronPort-SDR: faDUmELcQo74+mT05T9Om93sYNDHrQNVtUvuxiubcRnq5bu9EmXLSri8Z/azptpCwZs3U+rqDb Gp8csOdmlijLmPdQ3MSau8+p93yeKrkYidRpUJkxHq1KSpZmfT8MbOW3T80KyVZk+XAUrmrwXx j0fd8O4vhlG4Tw3SRxbQ6/o3cXkFIW4uYV2Kg2fW6dWLOFF4j+F2n/q41mBd2PuCuIcUkyRMPB KxScKXYn9ABLipwItM3Yeag5ord+J8WVM8l+PLqhDxmFvQ8oYcWfuq38u1URHOcxjXGNdWhJQx TwNeOJpkDfAPHcaTBVYu4ZGv Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 19 Jun 2019 10:13:18 -0700 IronPort-SDR: QJJqovorEo/Vw9i4WQcnLbYMtDfCZpnK7RdzWdJfILBTXo7BuxW81kzHOrKc/2GzEkDcqxvIIi oD8NfDHsmss5KNjcfTPs85Qd1QxZ+7VbJ8+eKErQQErPNpT33Z/RX9/bhIcCUG7sQoWjJN8uaj CQs7B8hf3iUnsXAw0/S5TQSWXZ80N6Fp/2BMoIPf0P7LOJsOWNcsbWfykSLKUgsWXPaQeZN0qo pc0HA/rtfstHLvGDVKgimPUUA/6ThrZlDaaztuXyz9K/4HtS/4YsiFrXfrkkvHJFPUB+USY2Kl jdw= Received: from cmercuryqemu.hgst.com ([10.202.65.32]) by uls-op-cesaip01.wdc.com with ESMTP; 19 Jun 2019 10:13:52 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: jaegeuk@kernel.org, yuchao0@huawei.com, bvanassche@acm.org, Chaitanya Kulkarni Subject: [PATCH V4 1/5] block: improve print_req_error Date: Wed, 19 Jun 2019 10:12:58 -0700 Message-Id: <20190619171302.10146-2-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190619171302.10146-1-chaitanya.kulkarni@wdc.com> References: <20190619171302.10146-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 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: Christoph Hellwig Print the calling function instead of print_req_error as a prefix, and print the operation and op_flags separately instead of the whole field. Reviewed-by: Hannes Reinecke Signed-off-by: Christoph Hellwig Signed-off-by: Chaitanya Kulkarni Reviewed-by: Bart Van Assche --- block/blk-core.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 8340f69670d8..6753231b529b 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -167,18 +167,20 @@ int blk_status_to_errno(blk_status_t status) } EXPORT_SYMBOL_GPL(blk_status_to_errno); -static void print_req_error(struct request *req, blk_status_t status) +static void print_req_error(struct request *req, blk_status_t status, + const char *caller) { int idx = (__force int)status; if (WARN_ON_ONCE(idx >= ARRAY_SIZE(blk_errors))) return; - printk_ratelimited(KERN_ERR "%s: %s error, dev %s, sector %llu flags %x\n", - __func__, blk_errors[idx].name, - req->rq_disk ? req->rq_disk->disk_name : "?", - (unsigned long long)blk_rq_pos(req), - req->cmd_flags); + printk_ratelimited(KERN_ERR + "%s: %s error, dev %s, sector %llu op 0x%x flags 0x%x\n", + caller, blk_errors[idx].name, + req->rq_disk ? req->rq_disk->disk_name : "?", + blk_rq_pos(req), req_op(req), + req->cmd_flags & ~REQ_OP_MASK); } static void req_bio_endio(struct request *rq, struct bio *bio, @@ -1373,7 +1375,7 @@ bool blk_update_request(struct request *req, blk_status_t error, if (unlikely(error && !blk_rq_is_passthrough(req) && !(req->rq_flags & RQF_QUIET))) - print_req_error(req, error); + print_req_error(req, error, __func__); blk_account_io_completion(req, nr_bytes); From patchwork Wed Jun 19 17:12:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11004819 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B2C621395 for ; Wed, 19 Jun 2019 17:13:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3B3C285FF for ; Wed, 19 Jun 2019 17:13:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97FDF28608; Wed, 19 Jun 2019 17:13:56 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 01FBC285FF for ; Wed, 19 Jun 2019 17:13:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730121AbfFSRNz (ORCPT ); Wed, 19 Jun 2019 13:13:55 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:10796 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730120AbfFSRNz (ORCPT ); Wed, 19 Jun 2019 13:13:55 -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=1560964436; x=1592500436; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=H8J5LM2HZ9hya29SBi1L7Jdn0d5QYTA8HA4pnyfj1Tc=; b=k5peIfSxfzjrrYNQBmpQugzQcy1F9uENgzOBkY3TDmfke7xTmPoFj3iq 3WUIK7GUKGN4T60ssPJ8N2H8tTEkYrtXT16+XOQZZ4SfQ5FSjm7X1g8QD 6MNDxhCocWiLkcF7J5EuPum9IxTHxEh13gHDyAt69dosbj1daQ5qcwgFM 6GDE3A805YovpZK6zZZb1mfD8HfdxZ01aGhs6tYA5pFAn2WnjeMjZ3ppx cIY5y8PLBcrOs+NJw0Oj0ZZwaRydk5L6VjDyB/hFXcqOud44/A51Tf0yH /LYcEUpucfTaf4egL80whnmaOHp8Tt9AXj8hQSpJbOlLnhSukKwQw4qC0 g==; X-IronPort-AV: E=Sophos;i="5.63,393,1557158400"; d="scan'208";a="115883803" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 20 Jun 2019 01:13:55 +0800 IronPort-SDR: 93XIaITpsnUOoadeBlqKxbDxUlODsx1uQfJfd+boSFCVFOvwbVogIvoK6rSO/FKFHhKEVCJSrq DaMqUC1a4OjSyBLlSxcg9ymp20TXswCw7C6Y+4ixTNHkELCu9xNRQKQbQpwMp69KmuPlM63wNy BrZC481rLFxwaa29JThPmoh/jSN+/GnraxaCHv7512Dc1qbeqtMgGIBLtFSsSQZsHcCEa1XDRG ujrzokYGEvSFk7rZjcIG6G2PnfRJC2VFCUdg3KgLj0u+a64uUs/ZvhUNxtTbfs1ynUDkSC/QDO WOECqkO4XKImNhk4vO1jJ3jv Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 19 Jun 2019 10:13:21 -0700 IronPort-SDR: 3tETrA0kuJ//P6gZE3SFWrQwnvFw/r4ANdiN/qt2uwRSE5+WuwupzBteup2f/3zGaOarPzEYcJ nM2rj/6m43352/zC75Y6PwqD5+WDbQewtUFcMmu0rhDLi+/0lekfIMAU4srpR2LVdoOfXjDVO8 1VIVGKhLMwzLsJd4ESkOqaL6wWBFq9ydSTyiuQTVHVx8pNZ6yUrn0ZFOZ4p0RNzYbZnGGfIDgT 9Dql8z9ZwsS7FAonROL1C3B3Q3jWbWyIVNmKaA50ReUXJjZP4mZsXFCF5tJ5MBD9NGCtAV52mL TYw= Received: from cmercuryqemu.hgst.com ([10.202.65.32]) by uls-op-cesaip01.wdc.com with ESMTP; 19 Jun 2019 10:13:54 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: jaegeuk@kernel.org, yuchao0@huawei.com, bvanassche@acm.org, Chaitanya Kulkarni Subject: [PATCH V4 2/5] block: add centralize REQ_OP_XXX to string helper Date: Wed, 19 Jun 2019 10:12:59 -0700 Message-Id: <20190619171302.10146-3-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190619171302.10146-1-chaitanya.kulkarni@wdc.com> References: <20190619171302.10146-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 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 In order to centralize the REQ_OP_XXX to string conversion which can be used in the block layer and different places in the kernel like f2fs, this patch adds a new helper function along with an array similar to the one present in the blk-mq-debugfs.c. We keep this helper functionality centralize under blk-core.c instead of blk-mq-debugfs.c since blk-core.c is configured using CONFIG_BLOCK and it will not be dependent on blk-mq-debugfs.c which is configured using CONFIG_BLK_DEBUG_FS. Next patch adjusts the code in the blk-mq-debugfs.c with newly introduced helper. Signed-off-by: Chaitanya Kulkarni Reviewed-by: Bart Van Assche --- block/blk-core.c | 36 ++++++++++++++++++++++++++++++++++++ include/linux/blkdev.h | 3 +++ 2 files changed, 39 insertions(+) diff --git a/block/blk-core.c b/block/blk-core.c index 6753231b529b..c92b5a16a27a 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -120,6 +120,42 @@ void blk_rq_init(struct request_queue *q, struct request *rq) } EXPORT_SYMBOL(blk_rq_init); +#define REQ_OP_NAME(name) [REQ_OP_##name] = #name +static const char *const blk_op_name[] = { + REQ_OP_NAME(READ), + REQ_OP_NAME(WRITE), + REQ_OP_NAME(FLUSH), + REQ_OP_NAME(DISCARD), + REQ_OP_NAME(SECURE_ERASE), + REQ_OP_NAME(ZONE_RESET), + REQ_OP_NAME(WRITE_SAME), + REQ_OP_NAME(WRITE_ZEROES), + REQ_OP_NAME(SCSI_IN), + REQ_OP_NAME(SCSI_OUT), + REQ_OP_NAME(DRV_IN), + REQ_OP_NAME(DRV_OUT), +}; +#undef REQ_OP_NAME + +/** + * blk_op_str - Return string XXX in the REQ_OP_XXX. + * @op: REQ_OP_XXX. + * + * Description: Centralize block layer function to convert REQ_OP_XXX into + * string format. Useful in the debugging and tracing bio or request. For + * invalid REQ_OP_XXX it returns string "UNKNOWN". + */ +inline const char *blk_op_str(unsigned int op) +{ + const char *op_str = "UNKNOWN"; + + if (op < ARRAY_SIZE(blk_op_name) && blk_op_name[op]) + op_str = blk_op_name[op]; + + return op_str; +} +EXPORT_SYMBOL_GPL(blk_op_str); + static const struct { int errno; const char *name; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 592669bcc536..077a77a4a91c 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -867,6 +867,9 @@ extern void blk_execute_rq(struct request_queue *, struct gendisk *, extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, struct request *, int, rq_end_io_fn *); +/* Helper to convert REQ_OP_XXX to its string format XXX */ +extern const char *blk_op_str(unsigned int op); + int blk_status_to_errno(blk_status_t status); blk_status_t errno_to_blk_status(int errno); From patchwork Wed Jun 19 17:13:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11004821 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8C51B1395 for ; Wed, 19 Jun 2019 17:14:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C865285FF for ; Wed, 19 Jun 2019 17:14:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 70E55284A5; Wed, 19 Jun 2019 17:14:00 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 A19DA28613 for ; Wed, 19 Jun 2019 17:13:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730131AbfFSRN6 (ORCPT ); Wed, 19 Jun 2019 13:13:58 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:10796 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730120AbfFSRN6 (ORCPT ); Wed, 19 Jun 2019 13:13:58 -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=1560964439; x=1592500439; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jcHDm4jZNbyc5j1/ToWU/7RDcyYbgsu6A2aVzgajouY=; b=gdj5k7nPcYAKRQbiyzYitKaBozQQ67MF8jZq6mNq7ZvaqiLIOB7666O5 LY5y6eQc59FOxPiMDc1NMxknZj4fN5WjjLnuEPre5srtUaYt7enPJmbkt EMdZNUSHEiDo+SnFbmgRSWchDKQZzNoOBs2Oirvo9k2yCAZ4rCp8855ko pxWB/IxfUZTrL7sA32Mt3i4EnagDyUfxL5u6DIlfMyrZIrwOMrGek3RJS g1sJhg+7jLevzyHHe60bg8ze2SvGvWs3zW0uqutnixohlLCISVxW1mwca dHQRpjFn4zENAGkNI5A9g2oz9A9dRcg6T6yrdJyMHqXjWxBGtI1HP+poy A==; X-IronPort-AV: E=Sophos;i="5.63,393,1557158400"; d="scan'208";a="115883808" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 20 Jun 2019 01:13:59 +0800 IronPort-SDR: Wq9034o6fOwq4iKuMnalD3P0zPkzaGglXan/NUJ1F74kjWA22JA4IXZGEwZBFIsaLUeeHrWvXk R0ZVPzEke5VPqZE3QRkSxj3TaSukHB/uxpk1Xfzk9Yd43b/pvZ3YtrpVzOcRX4iLE65+ts0zxH YzNazZ4uDsrskb2wdjGI3A0U4D3sviL6JxdDIQZVN8CG8tn2fZFI4sUga3gxvS6VJf3GgUgugj g7bxRmMVLGV15SQrmSmxJ56Esja1jiffabs/XH5ISYnCewn5XViXJQqb2ikrzM9eNNpCXCz++O 8L+qCBLAQCZ1kPbv/W9ouT+s Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 19 Jun 2019 10:13:24 -0700 IronPort-SDR: Qcd3GWDurLD8gepWwSeMYauJXGJmFVFAOOi5aFUMpw4y+HqS37JtcAEIlyqYwdat0KB0noWJp/ cbouGxYfRY1UU0qoYRulzNpOXGAIKx96JwzqP7ZPO5JnKK3tkyqcZd9NgVPNYLsuIJhhU0GkIv wc54tg9/WgCFtz3XRkjcWila565O33Enn20V/4YUusaGn6fwWTd0LqQB81tiuxMHVXmUV/SriX iercuUaffG4rr4s5k6ct+QzcxCfPVpNErnh2bVWDXW2+06Rpu7/YJO6EnqbW9XfV2Sbi8JReF8 68Q= Received: from cmercuryqemu.hgst.com ([10.202.65.32]) by uls-op-cesaip01.wdc.com with ESMTP; 19 Jun 2019 10:13:57 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: jaegeuk@kernel.org, yuchao0@huawei.com, bvanassche@acm.org, Chaitanya Kulkarni Subject: [PATCH V4 3/5] block: use blk_op_str() in blk-mq-debugfs.c Date: Wed, 19 Jun 2019 10:13:00 -0700 Message-Id: <20190619171302.10146-4-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190619171302.10146-1-chaitanya.kulkarni@wdc.com> References: <20190619171302.10146-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 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 Now that we've a helper function blk_op_str() to convert the REQ_OP_XXX to string XXX, adjust the code to use that. Get rid of the duplicate array op_name which is now present in the blk-core.c which we renamed it to "blk_op_name" and open coding in the blk-mq-debugfs.c. Signed-off-by: Chaitanya Kulkarni Reviewed-by: Bart Van Assche --- block/blk-mq-debugfs.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index f0550be60824..68b602d4d1b8 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -261,23 +261,6 @@ static int hctx_flags_show(void *data, struct seq_file *m) return 0; } -#define REQ_OP_NAME(name) [REQ_OP_##name] = #name -static const char *const op_name[] = { - REQ_OP_NAME(READ), - REQ_OP_NAME(WRITE), - REQ_OP_NAME(FLUSH), - REQ_OP_NAME(DISCARD), - REQ_OP_NAME(SECURE_ERASE), - REQ_OP_NAME(ZONE_RESET), - REQ_OP_NAME(WRITE_SAME), - REQ_OP_NAME(WRITE_ZEROES), - REQ_OP_NAME(SCSI_IN), - REQ_OP_NAME(SCSI_OUT), - REQ_OP_NAME(DRV_IN), - REQ_OP_NAME(DRV_OUT), -}; -#undef REQ_OP_NAME - #define CMD_FLAG_NAME(name) [__REQ_##name] = #name static const char *const cmd_flag_name[] = { CMD_FLAG_NAME(FAILFAST_DEV), @@ -342,12 +325,13 @@ 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; const unsigned int op = rq->cmd_flags & REQ_OP_MASK; + const char *op_str = blk_op_str(op); seq_printf(m, "%p {.op=", rq); - if (op < ARRAY_SIZE(op_name) && op_name[op]) - seq_printf(m, "%s", op_name[op]); - else + if (strcmp(op_str, "UNKNOWN") == 0) seq_printf(m, "%d", op); + else + seq_printf(m, "%s", op_str); seq_puts(m, ", .cmd_flags="); blk_flags_show(m, rq->cmd_flags & ~REQ_OP_MASK, cmd_flag_name, ARRAY_SIZE(cmd_flag_name)); From patchwork Wed Jun 19 17:13:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11004823 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E65C914E5 for ; Wed, 19 Jun 2019 17:14:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D57AD232A7 for ; Wed, 19 Jun 2019 17:14:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C97C0285FB; Wed, 19 Jun 2019 17:14:20 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 785D928329 for ; Wed, 19 Jun 2019 17:14:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730120AbfFSROU (ORCPT ); Wed, 19 Jun 2019 13:14:20 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:54057 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726259AbfFSROT (ORCPT ); Wed, 19 Jun 2019 13:14:19 -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=1560964460; x=1592500460; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Bgxxsw+aFjGTScDcN8vsmnNC5VW5TuLIHgjRPRtB3ws=; b=J4iaOaZuhUHjHmmYVdwsfF/fo5vAXXYwTNVh6xfMTIk4Gf/nW4c0k9Wf RekREBoovYd0l1pVbn/FLtHxgjlAQ4+4AiCTI5aUyaYr/uz+KyB5EEIAz 0KHLlX8KsLFlTj+1thKLqd6EBKKbB9cmuBJZZlPZFAxx5y7dsO6bjPH5R YLcngVPLNw6t02WKB1WoSaZej/Gt0WU2tSNUakszms7o1EDtrBy8k53q5 lzK1JYmXCyCyyXx3wujwfMLrDDjVnA/p/gd+RZcjDtFoGylytSfmKp596 /4pN2bXxWDuqU2WNVdDYwj0kGY8l00jbcHmYnBD+8inG4t3Zyz/ekbNoX Q==; X-IronPort-AV: E=Sophos;i="5.63,393,1557158400"; d="scan'208";a="112626239" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 20 Jun 2019 01:14:11 +0800 IronPort-SDR: ZqjiRYSJDsrosT+vQ3FXuX71jIgY8DLlBS6M3dJErAM77wsTkt3WkXhuZyeTHUa5gX9grpBXfM d9bETiSc1+Va+MZBqghxCLvVGTkCqtjnyCLS7skk3rK8gKApFOl2g2DC2atIrzoIWbFVCt0dNk p8kjWPTjUZLKc2+OlX8+81gDuhlE4uqHeVXwMaxZ/r6gWZNrTrtbpoVSh+9wTivgmQxOZvJG+o ypUQMtcttwCQ5rk6Q9f9nRbv0L7l6lhVVgP5GYaCG6IsO3sT63ndHqG90/WqNEUSKSDB7bJeoc jNArhPJCALn+ZdWdCJ2oRgKM Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 19 Jun 2019 10:13:37 -0700 IronPort-SDR: IELUmEi5mJN/v/Lfw+gFwLw2/E+xFkfc0jGIr32gFGknQ+PkTC045pLO2LoD6E+2z8NZqjjdz3 U18fcEjJzDpewQ8JJ2rUJ54XRxVkB0rviMMVMlMiHkLFCfr2CCMt8iP76IkqLYr6G36AAVwVrA 5tQFl3a3ECQd5J1cDmJ4uQU0eLhRejfy9i0C+p9YTxhqWILilXboLeoecsb+iQT7x2i1k52NJR WsXNMbIyz9NMCK7LVeUmskhKjigsWDboNOpPmcV7UrErM6Y3GZf20P87vjUXdjkeGY3Wwda28D lUA= Received: from cmercuryqemu.hgst.com ([10.202.65.32]) by uls-op-cesaip01.wdc.com with ESMTP; 19 Jun 2019 10:14:10 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: jaegeuk@kernel.org, yuchao0@huawei.com, bvanassche@acm.org, Chaitanya Kulkarni Subject: [PATCH V4 4/5] block: update print_req_error() Date: Wed, 19 Jun 2019 10:13:01 -0700 Message-Id: <20190619171302.10146-5-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190619171302.10146-1-chaitanya.kulkarni@wdc.com> References: <20190619171302.10146-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 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 Improve the print_req_error with additional request fields which are helpful for debugging. Use newly introduced blk_op_str() to print the REQ_OP_XXX in the string format. Signed-off-by: Chaitanya Kulkarni --- block/blk-core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index c92b5a16a27a..88a716c3dc56 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -212,11 +212,14 @@ static void print_req_error(struct request *req, blk_status_t status, return; printk_ratelimited(KERN_ERR - "%s: %s error, dev %s, sector %llu op 0x%x flags 0x%x\n", + "%s: %s error, dev %s, sector %llu op 0x%x:(%s) flags 0x%x " + "phys_seg %u prio class %u\n", caller, blk_errors[idx].name, - req->rq_disk ? req->rq_disk->disk_name : "?", - blk_rq_pos(req), req_op(req), - req->cmd_flags & ~REQ_OP_MASK); + req->rq_disk ? req->rq_disk->disk_name : "?", + blk_rq_pos(req), req_op(req), blk_op_str(req_op(req)), + req->cmd_flags & ~REQ_OP_MASK, + req->nr_phys_segments, + IOPRIO_PRIO_CLASS(req->ioprio)); } static void req_bio_endio(struct request *rq, struct bio *bio, From patchwork Wed Jun 19 17:13:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11004825 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7F7BC1580 for ; Wed, 19 Jun 2019 17:14:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6ED5F28329 for ; Wed, 19 Jun 2019 17:14:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 632CB284A5; Wed, 19 Jun 2019 17:14:21 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 13808285FB for ; Wed, 19 Jun 2019 17:14:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726259AbfFSROU (ORCPT ); Wed, 19 Jun 2019 13:14:20 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:54057 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726689AbfFSROU (ORCPT ); Wed, 19 Jun 2019 13:14:20 -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=1560964460; x=1592500460; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XLB4y84qryt/o20ieADyCTLritHYsqyXsy9EGUzPvOM=; b=qb0n4oIPUSXw3kdzduOtSlNA8vkhyZhIDvMgpnLMPO4jlgRLgEYAM5WZ eaQL5U0kwA+dQTuWDaLW0/Hct/FIWDCjJigF5EwiS3OzL6Il0MFDJeD/S vzQdGiDFfJ/ILvKWhznVw0Zbq8TizFRlcwv5noFgv7TOm6W2ASSb45HLY rKihYR3dXAVHRh+O0C1Kn3gr1v0A/y9FdQw4Lcd+Yo1myvx8lHsvY4dbr xcgitvbY/wD1VdkFzYbuXKAlrRacxIveQtm+IZ8l5EHekyxCMep3QEd8H TXhl+SRYaQOrf3CLxbQrpmwJGAD/ZM9jaDG8vXS+nw7vNcMUOjlMecd97 Q==; X-IronPort-AV: E=Sophos;i="5.63,393,1557158400"; d="scan'208";a="112626244" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 20 Jun 2019 01:14:13 +0800 IronPort-SDR: JIjV6l0EHwshiffDgjMw4lNng9phxM0zbIlFIiU0D89QgeVOJxru5wvBDW5a5d3rekvjDyeD1j rmjgXEXv8Cvq4cVcBNXyOI/DxhyuyUDYXp5xHf6e/ETHBz7QXQWtDE6qiOorvIq2YYLk3wzMPR Q3nMJHIVkTiaEfCezk5ClzoTJ/jErjmyvInG76ku/74L25PXXfzAKu2Pwe8Wf+DW5FSVHeir04 F4ojaSJd2qsj8H1cfiG/VTwCYC0LN8JgExQVH7tSiNbAou9mX4MlKVPEf5AoplNDeA3Q1wANqd 41hIWNZ76XIF53jZVt5jWrlT Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 19 Jun 2019 10:13:40 -0700 IronPort-SDR: WmCIhKe3cHrGVnQij00xHiHtMNyPABlnUanPbIZNs4dfmUvpoGCSoWLhN+ueDPU9O7qHHkJFdO t1uhZZsYaXEKPwlN9bbLnytCsH8ObyzSDdfLfFdhjycapoDoLLjebuVExacw02BaADFv3Rgldq aEaX/kx/WTOeCw3HgyVi24XQDFVIkSSKIVvySjRcErDpKQm0JY8ZVrmLP+XE9uca5M+0mXOTii SQIs+suNPSz3qSb1tebCHAOK/uVRBpsfcCp/0n8WhVwmqnlBuNpVr2YKBJL+Jphgnu3Vxq2rsX gig= Received: from cmercuryqemu.hgst.com ([10.202.65.32]) by uls-op-cesaip01.wdc.com with ESMTP; 19 Jun 2019 10:14:12 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: jaegeuk@kernel.org, yuchao0@huawei.com, bvanassche@acm.org, Chaitanya Kulkarni Subject: [PATCH V4 5/5] f2fs: use block layer helper for show_bio_op macro Date: Wed, 19 Jun 2019 10:13:02 -0700 Message-Id: <20190619171302.10146-6-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190619171302.10146-1-chaitanya.kulkarni@wdc.com> References: <20190619171302.10146-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 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 Adjust the f2fs tracing code to use newly introduced block layer function blk_op_str() which converts the REQ_OP_XXX into the string XXX. Signed-off-by: Chaitanya Kulkarni Reviewed-by: Chao Yu --- include/trace/events/f2fs.h | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 53b96f12300c..e3dc031af7f5 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -76,16 +76,7 @@ TRACE_DEFINE_ENUM(CP_TRIMMED); #define show_bio_type(op,op_flags) show_bio_op(op), \ show_bio_op_flags(op_flags) -#define show_bio_op(op) \ - __print_symbolic(op, \ - { REQ_OP_READ, "READ" }, \ - { REQ_OP_WRITE, "WRITE" }, \ - { REQ_OP_FLUSH, "FLUSH" }, \ - { REQ_OP_DISCARD, "DISCARD" }, \ - { REQ_OP_SECURE_ERASE, "SECURE_ERASE" }, \ - { REQ_OP_ZONE_RESET, "ZONE_RESET" }, \ - { REQ_OP_WRITE_SAME, "WRITE_SAME" }, \ - { REQ_OP_WRITE_ZEROES, "WRITE_ZEROES" }) +#define show_bio_op(op) blk_op_str(op) #define show_bio_op_flags(flags) \ __print_flags(F2FS_BIO_FLAG_MASK(flags), "|", \