Commit fcabb892 authored by Steve French's avatar Steve French
Browse files

cifs: simple stats should always be enabled



CONFIG_CIFS_STATS should always be enabled as Pavel recently
noted.  Simple statistics are not a significant performance hit,
and removing the ifdef simplifies the code slightly.

Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
Reviewed-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
Reviewed-by: default avatarPavel Shilovsky <pshilov@microsoft.com>
parent 9da6ec77
Loading
Loading
Loading
Loading
+1 −8
Original line number Original line Diff line number Diff line
@@ -49,16 +49,9 @@ config CIFS


	  If you need to mount to Samba, Azure, Macs or Windows from this machine, say Y.
	  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
config CIFS_STATS2
	bool "Extended statistics"
	bool "Extended statistics"
	depends on CIFS_STATS
	depends on CIFS
	help
	help
	  Enabling this option will allow more detailed statistics on SMB
	  Enabling this option will allow more detailed statistics on SMB
	  request timing to be displayed in /proc/fs/cifs/DebugData and also
	  request timing to be displayed in /proc/fs/cifs/DebugData and also
+0 −6
Original line number Original line Diff line number Diff line
@@ -365,7 +365,6 @@ skip_rdma:
	return 0;
	return 0;
}
}


#ifdef CONFIG_CIFS_STATS
static ssize_t cifs_stats_proc_write(struct file *file,
static ssize_t cifs_stats_proc_write(struct file *file,
		const char __user *buffer, size_t count, loff_t *ppos)
		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,
	.release	= single_release,
	.write		= cifs_stats_proc_write,
	.write		= cifs_stats_proc_write,
};
};
#endif /* STATS */


#ifdef CONFIG_CIFS_SMB_DIRECT
#ifdef CONFIG_CIFS_SMB_DIRECT
#define PROC_FILE_DEFINE(name) \
#define PROC_FILE_DEFINE(name) \
@@ -539,9 +537,7 @@ cifs_proc_init(void)
	proc_create_single("DebugData", 0, proc_fs_cifs,
	proc_create_single("DebugData", 0, proc_fs_cifs,
			cifs_debug_data_proc_show);
			cifs_debug_data_proc_show);


