From patchwork Tue Jun 11 20:02:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 10988265 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 6E89314BB for ; Tue, 11 Jun 2019 20:02:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60E6228712 for ; Tue, 11 Jun 2019 20:02:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54EF6287CE; Tue, 11 Jun 2019 20:02:30 +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 F1BD428712 for ; Tue, 11 Jun 2019 20:02:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406414AbfFKUC3 (ORCPT ); Tue, 11 Jun 2019 16:02:29 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:61749 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406376AbfFKUC3 (ORCPT ); Tue, 11 Jun 2019 16:02:29 -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=1560283349; x=1591819349; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UE5quU+yrnaZNy1mFLSgOmIVZCbxJ4y+FIX0MCJepmI=; b=YQm4cFGPXai9k/SKkg9iN0k3OBsW+P0hNryEevzyt+2CH2KB1Zg8nqUm 7kPksVjU0R1TNm47/w9KZ1S/rDDAmU8MubtR63/wqrql7caLL3kbHuviR N+VtVQCvMGGLzwU7prOY1GqXo4ePfFA6YvXGJ7fjgKpACCEUn3ypJjvKD sxRlPpFTppRgfeRweBId8KCP2DrLTRvwMEp3R1ekcJkjFmIIwRGR0AIrq n5hVTndd1vLDJ9p01L1ds4/sUo87NfptuJQSMWk1HX+F+Iu1p6lgcuD0s JzOiAU+9nmpp9XtUUFt6l5IjytfvyPcFtmMQ0msZtc4YqoGScOL+X9EhQ Q==; X-IronPort-AV: E=Sophos;i="5.63,362,1557158400"; d="scan'208";a="115255372" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 12 Jun 2019 04:02:16 +0800 IronPort-SDR: zAKMMVRuYQzNofwMrxjaRV3ROAOSCkOm7b5bmiVMW9RuOmM7bxR1XcPbc3TiwtIUM4cGETMh1Y 8tZYrSl6hZ5QdthD+Tu055pUmPoUuInDCpVb2YcQYQB/Q3lU33izAKWYS6TciIiPjIfEz2Cgte SKdzz/a87YZa5OeyBwBdzQU7qe1ft9a+ugxb5oPYNtnYR6aZnwA0n/mO60zlpWfAQS2zYWxHcG 5pOXj4vV0fjP7T3nwEOntxkBgCPbr6i5EvV6z7jqfC51PSHE7pK6FAnRcedR18kpXjK8oaQKjL 3u0h7cu0FvZLmtDuSIl+b1NM Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 11 Jun 2019 12:39:24 -0700 IronPort-SDR: Fs3Xjs7dLJwsPO/QlW4wNRueA94dn+TyQ0mfD+lzS/32RRmtraGQgtg9hjjPe09B2XEVqj6ku8 l6AOaa3tEVURhFXFA+DRiF67lSLP8d3QXeGBuRl9vTuDn2+PumsHqTUHqRPCTIGa2qlRVKXL8D T8LPjJ4Epy1CzxMcjuhDx7UFCpdmWL+PDrX+HuYOAqhgEXasNObukGa6+9MKnrUy0NDUe0ImDF 8mPJL/IiiWpkpBsAVbMSNl4bY4tl2b8GjAGzNO/urUWVQqPdRsx9szBX05a8krxQDFzWE2vEP1 XDk= Received: from cmercuryqemu.hgst.com ([10.202.65.32]) by uls-op-cesaip02.wdc.com with ESMTP; 11 Jun 2019 13:02:16 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: hch@lst.de, hare@suse.com, Chaitanya Kulkarni Subject: [PATCH 1/2] block: improve print_req_error Date: Tue, 11 Jun 2019 13:02:09 -0700 Message-Id: <20190611200210.4819-2-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190611200210.4819-1-chaitanya.kulkarni@wdc.com> References: <20190611200210.4819-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. Signed-off-by: Chaitanya Kulkarni Reviewed-by: Hannes Reinecke --- 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 ee1b35fe8572..d1a227cfb72e 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, @@ -1360,7 +1362,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 Tue Jun 11 20:02:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 10988267 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 AC7C018A6 for ; Tue, 11 Jun 2019 20:02:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B4E928712 for ; Tue, 11 Jun 2019 20:02:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F9F9287CD; Tue, 11 Jun 2019 20:02:30 +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 32B7C287CC for ; Tue, 11 Jun 2019 20:02:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406376AbfFKUC3 (ORCPT ); Tue, 11 Jun 2019 16:02:29 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:61749 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406413AbfFKUC3 (ORCPT ); Tue, 11 Jun 2019 16:02:29 -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=1560283350; x=1591819350; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xi7RDZ3LPqv+mzotThtUQvsKQ9oEmzNEqwsBGEsKs/I=; b=qaVOytcqM0PaXvJbohXutVBSwE+KnNQ8/c3m5ffm9xvdZ1DAls1tCzco m8zLSBFPKBjJpYJn+nVX3IV5mv/zIozIHYTqeiscI5/P7Cw+x+R5q3anS WqJq8+gOqjHH0Zm0O7pJZqAbAjWu6DhEzN2jlWfpNJ7Y0BLgPnOh7JCgp zdKOtvZmoxUGt0mVKi3S4mWw5g/cU3zrkD6XLXd0/rmB4dDvzCsJkrY9L c6XT7nrrP2WWN5uUer0fdk3uT0uoDTST+U5Lx0Cj39ox3YQ7PAAgDLRkc 11NTU+hrSQrm0SCUyOQDuyYsKRocWgPaiJHof86sMgSTPa/1gT4Psa8QS g==; X-IronPort-AV: E=Sophos;i="5.63,362,1557158400"; d="scan'208";a="115255373" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 12 Jun 2019 04:02:18 +0800 IronPort-SDR: zhmCi0fNbQi8iMZKfAOe0IleXouN8fmakNnyoFYm9VYp8kHzA8NrkUa2qgFyL+/o2G+47D2q9N YSRPFZ+f1DRD5MRgSVXCv9jmQ7WlwenVzvJ3W3fr8vVfPVsTmZHj3Q8IFCQysNJQ8q1hCbXiTR os3Na2ufvAkQIPs41nnsLcheLfp9AwljduIpZSMSBPxlfqbNrP1afaSb+P7Npvi3P1eUSdFVXJ MZz9SbLLPZPla6qirdSfYbDBqjVqZmOhxBVWScqOWN3hOnzZqCqydBvmbsnbEZQDMdZBpegAoo kfIyCqAybeLCnvh6T4rw02Ry Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 11 Jun 2019 12:39:26 -0700 IronPort-SDR: 0gtUBqb/+z2pzCRKG+6MUymMi83TN7iqOd4q7fff3bIUU1+thJ3WW+0OSEhB/t0kiCVgQdnlSS /oNV+7AJauJ+9hM873UggPDe9dQV+ZLv2GEKoerNHQ8T3El/bk5n9bVMfyrV/XUHqxxZi4vIGL dtJQn7tITwA8XsKH+Lmn71fwZybTOZcHraGjwZjg+NGh/W5zbTqsxz4Gu0g7i7+wBcagjQQ+q/ DHihw3a2QpF9fM/h6B9ArGBveeG7YGbvP5PBSS5O83Es7xHDPiDYqopgnSKSB/E4SKKQTJnKIW JMw= Received: from cmercuryqemu.hgst.com ([10.202.65.32]) by uls-op-cesaip02.wdc.com with ESMTP; 11 Jun 2019 13:02:18 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: hch@lst.de, hare@suse.com, Chaitanya Kulkarni Subject: [PATCH 2/2] block: add more debug data to print_req_err Date: Tue, 11 Jun 2019 13:02:10 -0700 Message-Id: <20190611200210.4819-3-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190611200210.4819-1-chaitanya.kulkarni@wdc.com> References: <20190611200210.4819-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 This patch adds more debug data on the top of the existing print_req_error() where we enhance the print message with the printing request operations in string format and other request fields. Signed-off-by: Chaitanya Kulkarni --- block/blk-core.c | 57 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index d1a227cfb72e..659e5ea6f6c9 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -167,6 +167,54 @@ int blk_status_to_errno(blk_status_t status) } EXPORT_SYMBOL_GPL(blk_status_to_errno); +static inline const char *req_op_str(struct request *req) +{ + char *ret; + + switch (req_op(req)) { + case REQ_OP_READ: + ret = "read"; + break; + case REQ_OP_WRITE: + ret = "write"; + break; + case REQ_OP_FLUSH: + ret = "flush"; + break; + case REQ_OP_DISCARD: + ret = "discard"; + break; + case REQ_OP_SECURE_ERASE: + ret = "secure_erase"; + break; + case REQ_OP_ZONE_RESET: + ret = "zone_reset"; + break; + case REQ_OP_WRITE_SAME: + ret = "write_same"; + break; + case REQ_OP_WRITE_ZEROES: + ret = "write_zeroes"; + break; + case REQ_OP_SCSI_IN: + ret = "scsi_in"; + break; + case REQ_OP_SCSI_OUT: + ret = "scsi_out"; + break; + case REQ_OP_DRV_IN: + ret = "drv_in"; + break; + case REQ_OP_DRV_OUT: + ret = "drv_out"; + break; + default: + ret = "unknown"; + } + + return ret; +} + static void print_req_error(struct request *req, blk_status_t status, const char *caller) { @@ -176,11 +224,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); + blk_rq_pos(req), req_op(req), req_op_str(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,