From patchwork Thu Jun 20 17:59:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11007573 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 650206C5 for ; Thu, 20 Jun 2019 17:59:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 563DC287E7 for ; Thu, 20 Jun 2019 17:59:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 471A028807; Thu, 20 Jun 2019 17:59:42 +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 D7177287E7 for ; Thu, 20 Jun 2019 17:59:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726551AbfFTR7k (ORCPT ); Thu, 20 Jun 2019 13:59:40 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:35454 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725903AbfFTR7j (ORCPT ); Thu, 20 Jun 2019 13:59:39 -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=1561053579; x=1592589579; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OrB3YKVsrL+G1BGsVU/QjCU+rmzvRnTbUqTJjO4JYIw=; b=dB8g6H8gSHHy9RLrdH+xXs1hLD7mDQrRtFtXQ4tKXwWaqwqW3uFxfMoB FUdYX2uRl4/1QM7Wti/Ufex8I1xsmgl/BibqFEZQx9GSLGbHrdo/uiDRw c+7zv6ZRfipp9uBNP7dsz53gfmV9ahno/UaWTcEDnwjFA0cFT8MnAxJmj Qfc4g4iywYHgb9yMJAfWaLA21V1OirmeHgmlIOutSXWK0MHvCn30Dy/md EwBns93JN96TzST+e8k5Y8ceUkguYBar1GH8deXebPdlZeH/VkezTjmR6 vxorsfuPBvCtW7GcNFxHHNrwjhWO5R5VKknbsw5JDtX69niTzAci5Sj1z A==; X-IronPort-AV: E=Sophos;i="5.63,397,1557158400"; d="scan'208";a="217443480" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 21 Jun 2019 01:59:38 +0800 IronPort-SDR: 5t5b4NUF9T9HCw8ZKnkKLGoi4NGQVjn7AcztR+GMii3mc6+uv8vWy2SLGImutixnrF9wz+ohOn GVNuok/iJqRjP3/72ZxC9XyjGrc9mDSUVeCdHdqfiUDY2m8BLWwdQEBq6ft+Qy7J0DGbLBCfwp Na8cxXUUVEwCbvUyoRIX1pH6NU/t/NwH6hCJj4NnoujCyoSzQIlpDoiLajZwRH9qpELdJwZpn6 a8ggPOf6b7bRU7inlD8spefhX9JLBM52oi54hs+StUmoVeG4F2pksNV2Th04i4lcnQ8Q2leV45 h2RNgSMdNCZEcQVBuhy7l9It Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 20 Jun 2019 10:58:57 -0700 IronPort-SDR: WwES0NvG1XRHFGCm+XhXp4gtzggHobHl/+azZvypmQNbabtP2HIE1cQyOc5bTgzSMIigTFpgmR spHy7GKQRDSfxx2RJkWV/LQwZSCaV7YAtsQ9Dk1kAKi3witXs6JARMI/4/njpwEoFnO95340Ci g1T25aJ7Idh4Fa3tvS2B3/SkPQlGrDyjraWqaiNi7vJrQ9HZW8LWF3qHjxttEClJbypcoyMz4L lPPCajoa92ZYU9DY09HZSNgPENd7UJjWzl6yJPVagNGpmg3nHJnPNZevF/plt1bmgsoaxqLX4X Ew0= Received: from cmercuryqemu.hgst.com ([10.202.65.32]) by uls-op-cesaip01.wdc.com with ESMTP; 20 Jun 2019 10:59:38 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: axboe@kernel.dk, Chaitanya Kulkarni Subject: [PATCH V5 1/5] block: improve print_req_error Date: Thu, 20 Jun 2019 10:59:15 -0700 Message-Id: <20190620175919.3273-2-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190620175919.3273-1-chaitanya.kulkarni@wdc.com> References: <20190620175919.3273-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: Bart Van Assche Reviewed-by: Hannes Reinecke Signed-off-by: Christoph Hellwig Signed-off-by: Chaitanya Kulkarni --- 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 94c6520bc786..77623cdf2e5a 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 Thu Jun 20 17:59:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11007643 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 8F43C76 for ; Thu, 20 Jun 2019 18:31:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8269E271CB for ; Thu, 20 Jun 2019 18:31:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73F082887A; Thu, 20 Jun 2019 18:31:33 +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 F2AB5271CB for ; Thu, 20 Jun 2019 18:31:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726509AbfFTSb2 (ORCPT ); Thu, 20 Jun 2019 14:31:28 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:35454 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726405AbfFTR7n (ORCPT ); Thu, 20 Jun 2019 13:59:43 -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=1561053583; x=1592589583; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tkfuDcjVsH4cbJnqt6hs3NIgWxeSUr2uI5ZruO+U66k=; b=d3+OplwCcp1mUVOLt8OO5rgih7wXtT4803R17EPoD9dQ2Z3NLbK79Z5Z NFc48Qu/oP8Ybki3IuiYDwLZncxvLt3zLBEkl1OIZEdzNqxcb2luqqoPc H9Yq5r6MFXCEZ/Waa0B/euUmXB9l4qtVjyDVBs16sII7uOIRmUDR8lCgd gvANCOpNZTYF29QI3viDJPO2GTE2LoQ91LkB2C4pn30SikaFieL5xygO4 kuwwEmPAb70kSoMAMjS46X9QZ8N/Fnr8FF+/lDg0XGj8SazCy3jdKz2Xa aDWl4a1FjlqLAxFKsYFr7ZoYF/evXKzmGEh4OCZLH8ec6X2gX50MJpvRU w==; X-IronPort-AV: E=Sophos;i="5.63,397,1557158400"; d="scan'208";a="217443483" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 21 Jun 2019 01:59:43 +0800 IronPort-SDR: ZoiLFoQ1pFYKIpQCvJZ0aFAq1G4rw4fK3KLGKtRJgNVGXck2mMyQl55t/9qFOAd8WF2UjoWU7F bEfuJCUuemrlrqhcvDbXb4o/TqCZgMmUmFiW8pauFfhyQtEtp6aqvQoWNqxDSDMSYJdR55KG/O 4tdaunFXwGABZxRB1EO00ZWyZEjPYEFsX8/5mwZbAb5SvZSNb7ktR5JdsigTRBJolv8BY5XuLW fgHPoHG8D1UXkRFu49LCxmFO2fuAZ1D3Cc9jMkcpS52Qm0XpcGV6INvRinkluRJoW7LSixhpb4 QkLE2V9uZ/babzdoUkclXtEN Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 20 Jun 2019 10:59:02 -0700 IronPort-SDR: zgsjiC+jNLq1dOi6AKdwpoIw3ZLFaOSxD9AqhttKGLTEKTxF1XINcU+Njd0zR4o10VmiZSN7zs mI4rWAB5ucQ5nTAZLQ1u9w4yLO69Ym58IGgNvFRIHI3uOGLNl4X+F6JQDjnK2dztNSFjrqJeUe aWenooipaYQhalSSYtGt8jxrm6vEQiCeq8gDHgKtviI1o95MuLtOSj+KfXoMJ/iKp0bKL7nhoG 3H5l8RB29XmanSMrT9PZvD6os9WqzVnpZl4pdfZ6ebeKgkaBcawzf4sZj9WV4BjjnORSDECiqC CkI= Received: from cmercuryqemu.hgst.com ([10.202.65.32]) by uls-op-cesaip01.wdc.com with ESMTP; 20 Jun 2019 10:59:43 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: axboe@kernel.dk, Chaitanya Kulkarni Subject: [PATCH V5 2/5] block: add centralize REQ_OP_XXX to string helper Date: Thu, 20 Jun 2019 10:59:16 -0700 Message-Id: <20190620175919.3273-3-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190620175919.3273-1-chaitanya.kulkarni@wdc.com> References: <20190620175919.3273-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. Reviewed-by: Bart Van Assche Signed-off-by: Chaitanya Kulkarni Reviewed-by: Hannes Reinecke --- 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 77623cdf2e5a..190aba04da3e 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 ad49a775c54f..7d52c18b6fe2 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 Thu Jun 20 17:59:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11007641 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 03C3D76 for ; Thu, 20 Jun 2019 18:31:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA3C128751 for ; Thu, 20 Jun 2019 18:31:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDAF628893; Thu, 20 Jun 2019 18:31:25 +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 86D9F28751 for ; Thu, 20 Jun 2019 18:31:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726166AbfFTSbY (ORCPT ); Thu, 20 Jun 2019 14:31:24 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:35454 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726707AbfFTR7s (ORCPT ); Thu, 20 Jun 2019 13:59:48 -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=1561053587; x=1592589587; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UIxmCrioBaC0pFlPN4Qnln/402T9GIjVBNu2yOteD8U=; b=T6qqjBc2vM6tfJlve9XT74CeG/j/9pY6dQEGMOPvA4TQ8aOk4e1Ul/3t NBNZnC83ywsBy8si+fYJwQB2iYezN5122w8R7AWzL7cuPYpdKSOxki66s hh3U1wZAO3Ak6vD07smM4q5vHZfU/ScrpwLHgcFtLtXzMxbkYq7WQxDp1 JKTae0Z3o4LUq8LVYXiuMKOR6IFl/WTgZXAsKnRtMGNFMfI/zhDxP8/hq uuxlnNp1F0EcndR50oeLUJALSxVZNiId0HbGroAmYV7fPtAcRETQlH770 CcVP9oCooq64w2JvFf0/u0F5TSPfVimsUs4ssxXMJANgTXRKTnrYjfM6Y A==; X-IronPort-AV: E=Sophos;i="5.63,397,1557158400"; d="scan'208";a="217443489" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 21 Jun 2019 01:59:47 +0800 IronPort-SDR: nSPF8C5eUWn4pXk3tCcmwGgh08LactMcH0T0rE5SgBF/E7m2auJkz/iWq0g1OAZjtzUGoWIibo V3p8oOd1WkqMI7tKz/21nPeNW4CKRpeidsDmjwyvBQyhi8MJ5pHomzPcGr7N/78nhcqAp6B6sH EaZ2xUI5ZnvA7P1V2ZFcAs5WwUq+8Bf17N/n/KwoT0dZomCTFme19iTyk1puC9jGBxxfbPq3VA IdQkRV6Q8wBexNlbpRr0El10q5W3IDWlTzmdrOQg03U9O54IUKNnvCU9V3yuVMunFAa4aahFZS LBE+cSLlL2LxXU3U0b1yDBUd Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 20 Jun 2019 10:59:06 -0700 IronPort-SDR: x0m3rKhsDcOTIcfjBX2a/YGS6Hpmirl8MY5ikoMbHaJA27SSfyyj1+CR6kxIWfQl5EKKdQWJJ2 GdIl+duoKwXIijzVZq0qrYvPZK2lxKL2Y++DF3o5URmJFL43uTUXGPD5a2UQq81cq8Z4PZpj6q zQfHvZFbtHlflh0WVOPFXKDz17f4r5BZE1SDM55U/A7j0TriwBrzWp39kuVfUo8DNpBE8rEzZZ gvV0g3cWBA/OWsUU+Dhz3XUE67rdtljbfTlKxxn4eHH5QTUmE7mnXUPTDK1y5YhAXu1agLwWoD Qcg= Received: from cmercuryqemu.hgst.com ([10.202.65.32]) by uls-op-cesaip01.wdc.com with ESMTP; 20 Jun 2019 10:59:47 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: axboe@kernel.dk, Chaitanya Kulkarni Subject: [PATCH V5 3/5] block: use blk_op_str() in blk-mq-debugfs.c Date: Thu, 20 Jun 2019 10:59:17 -0700 Message-Id: <20190620175919.3273-4-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190620175919.3273-1-chaitanya.kulkarni@wdc.com> References: <20190620175919.3273-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. Reviewed-by: Bart Van Assche Signed-off-by: Chaitanya Kulkarni Reviewed-by: Hannes Reinecke --- 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 a8376cc06a39..748164f4e8b1 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 = req_op(rq); + 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, "%u", 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 Thu Jun 20 17:59:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11007577 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 0C58213AF for ; Thu, 20 Jun 2019 17:59:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2B35287E7 for ; Thu, 20 Jun 2019 17:59:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6A8628807; Thu, 20 Jun 2019 17:59:54 +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 58876287E7 for ; Thu, 20 Jun 2019 17:59:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726027AbfFTR7x (ORCPT ); Thu, 20 Jun 2019 13:59:53 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:35454 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726729AbfFTR7w (ORCPT ); Thu, 20 Jun 2019 13:59: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=1561053592; x=1592589592; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LzGOF2hHrmdE4Fm9O/m8R9d5DTCybctfUkNgYUB0sz0=; b=h1YzAmyWVlsMcrfYGysBMfyiXR2CWCHu6jYhjqSt3WWlbpzJ9gWgVjCc N6V3kWYnoLI//ph1Tl2fGPtpPO8nrYdBn4iW2BAlpxi7VWVpUpg68m1vn jmGG1bccaVAyvlFHz03L1eHIZ43wwqMahGMfajz9Nu6uw5XIPQx82ezg/ /CtENVFZNewax5+QUzB53w14ZuYvD2rXojVnEMIHyVa2qJq2dh+ltitIE QuUf1OZLGEv6TVaW0pOMW5OZ4dOAKpBg1n9i6qmQwTQv6/mLB7ILdydpI luUzVDWvf1O69k/hVH3q7yYYK1zi0xNzFKLUkkbTP5DoD4HLpuMuMMaOu w==; X-IronPort-AV: E=Sophos;i="5.63,397,1557158400"; d="scan'208";a="217443494" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 21 Jun 2019 01:59:51 +0800 IronPort-SDR: vTV0pjortiEvxihMM/f8VsNMFk+ssFBx9xxEAaCinD8CnSXG9jCkpFP02G5al2J9jqU+b0wL9n Fybqba2BcvNiBVgDKUawtxYDgzBq7gU0YbP2b+vaPDQY0Qu8nTcYJxol5esWjbmljInRWEz5QO /G+Ljty10hm8T/VEeSacyxbt/h7QcQ2k+rMyGTRvagj4eMt0NNZsuR/j/q4xxNVYdBwavJ5cDU /rn5Ka5Cms/h/znxJ+PJHgIti/iO3SYawTXqkrcAQ/05Q/2zQcHpnZ68W7QFiH/Zd45YtMAC3z 2DXmAircUfnISc7EJ16lRMYy Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 20 Jun 2019 10:59:11 -0700 IronPort-SDR: JPZCdUNbL6QrcMTJAfhtMrR5zBamamicgH4WSqgED3jPiAd2PKt7bMr642hnz4zQ0LPmIx01qg uJoUrXVkMeYntFMKT0AJSupg7M/VUaWQ7EKp3THXfJNkMSki6ZzsXITTrLMeltOR2W3wKF1zEj w1JQ4bAzolKBYl8QNCxA/vlviHnAGKq+IN7t5X6Bmj3g6yB1WoMlihXldMIcfYwVLgBYts75rM /QVHpZRFBAAhD8L21pF2jYeez6VX19K86baB5xRO55mYzeylSH8FYv2JtozQ619RUWHZ6G8G7X 5s4= Received: from cmercuryqemu.hgst.com ([10.202.65.32]) by uls-op-cesaip01.wdc.com with ESMTP; 20 Jun 2019 10:59:51 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: axboe@kernel.dk, Chaitanya Kulkarni Subject: [PATCH V5 4/5] block: update print_req_error() Date: Thu, 20 Jun 2019 10:59:18 -0700 Message-Id: <20190620175919.3273-5-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190620175919.3273-1-chaitanya.kulkarni@wdc.com> References: <20190620175919.3273-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. Reviewed-by: Chao Yu Signed-off-by: Chaitanya Kulkarni Reviewed-by: Hannes Reinecke --- 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 190aba04da3e..9ec86c111920 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 Thu Jun 20 17:59:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11007639 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 DD2E076 for ; Thu, 20 Jun 2019 18:31:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFBF7271CB for ; Thu, 20 Jun 2019 18:31:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C0B442887A; Thu, 20 Jun 2019 18:31:19 +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 68F3F271CB for ; Thu, 20 Jun 2019 18:31:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726079AbfFTR77 (ORCPT ); Thu, 20 Jun 2019 13:59:59 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:35454 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726731AbfFTR74 (ORCPT ); Thu, 20 Jun 2019 13:59:56 -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=1561053595; x=1592589595; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XLB4y84qryt/o20ieADyCTLritHYsqyXsy9EGUzPvOM=; b=kSu7JUF6rqXRzY5q5QF7WG0Ccy2gUp83Oj+dKBDb1jZDUOpfi+qJOQlD uch+o+vADwdA5spuHHemi8NiOTmCNcd6xzooIeA6I2ls764TE0+viGhPE u8+jW4fo4qcJTLfFVuueuhC/5iaKOEpwZ5BHAYTNyypMz5E5toXkIk6Wh gh1N2p6fWajG//3OeohhZaMa//RMCT91dD0KZkR7jhwUGnIkuHDYv4Qn8 VqZkFFkCx6ykXEFMSSvykXn3LVU2zPQ+XCsfIHmsCFdOsFguykbQa1vNv 60raa/v/mtLJ5EdajV94unkyq9mThDhq7ubW+zhqSG4AFxmB7di5E3SBC A==; X-IronPort-AV: E=Sophos;i="5.63,397,1557158400"; d="scan'208";a="217443502" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 21 Jun 2019 01:59:55 +0800 IronPort-SDR: Wp/kgTa8A2JrMOIE3H1hjCi6a7kblRkECBanUCUdG7mTWkh0wi9aMbMU3uEHmDdw5/3oKlLXzy r4cBdNSOIj0tpCYWs6c3aitoacpi+n1ML8VE8iSa7gc9fYeFpbTr6/4yMLMPsVGEaLeTrHved7 04lYCItSbwBLNeB3vdQbToL38FyXhljbPECrDoWEWea4/9uc/CUq0+1mlb9Qif+zMoGePDer02 WWKkfV6lV3T+TQdvOwroedEMPLr4RKX1uYpvLaow50fxYxP5r4VCHAsygTJlSDn3U2zTaYbsdV Q+0ZTELsjfT1Pc98YIEO1wQJ Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 20 Jun 2019 10:59:14 -0700 IronPort-SDR: hsa7EYi1XKrtVI5ipv9Jli4na7fl+bD6dmsIRcGpP0o9RqcN5SjJ3LCXGdi+ZIme2sDzkmjXCO kGDdhty5f/7NveDvXlXm5PnxmufLwps/hKSCARIQAAUYnImkcQjQhZTaPrhre9V6KpMPw6OnJN wBEHtYS/zYP7qWJAnW61Ck+kfSgdVbAwWyNn/uw+7WL0btrPDRxp07Tfw1y5bx7vKgsxQNT1pU d4zlvIw8xG+tN14bR4E/goebfcOg5SS0eFAMadB0Q2x24RqcE5phkcvGfZaOdDllu3RPH8MMbI xp8= Received: from cmercuryqemu.hgst.com ([10.202.65.32]) by uls-op-cesaip01.wdc.com with ESMTP; 20 Jun 2019 10:59:55 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: axboe@kernel.dk, Chaitanya Kulkarni Subject: [PATCH V5 5/5] f2fs: use block layer helper for show_bio_op macro Date: Thu, 20 Jun 2019 10:59:19 -0700 Message-Id: <20190620175919.3273-6-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190620175919.3273-1-chaitanya.kulkarni@wdc.com> References: <20190620175919.3273-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: Hannes Reinecke --- 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), "|", \