#ifdef CONFIG_CIFS_STATS
	proc_create("Stats", 0644, proc_fs_cifs, &cifs_stats_proc_fops);
	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("cifsFYI", 0644, proc_fs_cifs, &cifsFYI_proc_fops);
	proc_create("traceSMB", 0644, proc_fs_cifs, &traceSMB_proc_fops);
	proc_create("traceSMB", 0644, proc_fs_cifs, &traceSMB_proc_fops);
	proc_create("LinuxExtensionsEnabled", 0644, proc_fs_cifs,
	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("DebugData", proc_fs_cifs);
	remove_proc_entry("cifsFYI", proc_fs_cifs);
	remove_proc_entry("cifsFYI", proc_fs_cifs);
	remove_proc_entry("traceSMB", proc_fs_cifs);
	remove_proc_entry("traceSMB", proc_fs_cifs);
#ifdef CONFIG_CIFS_STATS
	remove_proc_entry("Stats", proc_fs_cifs);
	remove_proc_entry("Stats", proc_fs_cifs);
#endif
	remove_proc_entry("SecurityFlags", proc_fs_cifs);
	remove_proc_entry("SecurityFlags", proc_fs_cifs);
	remove_proc_entry("LinuxExtensionsEnabled", proc_fs_cifs);
	remove_proc_entry("LinuxExtensionsEnabled", proc_fs_cifs);
	remove_proc_entry("LookupCacheEnabled", proc_fs_cifs);
	remove_proc_entry("LookupCacheEnabled", proc_fs_cifs);
+0 −10
Original line number Original line Diff line number Diff line
@@ -931,7 +931,6 @@ struct cifs_tcon {
	__u32 tid;		/* The 4 byte tree id */
	__u32 tid;		/* The 4 byte tree id */
	__u16 Flags;		/* optional support bits */
	__u16 Flags;		/* optional support bits */
	enum statusEnum tidStatus;
	enum statusEnum tidStatus;
#ifdef CONFIG_CIFS_STATS
	atomic_t num_smbs_sent;
	atomic_t num_smbs_sent;
	union {
	union {
		struct {
		struct {
@@ -965,7 +964,6 @@ struct cifs_tcon {
	__u64    bytes_read;
	__u64    bytes_read;
	__u64    bytes_written;
	__u64    bytes_written;
	spinlock_t stat_lock;  /* protects the two fields above */
	spinlock_t stat_lock;  /* protects the two fields above */
#endif /* CONFIG_CIFS_STATS */
	FILE_SYSTEM_DEVICE_INFO fsDevInfo;
	FILE_SYSTEM_DEVICE_INFO fsDevInfo;
	FILE_SYSTEM_ATTRIBUTE_INFO fsAttrInfo; /* ok if fs name truncated */
	FILE_SYSTEM_ATTRIBUTE_INFO fsAttrInfo; /* ok if fs name truncated */
	FILE_SYSTEM_UNIX_INFO fsUnixInfo;
	FILE_SYSTEM_UNIX_INFO fsUnixInfo;
@@ -1331,7 +1329,6 @@ convert_delimiter(char *path, char delim)
		*pos = delim;
		*pos = delim;
}
}


#ifdef CONFIG_CIFS_STATS
#define cifs_stats_inc atomic_inc
#define cifs_stats_inc atomic_inc


static inline void cifs_stats_bytes_written(struct cifs_tcon *tcon,
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;
	tcon->bytes_read += bytes;
	spin_unlock(&tcon->stat_lock);
	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




/*
/*
+0 −2
Original line number Original line Diff line number Diff line
@@ -122,9 +122,7 @@ tconInfoAlloc(void)
		mutex_init(&ret_buf->crfid.fid_mutex);
		mutex_init(&ret_buf->crfid.fid_mutex);
		ret_buf->crfid.fid = kzalloc(sizeof(struct cifs_fid),
		ret_buf->crfid.fid = kzalloc(sizeof(struct cifs_fid),
					     GFP_KERNEL);
					     GFP_KERNEL);
#ifdef CONFIG_CIFS_STATS
		spin_lock_init(&ret_buf->stat_lock);
		spin_lock_init(&ret_buf->stat_lock);
#endif
	}
	}
	return ret_buf;
	return ret_buf;
}
}
+0 −4
Original line number Original line Diff line number Diff line
@@ -624,7 +624,6 @@ cifs_query_file_info(const unsigned int xid, struct cifs_tcon *tcon,
static void
static void
cifs_clear_stats(struct cifs_tcon *tcon)
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_writes, 0);
	atomic_set(&tcon->stats.cifs_stats.num_reads, 0);
	atomic_set(&tcon->stats.cifs_stats.num_reads, 0);
	atomic_set(&tcon->stats.cifs_stats.num_flushes, 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_locks, 0);
	atomic_set(&tcon->stats.cifs_stats.num_acl_get, 0);
	atomic_set(&tcon->stats.cifs_stats.num_acl_get, 0);
	atomic_set(&tcon->stats.cifs_stats.num_acl_set, 0);
	atomic_set(&tcon->stats.cifs_stats.num_acl_set, 0);
#endif
}
}


static void
static void
cifs_print_stats(struct seq_file *m, struct cifs_tcon *tcon)
cifs_print_stats(struct seq_file *m, struct cifs_tcon *tcon)
{
{
#ifdef CONFIG_CIFS_STATS
	seq_printf(m, " Oplocks breaks: %d",
	seq_printf(m, " Oplocks breaks: %d",
		   atomic_read(&tcon->stats.cifs_stats.num_oplock_brks));
		   atomic_read(&tcon->stats.cifs_stats.num_oplock_brks));
	seq_printf(m, "\nReads:  %d Bytes: %llu",
	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_ffirst),
		   atomic_read(&tcon->stats.cifs_stats.num_fnext),
		   atomic_read(&tcon->stats.cifs_stats.num_fnext),
		   atomic_read(&tcon->stats.cifs_stats.num_fclose));
		   atomic_read(&tcon->stats.cifs_stats.num_fclose));
#endif
}
}


static void
static void
Loading