From patchwork Thu Feb 27 21:17:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11410839 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 514401580 for ; Thu, 27 Feb 2020 21:48:03 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 39B9524690 for ; Thu, 27 Feb 2020 21:48:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 39B9524690 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 3CA5A34B583; Thu, 27 Feb 2020 13:38:13 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id C02F6348A1F for ; Thu, 27 Feb 2020 13:21:28 -0800 (PST) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 6D4D9A15C; Thu, 27 Feb 2020 16:18:20 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 6C0E946C; Thu, 27 Feb 2020 16:18:20 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 27 Feb 2020 16:17:57 -0500 Message-Id: <1582838290-17243-610-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> References: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 609/622] lnet: libcfs: Cleanup use of bare printk X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Shaun Tancheff Some users of printk( "fmt" can be converted to pr_level("fmt" equivalents WC-bug-id: https://jira.whamcloud.com/browse/LU-12861 Lustre-commit: b4c8a5180dec ("LU-12861 libcfs: Cleanup use of bare printk") Signed-off-by: Shaun Tancheff Reviewed-on: https://review.whamcloud.com/37046 Reviewed-by: Ben Evans Reviewed-by: Petros Koutoupis Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- net/lnet/libcfs/debug.c | 2 +- net/lnet/libcfs/module.c | 4 ++-- net/lnet/libcfs/tracefile.c | 43 +++++++++++++++++++++++++------------------ 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/net/lnet/libcfs/debug.c b/net/lnet/libcfs/debug.c index c6b92df..d7747e7 100644 --- a/net/lnet/libcfs/debug.c +++ b/net/lnet/libcfs/debug.c @@ -418,7 +418,7 @@ void libcfs_debug_dumplog(void) "libcfs_debug_dumper"); set_current_state(TASK_INTERRUPTIBLE); if (IS_ERR(dumper)) - pr_err("LustreError: cannot start log dump thread: %ld\n", + pr_err("LustreError: cannot start log dump thread: rc = %ld\n", PTR_ERR(dumper)); else schedule(); diff --git a/net/lnet/libcfs/module.c b/net/lnet/libcfs/module.c index 20d4302..a53efcc 100644 --- a/net/lnet/libcfs/module.c +++ b/net/lnet/libcfs/module.c @@ -720,7 +720,7 @@ int libcfs_setup(void) rc = libcfs_debug_init(5 * 1024 * 1024); if (rc < 0) { - pr_err("LustreError: libcfs_debug_init: %d\n", rc); + pr_err("LustreError: libcfs_debug_init: rc = %d\n", rc); goto err; } @@ -794,7 +794,7 @@ static void libcfs_exit(void) /* the below message is checked in test-framework.sh check_mem_leak() */ rc = libcfs_debug_cleanup(); if (rc) - pr_err("LustreError: libcfs_debug_cleanup: %d\n", rc); + pr_err("LustreError: libcfs_debug_cleanup: rc = %d\n", rc); } MODULE_AUTHOR("OpenSFS, Inc. "); diff --git a/net/lnet/libcfs/tracefile.c b/net/lnet/libcfs/tracefile.c index bda3523..1eb5397 100644 --- a/net/lnet/libcfs/tracefile.c +++ b/net/lnet/libcfs/tracefile.c @@ -332,7 +332,8 @@ static struct cfs_trace_page *cfs_trace_get_tage(struct cfs_trace_cpu_data *tcd, * from here: this will lead to infinite recursion. */ if (len > PAGE_SIZE) { - pr_err("cowardly refusing to write %lu bytes in a page\n", len); + pr_err("LustreError: cowardly refusing to write %lu bytes in a page\n", + len); return NULL; } @@ -477,7 +478,8 @@ int libcfs_debug_msg(struct libcfs_debug_msg_data *msgdata, max_nob = PAGE_SIZE - tage->used - known_size; if (max_nob <= 0) { - pr_emerg("negative max_nob: %d\n", max_nob); + pr_emerg("LustreError: negative max_nob: %d\n", + max_nob); mask |= D_ERROR; cfs_trace_put_tcd(tcd); tcd = NULL; @@ -499,10 +501,15 @@ int libcfs_debug_msg(struct libcfs_debug_msg_data *msgdata, break; } - if (*(string_buf + needed - 1) != '\n') - pr_info("format at %s:%d:%s doesn't end in newline\n", file, - msgdata->msg_line, msgdata->msg_fn); - + if (*(string_buf + needed - 1) != '\n') { + pr_info("Lustre: format at %s:%d:%s doesn't end in newline\n", + file, msgdata->msg_line, msgdata->msg_fn); + } else if (mask & D_TTY) { + /* TTY needs '\r\n' to move carriage to leftmost position */ + if (needed < 2 || *(string_buf + needed - 2) != '\r') + pr_info("Lustre: format at %s:%d:%s doesn't end in '\\r\\n'\n", + file, msgdata->msg_line, msgdata->msg_fn); + } header.ph_len = known_size + needed; debug_buf = (char *)page_address(tage->page) + tage->used; @@ -816,7 +823,7 @@ int cfs_tracefile_dump_all_pages(char *filename) if (IS_ERR(filp)) { rc = PTR_ERR(filp); filp = NULL; - pr_err("LustreError: can't open %s for dump: rc %d\n", + pr_err("LustreError: can't open %s for dump: rc = %d\n", filename, rc); goto out; } @@ -839,8 +846,8 @@ int cfs_tracefile_dump_all_pages(char *filename) kunmap(tage->page); if (rc != (int)tage->used) { - pr_warn("wanted to write %u but wrote %d\n", tage->used, - rc); + pr_warn("Lustre: wanted to write %u but wrote %d\n", + tage->used, rc); put_pages_back(&pc); __LASSERT(list_empty(&pc.pc_pages)); break; @@ -851,7 +858,7 @@ int cfs_tracefile_dump_all_pages(char *filename) rc = vfs_fsync(filp, 1); if (rc) - pr_err("sync returns %d\n", rc); + pr_err("LustreError: sync returns: rc = %d\n", rc); close: filp_close(filp, NULL); out: @@ -985,7 +992,7 @@ int cfs_trace_daemon_command(char *str) } else { strcpy(cfs_tracefile, str); - pr_info("debug daemon will attempt to start writing to %s (%lukB max)\n", + pr_info("Lustre: debug daemon will attempt to start writing to %s (%lukB max)\n", cfs_tracefile, (long)(cfs_tracefile_size >> 10)); @@ -1100,8 +1107,8 @@ static int tracefiled(void *arg) if (IS_ERR(filp)) { rc = PTR_ERR(filp); filp = NULL; - pr_warn("couldn't open %s: %d\n", cfs_tracefile, - rc); + pr_warn("Lustre: couldn't open %s: rc = %d\n", + cfs_tracefile, rc); } } up_read(&cfs_tracefile_sem); @@ -1126,7 +1133,7 @@ static int tracefiled(void *arg) kunmap(tage->page); if (rc != (int)tage->used) { - pr_warn("wanted to write %u but wrote %d\n", + pr_warn("Lustre: wanted to write %u but wrote %d\n", tage->used, rc); put_pages_back(&pc); __LASSERT(list_empty(&pc.pc_pages)); @@ -1139,8 +1146,8 @@ static int tracefiled(void *arg) if (!list_empty(&pc.pc_pages)) { int i; - pr_alert("trace pages aren't empty\n"); - pr_err("total cpus(%d): ", num_possible_cpus()); + pr_alert("Lustre: trace pages aren't empty\n"); + pr_err("Lustre: total cpus(%d): ", num_possible_cpus()); for (i = 0; i < num_possible_cpus(); i++) if (cpu_online(i)) pr_cont("%d(on) ", i); @@ -1151,9 +1158,9 @@ static int tracefiled(void *arg) i = 0; list_for_each_entry_safe(tage, tmp, &pc.pc_pages, linkage) - pr_err("page %d belongs to cpu %d\n", + pr_err("Lustre: page %d belongs to cpu %d\n", ++i, tage->cpu); - pr_err("There are %d pages unwritten\n", i); + pr_err("Lustre: There are %d pages unwritten\n", i); } __LASSERT(list_empty(&pc.pc_pages)); end_loop: