summaryrefslogtreecommitdiff
path: root/fs/cifs/cifsglob.h
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2005-08-24 13:59:35 -0700
committerSteve French <sfrench@us.ibm.com>2005-08-24 13:59:35 -0700
commita45443475835ab4d1c753159812aca21b5c333a3 (patch)
tree308c2535875dec62bdafae3d3ed2a98af588d608 /fs/cifs/cifsglob.h
parent6b8edfe0f918e7585acb3bd63f62ff56e32dd3d2 (diff)
CIFS: Reduce CONFIG_CIFS_STATS ifdefs
Make cifs_stats code conditional in the header files to avoid ifdefs in the main code. Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifsglob.h')
-rw-r--r--fs/cifs/cifsglob.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index f143975627e..9a3c85bdd77 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -339,6 +339,34 @@ static inline const char CIFS_DIR_SEP(const struct cifs_sb_info *cifs_sb)
return '\\';
}
+#ifdef CONFIG_CIFS_STATS
+#define cifs_stats_inc atomic_inc
+
+static inline void cifs_stats_bytes_written(struct cifsTconInfo *tcon,
+ unsigned int bytes)
+{
+ if (bytes) {
+ spin_lock(&tcon->stat_lock);
+ tcon->bytes_written += bytes;
+ spin_unlock(&tcon->stat_lock);
+ }
+}
+
+static inline void cifs_stats_bytes_read(struct cifsTconInfo *tcon,
+ unsigned int bytes)
+{
+ spin_lock(&tcon->stat_lock);
+ 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
+
/* one of these for every pending CIFS request to the server */
struct mid_q_entry {
struct list_head qhead; /* mids waiting on reply from this server */