From patchwork Tue Jul 31 06:27:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 10550135 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 CEFAA139A for ; Tue, 31 Jul 2018 06:27:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC3CE29FF4 for ; Tue, 31 Jul 2018 06:27:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FD3C2A0A5; Tue, 31 Jul 2018 06:27:29 +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.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, T_DKIM_INVALID,T_TVD_MIME_EPI 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 364D629FF4 for ; Tue, 31 Jul 2018 06:27:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727435AbeGaIGI (ORCPT ); Tue, 31 Jul 2018 04:06:08 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:40284 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727409AbeGaIGI (ORCPT ); Tue, 31 Jul 2018 04:06:08 -0400 Received: by mail-pf1-f193.google.com with SMTP id e13-v6so5646870pff.7 for ; Mon, 30 Jul 2018 23:27:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=WbWR1A5D0hBlKodEFQkcNy7R0vNIkF4H8UX/8cMojik=; b=dc+dwTw6cGX3DkaCE4NPYtm0MSptjo++jHJZ9YOTO8V9AeH9Se9DB81AMORXVuM280 sPflt1xMlX5lddxzZY9p+QfX9/+3OHion4SBbqDhcoJtDCBnMdn9GjIwwklrEbViiaFO 0HWVN0kr8nyMltuKzeqCYTL/qzEQOWCcemvV0A9dt4zngSTLSM7hUOP+05KxYmtFwTXo PJN2OiUhPlFGOVFplabF0LAPkS9OP6XnG2y+BNS05nqyfZySKlkJyE5oqaGtkmwWHcH4 XJsd4gNBrukOPGAeXhtEpu+irb5vTzTBmqdh1bCsuVvJ6yiybY/89LEKWQEUejbtqT+8 qDdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=WbWR1A5D0hBlKodEFQkcNy7R0vNIkF4H8UX/8cMojik=; b=ZmXKhNFc/n5aFr79crSkpC+eFr9yigYWWapWSH6fOdojWtdC+cOnLWgac359KBao6W zPJ3wT36zgSQRpwPpp1wlXoPvKfGADtTTqhRidNsltMHS8A09NGEH6h1deQk0mPpEeYu pEMBIHqfUoiggNLay3RWDP49i5WnrUlX6HRXM4T62LZpWnfb7TiOT2Xhr+6EqCBatN+L MN9W/tODqC/3AmkMvfof0I1UIAd1CKrunlJgY5ep0C6HYwmtrlbMAmOpIOMEL+9NQLD9 vJLKqgn8cUgPzSUwd9banUB+tpOaHCdQ0twFECiwv+0Tm8zqEZmZXigryHcHQek2O3F/ jiEw== X-Gm-Message-State: AOUpUlGcUXdBSnp6jv+tACgR/MxSKHl8t2TRnypF9/2/i1hdsDo2C9Nm rAxYXaL/JpTKblTHxXPj0I6Wf2cvXrBYqWP8DJPFn1N8 X-Google-Smtp-Source: AAOMgpdTSlq66DezlaNL4sDbuwxtRaP/LlcSTAOVNG0P3ycHppl0p2JQNWGCj4hyab3pGRuxBzVRCNneqEndN2i5tY4= X-Received: by 2002:a62:c505:: with SMTP id j5-v6mr20521323pfg.153.1533018445605; Mon, 30 Jul 2018 23:27:25 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Tue, 31 Jul 2018 01:27:14 -0500 Message-ID: Subject: [PATCH] CONFIG_CIFS_STATS should always be enabled To: CIFS , Pavel Shilovskiy Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From b0c7de68d96ef236b090092124998dad25d8a14d Mon Sep 17 00:00:00 2001 From: Steve French Date: Tue, 31 Jul 2018 01:21:37 -0500 Subject: [PATCH] cifs: simple stats should always be enabled CONFIG_CIFS_STATS should always be enabled as Pavel and others noted. Simple statistics are not a significant performance hit, and removing the ifdef simplifies the code slightly. Signed-off-by: Steve French Reviewed-by: Ronnie Sahlberg --- fs/cifs/Kconfig | 9 +-------- fs/cifs/cifs_debug.c | 6 ------ fs/cifs/cifsglob.h | 10 ---------- fs/cifs/misc.c | 2 -- fs/cifs/smb1ops.c | 4 ---- fs/cifs/smb2ops.c | 4 ---- fs/cifs/smb2pdu.c | 2 -- 7 files changed, 1 insertion(+), 36 deletions(-) From b0c7de68d96ef236b090092124998dad25d8a14d Mon Sep 17 00:00:00 2001 From: Steve French Date: Tue, 31 Jul 2018 01:21:37 -0500 Subject: [PATCH] cifs: simple stats should always be enabled CONFIG_CIFS_STATS should always be enabled as Pavel and others noted. Simple statistics are not a significant performance hit, and removing the ifdef simplifies the code slightly. Signed-off-by: Steve French --- fs/cifs/Kconfig | 9 +-------- fs/cifs/cifs_debug.c | 6 ------ fs/cifs/cifsglob.h | 10 ---------- fs/cifs/misc.c | 2 -- fs/cifs/smb1ops.c | 4 ---- fs/cifs/smb2ops.c | 4 ---- fs/cifs/smb2pdu.c | 2 -- 7 files changed, 1 insertion(+), 36 deletions(-) diff --git a/fs/cifs/Kconfig b/fs/cifs/Kconfig index 63d0d852998a..35c83fe7dba0 100644 --- a/fs/cifs/Kconfig +++ b/fs/cifs/Kconfig @@ -49,16 +49,9 @@ config CIFS If you need to mount to Samba, Azure, Macs or Windows from this machine, say Y. -config CIFS_STATS - bool "CIFS statistics" - depends on CIFS - help - Enabling this option will cause statistics for each server share - mounted by the cifs client to be displayed in /proc/fs/cifs/Stats - config CIFS_STATS2 bool "Extended statistics" - depends on CIFS_STATS + depends on CIFS help Enabling this option will allow more detailed statistics on SMB request timing to be displayed in /proc/fs/cifs/DebugData and also diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c index cb516c950438..3270d9b74603 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c @@ -365,7 +365,6 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) return 0; } -#ifdef CONFIG_CIFS_STATS static ssize_t cifs_stats_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { @@ -481,7 +480,6 @@ static const struct file_operations cifs_stats_proc_fops = { .release = single_release, .write = cifs_stats_proc_write, }; -#endif /* STATS */ #ifdef CONFIG_CIFS_SMB_DIRECT #define PROC_FILE_DEFINE(name) \ @@ -539,9 +537,7 @@ cifs_proc_init(void) proc_create_single("DebugData", 0, proc_fs_cifs, cifs_debug_data_proc_show); -#ifdef CONFIG_CIFS_STATS proc_create("Stats", 0644, proc_fs_cifs, &cifs_stats_proc_fops); -#endif /* STATS */ proc_create("cifsFYI", 0644, proc_fs_cifs, &cifsFYI_proc_fops); proc_create("traceSMB", 0644, proc_fs_cifs, &traceSMB_proc_fops); proc_create("LinuxExtensionsEnabled", 0644, proc_fs_cifs, @@ -579,9 +575,7 @@ cifs_proc_clean(void) remove_proc_entry("DebugData", proc_fs_cifs); remove_proc_entry("cifsFYI", proc_fs_cifs); remove_proc_entry("traceSMB", proc_fs_cifs); -#ifdef CONFIG_CIFS_STATS remove_proc_entry("Stats", proc_fs_cifs); -#endif remove_proc_entry("SecurityFlags", proc_fs_cifs); remove_proc_entry("LinuxExtensionsEnabled", proc_fs_cifs); remove_proc_entry("LookupCacheEnabled", proc_fs_cifs); diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 0e6fd5fa4eb6..4a3a737134ea 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -931,7 +931,6 @@ struct cifs_tcon { __u32 tid; /* The 4 byte tree id */ __u16 Flags; /* optional support bits */ enum statusEnum tidStatus; -#ifdef CONFIG_CIFS_STATS atomic_t num_smbs_sent; union { struct { @@ -965,7 +964,6 @@ struct cifs_tcon { __u64 bytes_read; __u64 bytes_written; spinlock_t stat_lock; /* protects the two fields above */ -#endif /* CONFIG_CIFS_STATS */ FILE_SYSTEM_DEVICE_INFO fsDevInfo; FILE_SYSTEM_ATTRIBUTE_INFO fsAttrInfo; /* ok if fs name truncated */ FILE_SYSTEM_UNIX_INFO fsUnixInfo; @@ -1331,7 +1329,6 @@ convert_delimiter(char *path, char delim) *pos = delim; } -#ifdef CONFIG_CIFS_STATS #define cifs_stats_inc atomic_inc static inline void cifs_stats_bytes_written(struct cifs_tcon *tcon, @@ -1351,13 +1348,6 @@ static inline void cifs_stats_bytes_read(struct cifs_tcon *tcon, tcon->bytes_read += bytes; spin_unlock(&tcon->stat_lock); } -#else - -#define cifs_stats_inc(field) do {} while (0) -#define cifs_stats_bytes_written(tcon, bytes) do {} while (0) -#define cifs_stats_bytes_read(tcon, bytes) do {} while (0) - -#endif /* diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 53e8362cbc4a..dacb2c05674c 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c @@ -122,9 +122,7 @@ tconInfoAlloc(void) mutex_init(&ret_buf->crfid.fid_mutex); ret_buf->crfid.fid = kzalloc(sizeof(struct cifs_fid), GFP_KERNEL); -#ifdef CONFIG_CIFS_STATS spin_lock_init(&ret_buf->stat_lock); -#endif } return ret_buf; } diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 646dcd149de1..378151e09e91 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c @@ -624,7 +624,6 @@ cifs_query_file_info(const unsigned int xid, struct cifs_tcon *tcon, static void cifs_clear_stats(struct cifs_tcon *tcon) { -#ifdef CONFIG_CIFS_STATS atomic_set(&tcon->stats.cifs_stats.num_writes, 0); atomic_set(&tcon->stats.cifs_stats.num_reads, 0); atomic_set(&tcon->stats.cifs_stats.num_flushes, 0); @@ -646,13 +645,11 @@ cifs_clear_stats(struct cifs_tcon *tcon) atomic_set(&tcon->stats.cifs_stats.num_locks, 0); atomic_set(&tcon->stats.cifs_stats.num_acl_get, 0); atomic_set(&tcon->stats.cifs_stats.num_acl_set, 0); -#endif } static void cifs_print_stats(struct seq_file *m, struct cifs_tcon *tcon) { -#ifdef CONFIG_CIFS_STATS seq_printf(m, " Oplocks breaks: %d", atomic_read(&tcon->stats.cifs_stats.num_oplock_brks)); seq_printf(m, "\nReads: %d Bytes: %llu", @@ -684,7 +681,6 @@ cifs_print_stats(struct seq_file *m, struct cifs_tcon *tcon) atomic_read(&tcon->stats.cifs_stats.num_ffirst), atomic_read(&tcon->stats.cifs_stats.num_fnext), atomic_read(&tcon->stats.cifs_stats.num_fclose)); -#endif } static void diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 8929426ddaa6..831249001384 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -900,13 +900,11 @@ smb2_can_echo(struct TCP_Server_Info *server) static void smb2_clear_stats(struct cifs_tcon *tcon) { -#ifdef CONFIG_CIFS_STATS int i; for (i = 0; i < NUMBER_OF_SMB2_COMMANDS; i++) { atomic_set(&tcon->stats.smb2_stats.smb2_com_sent[i], 0); atomic_set(&tcon->stats.smb2_stats.smb2_com_failed[i], 0); } -#endif } static void @@ -945,7 +943,6 @@ smb2_dump_share_caps(struct seq_file *m, struct cifs_tcon *tcon) static void smb2_print_stats(struct seq_file *m, struct cifs_tcon *tcon) { -#ifdef CONFIG_CIFS_STATS atomic_t *sent = tcon->stats.smb2_stats.smb2_com_sent; atomic_t *failed = tcon->stats.smb2_stats.smb2_com_failed; @@ -995,7 +992,6 @@ smb2_print_stats(struct seq_file *m, struct cifs_tcon *tcon) seq_printf(m, "\nOplockBreaks: %d sent %d failed", atomic_read(&sent[SMB2_OPLOCK_BREAK_HE]), atomic_read(&failed[SMB2_OPLOCK_BREAK_HE])); -#endif } static void diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 0b4d7ebb812d..7c0b30321d9a 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -360,10 +360,8 @@ smb2_plain_req_init(__le16 smb2_command, struct cifs_tcon *tcon, total_len); if (tcon != NULL) { -#ifdef CONFIG_CIFS_STATS uint16_t com_code = le16_to_cpu(smb2_command); cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_sent[com_code]); -#endif cifs_stats_inc(&tcon->num_smbs_sent); } -- 2.17.1