Skip to content

Commit 4498eed

Browse files
author
Steve French
committed
[CIFS] Add extended stats (STATS2) for total buffer allocations for
better performance debugging. Signed-off-by: Steve French <[email protected]>
1 parent 84afc29 commit 4498eed

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

fs/cifs/cifs_debug.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ cifs_stats_write(struct file *file, const char __user *buffer,
219219

220220
if (c == '1' || c == 'y' || c == 'Y' || c == '0') {
221221
read_lock(&GlobalSMBSeslock);
222+
#ifdef CONFIG_CIFS_STATS2
223+
atomic_set(&totBufAllocCount, 0);
224+
atomic_set(&totSmBufAllocCount, 0);
225+
#endif /* CONFIG_CIFS_STATS2 */
222226
list_for_each(tmp, &GlobalTreeConnectionList) {
223227
tcon = list_entry(tmp, struct cifsTconInfo,
224228
cifsConnectionList);

fs/cifs/cifsfs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,12 @@ init_cifs(void)
954954
atomic_set(&tconInfoReconnectCount, 0);
955955

956956
atomic_set(&bufAllocCount, 0);
957+
atomic_set(&smBufAllocCount, 0);
958+
#ifdef CONFIG_CIFS_STATS2
959+
atomic_set(&totBufAllocCount, 0);
960+
atomic_set(&totSmBufAllocCount, 0);
961+
#endif /* CONFIG_CIFS_STATS2 */
962+
957963
atomic_set(&midCount, 0);
958964
GlobalCurrentXid = 0;
959965
GlobalTotalActiveXid = 0;

fs/cifs/cifsglob.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,12 @@ GLOBAL_EXTERN atomic_t tcpSesReconnectCount;
505505
GLOBAL_EXTERN atomic_t tconInfoReconnectCount;
506506

507507
/* Various Debug counters to remove someday (BB) */
508-
GLOBAL_EXTERN atomic_t bufAllocCount;
509-
GLOBAL_EXTERN atomic_t smBufAllocCount;
508+
GLOBAL_EXTERN atomic_t bufAllocCount; /* current number allocated */
509+
#ifdef CONFIG_CIFS_STATS2
510+
GLOBAL_EXTERN atomic_t totBufAllocCount; /* total allocated over all time */
511+
GLOBAL_EXTERN atomic_t totSmBufAllocCount;
512+
#endif
513+
GLOBAL_EXTERN atomic_t smBufAllocCount;
510514
GLOBAL_EXTERN atomic_t midCount;
511515

512516
/* Misc globals */

fs/cifs/misc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ cifs_buf_get(void)
161161
if (ret_buf) {
162162
memset(ret_buf, 0, sizeof(struct smb_hdr) + 3);
163163
atomic_inc(&bufAllocCount);
164+
#ifdef CONFIG_CIFS_STATS2
165+
atomic_inc(&totBufAllocCount);
166+
#endif /* CONFIG_CIFS_STATS2 */
164167
}
165168

166169
return ret_buf;
@@ -195,6 +198,10 @@ cifs_small_buf_get(void)
195198
/* No need to clear memory here, cleared in header assemble */
196199
/* memset(ret_buf, 0, sizeof(struct smb_hdr) + 27);*/
197200
atomic_inc(&smBufAllocCount);
201+
#ifdef CONFIG_CIFS_STATS2
202+
atomic_inc(&totSmBufAllocCount);
203+
#endif /* CONFIG_CIFS_STATS2 */
204+
198205
}
199206
return ret_buf;
200207
}

0 commit comments

Comments
 (0)