From patchwork Tue Feb 19 00:09:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 10819083 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 4703F6C2 for ; Tue, 19 Feb 2019 00:14:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31D4628518 for ; Tue, 19 Feb 2019 00:14:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 25E6927B13; Tue, 19 Feb 2019 00:14:09 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B260D27B13 for ; Tue, 19 Feb 2019 00:14:08 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 70F8B4E3026; Mon, 18 Feb 2019 16:14:08 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id D7B574E2D19 for ; Mon, 18 Feb 2019 16:14:06 -0800 (PST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 0297CACC1; Tue, 19 Feb 2019 00:14:06 +0000 (UTC) From: NeilBrown To: James Simmons , Andreas Dilger , Oleg Drokin Date: Tue, 19 Feb 2019 11:09:06 +1100 Message-ID: <155053494624.24125.18162964077735119291.stgit@noble.brown> In-Reply-To: <155053473693.24125.6976971762921761309.stgit@noble.brown> References: <155053473693.24125.6976971762921761309.stgit@noble.brown> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [lustre-devel] [PATCH 26/37] lustre: remove libcfs_debug_vmsg2 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 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" X-Virus-Scanned: ClamAV using ClamSMTP Now that libcfs_debug_vmsg2 has no (external) users, we can remove it. It is used to implement libcfs_debug_msg(), so simply move the body of the function (suitably modified) into that one caller. Signed-off-by: NeilBrown Reviewed-by: Andreas Dilger --- .../lustre/include/linux/libcfs/libcfs_debug.h | 5 -- drivers/staging/lustre/lnet/libcfs/tracefile.c | 63 +++++--------------- drivers/staging/lustre/lnet/libcfs/tracefile.h | 2 - 3 files changed, 18 insertions(+), 52 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h index ba5d5ba2dac2..911fd35b81b5 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h @@ -192,11 +192,6 @@ int libcfs_debug_msg(struct libcfs_debug_msg_data *msgdata, const char *format1, ...) __printf(2, 3); -int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata, - const char *format1, - va_list args, const char *format2, ...) - __printf(4, 5); - /* other external symbols that tracefile provides: */ int cfs_trace_copyin_string(char *knl_buffer, int knl_buffer_nob, const char __user *usr_buffer, int usr_buffer_nob); diff --git a/drivers/staging/lustre/lnet/libcfs/tracefile.c b/drivers/staging/lustre/lnet/libcfs/tracefile.c index 40440ce13050..45da892cf276 100644 --- a/drivers/staging/lustre/lnet/libcfs/tracefile.c +++ b/drivers/staging/lustre/lnet/libcfs/tracefile.c @@ -409,22 +409,7 @@ static void cfs_print_to_console(struct ptldebug_header *hdr, int mask, } int libcfs_debug_msg(struct libcfs_debug_msg_data *msgdata, - const char *format, ...) -{ - va_list args; - int rc; - - va_start(args, format); - rc = libcfs_debug_vmsg2(msgdata, format, args, NULL); - va_end(args); - - return rc; -} -EXPORT_SYMBOL(libcfs_debug_msg); - -int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata, - const char *format1, va_list args, - const char *format2, ...) + const char *format, ...) { struct cfs_trace_cpu_data *tcd = NULL; struct ptldebug_header header = { 0 }; @@ -488,7 +473,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata, } string_buf = (char *)page_address(tage->page) + - tage->used + known_size; + tage->used + known_size; max_nob = PAGE_SIZE - tage->used - known_size; if (max_nob <= 0) { @@ -500,22 +485,15 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata, } needed = 0; - if (format1) { - va_copy(ap, args); - needed = vsnprintf(string_buf, max_nob, format1, ap); - va_end(ap); - } - if (format2) { - remain = max_nob - needed; - if (remain < 0) - remain = 0; + remain = max_nob - needed; + if (remain < 0) + remain = 0; - va_start(ap, format2); - needed += vsnprintf(string_buf + needed, remain, - format2, ap); - va_end(ap); - } + va_start(ap, format); + needed += vsnprintf(string_buf + needed, remain, + format, ap); + va_end(ap); if (needed < max_nob) /* well. printing ok.. */ break; @@ -600,22 +578,15 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata, string_buf = cfs_trace_get_console_buffer(); needed = 0; - if (format1) { - va_copy(ap, args); - needed = vsnprintf(string_buf, - CFS_TRACE_CONSOLE_BUFFER_SIZE, - format1, ap); + + remain = CFS_TRACE_CONSOLE_BUFFER_SIZE - needed; + if (remain > 0) { + va_start(ap, format); + needed += vsnprintf(string_buf + needed, remain, + format, ap); va_end(ap); } - if (format2) { - remain = CFS_TRACE_CONSOLE_BUFFER_SIZE - needed; - if (remain > 0) { - va_start(ap, format2); - needed += vsnprintf(string_buf + needed, remain, - format2, ap); - va_end(ap); - } - } + cfs_print_to_console(&header, mask, string_buf, needed, file, msgdata->msg_fn); @@ -639,7 +610,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata, return 0; } -EXPORT_SYMBOL(libcfs_debug_vmsg2); +EXPORT_SYMBOL(libcfs_debug_msg); void cfs_trace_assertion_failed(const char *str, diff --git a/drivers/staging/lustre/lnet/libcfs/tracefile.h b/drivers/staging/lustre/lnet/libcfs/tracefile.h index 71a031d12f42..3a00a6c60653 100644 --- a/drivers/staging/lustre/lnet/libcfs/tracefile.h +++ b/drivers/staging/lustre/lnet/libcfs/tracefile.h @@ -82,7 +82,7 @@ union cfs_trace_data_union { * Even though this structure is meant to be per-CPU, locking * is needed because in some places the data may be accessed * from other CPUs. This lock is directly used in trace_get_tcd - * and trace_put_tcd, which are called in libcfs_debug_vmsg2 and + * and trace_put_tcd, which are called in libcfs_debug_msg and * tcd_for_each_type_lock */ spinlock_t tcd_lock;