diff options
author | Pavel Shilovsky <pshilovsky@samba.org> | 2012-05-28 06:16:31 -0400 |
---|---|---|
committer | Pavel Shilovsky <pshilovsky@samba.org> | 2012-07-24 13:55:18 -0400 |
commit | 44c581866e2ae4bbc3c8eea5a3e3c7a0f639e12d (patch) | |
tree | 00673c45c35bcc8d79bc79c77f23b395e5ad9b79 /fs | |
parent | 9094fad1ed90caebd25b1bdec3c8982d079356ee (diff) |
CIFS: Move clear/print_stats code to ops struct
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/cifs_debug.c | 60 | ||||
-rw-r--r-- | fs/cifs/cifsglob.h | 48 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 54 | ||||
-rw-r--r-- | fs/cifs/misc.c | 2 | ||||
-rw-r--r-- | fs/cifs/smb1ops.c | 68 |
5 files changed, 129 insertions, 103 deletions
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c index 8aa8693bb65c..d9ea6ede6a7a 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c | |||
@@ -282,24 +282,8 @@ static ssize_t cifs_stats_proc_write(struct file *file, | |||
282 | struct cifs_tcon, | 282 | struct cifs_tcon, |
283 | tcon_list); | 283 | tcon_list); |
284 | atomic_set(&tcon->num_smbs_sent, 0); | 284 | atomic_set(&tcon->num_smbs_sent, 0); |
285 | atomic_set(&tcon->num_writes, 0); | 285 | if (server->ops->clear_stats) |
286 | atomic_set(&tcon->num_reads, 0); | 286 | server->ops->clear_stats(tcon); |
287 | atomic_set(&tcon->num_oplock_brks, 0); | ||
288 | atomic_set(&tcon->num_opens, 0); | ||
289 | atomic_set(&tcon->num_posixopens, 0); | ||
290 | atomic_set(&tcon->num_posixmkdirs, 0); | ||
291 | atomic_set(&tcon->num_closes, 0); | ||
292 | atomic_set(&tcon->num_deletes, 0); | ||
293 | atomic_set(&tcon->num_mkdirs, 0); | ||
294 | atomic_set(&tcon->num_rmdirs, 0); | ||
295 | atomic_set(&tcon->num_renames, 0); | ||
296 | atomic_set(&tcon->num_t2renames, 0); | ||
297 | atomic_set(&tcon->num_ffirst, 0); | ||
298 | atomic_set(&tcon->num_fnext, 0); | ||
299 | atomic_set(&tcon->num_fclose, 0); | ||
300 | atomic_set(&tcon->num_hardlinks, 0); | ||
301 | atomic_set(&tcon->num_symlinks, 0); | ||
302 | atomic_set(&tcon->num_locks, 0); | ||
303 | } | 287 | } |
304 | } | 288 | } |
305 | } | 289 | } |
@@ -358,42 +342,10 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v) | |||
358 | seq_printf(m, "\n%d) %s", i, tcon->treeName); | 342 | seq_printf(m, "\n%d) %s", i, tcon->treeName); |
359 | if (tcon->need_reconnect) | 343 | if (tcon->need_reconnect) |
360 | seq_puts(m, "\tDISCONNECTED "); | 344 | seq_puts(m, "\tDISCONNECTED "); |
361 | seq_printf(m, "\nSMBs: %d Oplock Breaks: %d", | 345 | seq_printf(m, "\nSMBs: %d", |
362 | atomic_read(&tcon->num_smbs_sent), | 346 | atomic_read(&tcon->num_smbs_sent)); |
363 | atomic_read(&tcon->num_oplock_brks)); | 347 | if (server->ops->print_stats) |
364 | seq_printf(m, "\nReads: %d Bytes: %lld", | 348 | server->ops->print_stats(m, tcon); |
365 | atomic_read(&tcon->num_reads), | ||
366 | (long long)(tcon->bytes_read)); | ||
367 | seq_printf(m, "\nWrites: %d Bytes: %lld", | ||
368 | atomic_read(&tcon->num_writes), | ||
369 | (long long)(tcon->bytes_written)); | ||
370 | seq_printf(m, "\nFlushes: %d", | ||
371 | atomic_read(&tcon->num_flushes)); | ||
372 | seq_printf(m, "\nLocks: %d HardLinks: %d " | ||
373 | "Symlinks: %d", | ||
374 | atomic_read(&tcon->num_locks), | ||
375 | atomic_read(&tcon->num_hardlinks), | ||
376 | atomic_read(&tcon->num_symlinks)); | ||
377 | seq_printf(m, "\nOpens: %d Closes: %d " | ||
378 | "Deletes: %d", | ||
379 | atomic_read(&tcon->num_opens), | ||
380 | atomic_read(&tcon->num_closes), | ||
381 | atomic_read(&tcon->num_deletes)); | ||
382 | seq_printf(m, "\nPosix Opens: %d " | ||
383 | "Posix Mkdirs: %d", | ||
384 | atomic_read(&tcon->num_posixopens), | ||
385 | atomic_read(&tcon->num_posixmkdirs)); | ||
386 | seq_printf(m, "\nMkdirs: %d Rmdirs: %d", | ||
387 | atomic_read(&tcon->num_mkdirs), | ||
388 | atomic_read(&tcon->num_rmdirs)); | ||
389 | seq_printf(m, "\nRenames: %d T2 Renames %d", | ||
390 | atomic_read(&tcon->num_renames), | ||
391 | atomic_read(&tcon->num_t2renames)); | ||
392 | seq_printf(m, "\nFindFirst: %d FNext %d " | ||
393 | "FClose %d", | ||
394 | atomic_read(&tcon->num_ffirst), | ||
395 | atomic_read(&tcon->num_fnext), | ||
396 | atomic_read(&tcon->num_fclose)); | ||
397 | } | 349 | } |
398 | } | 350 | } |
399 | } | 351 | } |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index ae9a1e900c15..0896328418aa 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -197,6 +197,8 @@ struct smb_version_operations { | |||
197 | /* find mid corresponding to the response message */ | 197 | /* find mid corresponding to the response message */ |
198 | struct mid_q_entry * (*find_mid)(struct TCP_Server_Info *, char *); | 198 | struct mid_q_entry * (*find_mid)(struct TCP_Server_Info *, char *); |
199 | void (*dump_detail)(void *); | 199 | void (*dump_detail)(void *); |
200 | void (*clear_stats)(struct cifs_tcon *); | ||
201 | void (*print_stats)(struct seq_file *m, struct cifs_tcon *); | ||
200 | /* verify the message */ | 202 | /* verify the message */ |
201 | int (*check_message)(char *, unsigned int); | 203 | int (*check_message)(char *, unsigned int); |
202 | bool (*is_oplock_break)(char *, struct TCP_Server_Info *); | 204 | bool (*is_oplock_break)(char *, struct TCP_Server_Info *); |
@@ -566,27 +568,31 @@ struct cifs_tcon { | |||
566 | enum statusEnum tidStatus; | 568 | enum statusEnum tidStatus; |
567 | #ifdef CONFIG_CIFS_STATS | 569 | #ifdef CONFIG_CIFS_STATS |
568 | atomic_t num_smbs_sent; | 570 | atomic_t num_smbs_sent; |
569 | atomic_t num_writes; | 571 | union { |
570 | atomic_t num_reads; | 572 | struct { |
571 | atomic_t num_flushes; | 573 | atomic_t num_writes; |
572 | atomic_t num_oplock_brks; | 574 | atomic_t num_reads; |
573 | atomic_t num_opens; | 575 | atomic_t num_flushes; |
574 | atomic_t num_closes; | 576 | atomic_t num_oplock_brks; |
575 | atomic_t num_deletes; | 577 | atomic_t num_opens; |
576 | atomic_t num_mkdirs; | 578 | atomic_t num_closes; |
577 | atomic_t num_posixopens; | 579 | atomic_t num_deletes; |
578 | atomic_t num_posixmkdirs; | 580 | atomic_t num_mkdirs; |
579 | atomic_t num_rmdirs; | 581 | atomic_t num_posixopens; |
580 | atomic_t num_renames; | 582 | atomic_t num_posixmkdirs; |
581 | atomic_t num_t2renames; | 583 | atomic_t num_rmdirs; |
582 | atomic_t num_ffirst; | 584 | atomic_t num_renames; |
583 | atomic_t num_fnext; | 585 | atomic_t num_t2renames; |
584 | atomic_t num_fclose; | 586 | atomic_t num_ffirst; |
585 | atomic_t num_hardlinks; | 587 | atomic_t num_fnext; |
586 | atomic_t num_symlinks; | 588 | atomic_t num_fclose; |
587 | atomic_t num_locks; | 589 | atomic_t num_hardlinks; |
588 | atomic_t num_acl_get; | 590 | atomic_t num_symlinks; |
589 | atomic_t num_acl_set; | 591 | atomic_t num_locks; |
592 | atomic_t num_acl_get; | ||
593 | atomic_t num_acl_set; | ||
594 | } cifs_stats; | ||
595 | } stats; | ||
590 | #ifdef CONFIG_CIFS_STATS2 | 596 | #ifdef CONFIG_CIFS_STATS2 |
591 | unsigned long long time_writes; | 597 | unsigned long long time_writes; |
592 | unsigned long long time_reads; | 598 | unsigned long long time_reads; |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index fe30bb5dd2d8..cabc7a01f5df 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -893,7 +893,7 @@ PsxDelete: | |||
893 | cFYI(1, "Posix delete returned %d", rc); | 893 | cFYI(1, "Posix delete returned %d", rc); |
894 | cifs_buf_release(pSMB); | 894 | cifs_buf_release(pSMB); |
895 | 895 | ||
896 | cifs_stats_inc(&tcon->num_deletes); | 896 | cifs_stats_inc(&tcon->stats.cifs_stats.num_deletes); |
897 | 897 | ||
898 | if (rc == -EAGAIN) | 898 | if (rc == -EAGAIN) |
899 | goto PsxDelete; | 899 | goto PsxDelete; |
@@ -936,7 +936,7 @@ DelFileRetry: | |||
936 | pSMB->ByteCount = cpu_to_le16(name_len + 1); | 936 | pSMB->ByteCount = cpu_to_le16(name_len + 1); |
937 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 937 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
938 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 938 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
939 | cifs_stats_inc(&tcon->num_deletes); | 939 | cifs_stats_inc(&tcon->stats.cifs_stats.num_deletes); |
940 | if (rc) | 940 | if (rc) |
941 | cFYI(1, "Error in RMFile = %d", rc); | 941 | cFYI(1, "Error in RMFile = %d", rc); |
942 | 942 | ||
@@ -981,7 +981,7 @@ RmDirRetry: | |||
981 | pSMB->ByteCount = cpu_to_le16(name_len + 1); | 981 | pSMB->ByteCount = cpu_to_le16(name_len + 1); |
982 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 982 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
983 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 983 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
984 | cifs_stats_inc(&tcon->num_rmdirs); | 984 | cifs_stats_inc(&tcon->stats.cifs_stats.num_rmdirs); |
985 | if (rc) | 985 | if (rc) |
986 | cFYI(1, "Error in RMDir = %d", rc); | 986 | cFYI(1, "Error in RMDir = %d", rc); |
987 | 987 | ||
@@ -1024,7 +1024,7 @@ MkDirRetry: | |||
1024 | pSMB->ByteCount = cpu_to_le16(name_len + 1); | 1024 | pSMB->ByteCount = cpu_to_le16(name_len + 1); |
1025 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 1025 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
1026 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 1026 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
1027 | cifs_stats_inc(&tcon->num_mkdirs); | 1027 | cifs_stats_inc(&tcon->stats.cifs_stats.num_mkdirs); |
1028 | if (rc) | 1028 | if (rc) |
1029 | cFYI(1, "Error in Mkdir = %d", rc); | 1029 | cFYI(1, "Error in Mkdir = %d", rc); |
1030 | 1030 | ||
@@ -1147,9 +1147,9 @@ psx_create_err: | |||
1147 | cifs_buf_release(pSMB); | 1147 | cifs_buf_release(pSMB); |
1148 | 1148 | ||
1149 | if (posix_flags & SMB_O_DIRECTORY) | 1149 | if (posix_flags & SMB_O_DIRECTORY) |
1150 | cifs_stats_inc(&tcon->num_posixmkdirs); | 1150 | cifs_stats_inc(&tcon->stats.cifs_stats.num_posixmkdirs); |
1151 | else | 1151 | else |
1152 | cifs_stats_inc(&tcon->num_posixopens); | 1152 | cifs_stats_inc(&tcon->stats.cifs_stats.num_posixopens); |
1153 | 1153 | ||
1154 | if (rc == -EAGAIN) | 1154 | if (rc == -EAGAIN) |
1155 | goto PsxCreat; | 1155 | goto PsxCreat; |
@@ -1270,7 +1270,7 @@ OldOpenRetry: | |||
1270 | /* long_op set to 1 to allow for oplock break timeouts */ | 1270 | /* long_op set to 1 to allow for oplock break timeouts */ |
1271 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 1271 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
1272 | (struct smb_hdr *)pSMBr, &bytes_returned, 0); | 1272 | (struct smb_hdr *)pSMBr, &bytes_returned, 0); |
1273 | cifs_stats_inc(&tcon->num_opens); | 1273 | cifs_stats_inc(&tcon->stats.cifs_stats.num_opens); |
1274 | if (rc) { | 1274 | if (rc) { |
1275 | cFYI(1, "Error in Open = %d", rc); | 1275 | cFYI(1, "Error in Open = %d", rc); |
1276 | } else { | 1276 | } else { |
@@ -1383,7 +1383,7 @@ openRetry: | |||
1383 | /* long_op set to 1 to allow for oplock break timeouts */ | 1383 | /* long_op set to 1 to allow for oplock break timeouts */ |
1384 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 1384 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
1385 | (struct smb_hdr *)pSMBr, &bytes_returned, 0); | 1385 | (struct smb_hdr *)pSMBr, &bytes_returned, 0); |
1386 | cifs_stats_inc(&tcon->num_opens); | 1386 | cifs_stats_inc(&tcon->stats.cifs_stats.num_opens); |
1387 | if (rc) { | 1387 | if (rc) { |
1388 | cFYI(1, "Error in Open = %d", rc); | 1388 | cFYI(1, "Error in Open = %d", rc); |
1389 | } else { | 1389 | } else { |
@@ -1650,7 +1650,7 @@ cifs_async_readv(struct cifs_readdata *rdata) | |||
1650 | rdata, 0); | 1650 | rdata, 0); |
1651 | 1651 | ||
1652 | if (rc == 0) | 1652 | if (rc == 0) |
1653 | cifs_stats_inc(&tcon->num_reads); | 1653 | cifs_stats_inc(&tcon->stats.cifs_stats.num_reads); |
1654 | else | 1654 | else |
1655 | kref_put(&rdata->refcount, cifs_readdata_release); | 1655 | kref_put(&rdata->refcount, cifs_readdata_release); |
1656 | 1656 | ||
@@ -1720,7 +1720,7 @@ CIFSSMBRead(const unsigned int xid, struct cifs_io_parms *io_parms, | |||
1720 | iov[0].iov_len = be32_to_cpu(pSMB->hdr.smb_buf_length) + 4; | 1720 | iov[0].iov_len = be32_to_cpu(pSMB->hdr.smb_buf_length) + 4; |
1721 | rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovecs */, | 1721 | rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovecs */, |
1722 | &resp_buf_type, CIFS_LOG_ERROR); | 1722 | &resp_buf_type, CIFS_LOG_ERROR); |
1723 | cifs_stats_inc(&tcon->num_reads); | 1723 | cifs_stats_inc(&tcon->stats.cifs_stats.num_reads); |
1724 | pSMBr = (READ_RSP *)iov[0].iov_base; | 1724 | pSMBr = (READ_RSP *)iov[0].iov_base; |
1725 | if (rc) { | 1725 | if (rc) { |
1726 | cERROR(1, "Send error in read = %d", rc); | 1726 | cERROR(1, "Send error in read = %d", rc); |
@@ -1872,7 +1872,7 @@ CIFSSMBWrite(const unsigned int xid, struct cifs_io_parms *io_parms, | |||
1872 | 1872 | ||
1873 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 1873 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
1874 | (struct smb_hdr *) pSMBr, &bytes_returned, long_op); | 1874 | (struct smb_hdr *) pSMBr, &bytes_returned, long_op); |
1875 | cifs_stats_inc(&tcon->num_writes); | 1875 | cifs_stats_inc(&tcon->stats.cifs_stats.num_writes); |
1876 | if (rc) { | 1876 | if (rc) { |
1877 | cFYI(1, "Send error in write = %d", rc); | 1877 | cFYI(1, "Send error in write = %d", rc); |
1878 | } else { | 1878 | } else { |
@@ -2123,7 +2123,7 @@ cifs_async_writev(struct cifs_writedata *wdata) | |||
2123 | NULL, cifs_writev_callback, wdata, 0); | 2123 | NULL, cifs_writev_callback, wdata, 0); |
2124 | 2124 | ||
2125 | if (rc == 0) | 2125 | if (rc == 0) |
2126 | cifs_stats_inc(&tcon->num_writes); | 2126 | cifs_stats_inc(&tcon->stats.cifs_stats.num_writes); |
2127 | else | 2127 | else |
2128 | kref_put(&wdata->refcount, cifs_writedata_release); | 2128 | kref_put(&wdata->refcount, cifs_writedata_release); |
2129 | 2129 | ||
@@ -2213,7 +2213,7 @@ CIFSSMBWrite2(const unsigned int xid, struct cifs_io_parms *io_parms, | |||
2213 | 2213 | ||
2214 | rc = SendReceive2(xid, tcon->ses, iov, n_vec + 1, &resp_buf_type, | 2214 | rc = SendReceive2(xid, tcon->ses, iov, n_vec + 1, &resp_buf_type, |
2215 | long_op); | 2215 | long_op); |
2216 | cifs_stats_inc(&tcon->num_writes); | 2216 | cifs_stats_inc(&tcon->stats.cifs_stats.num_writes); |
2217 | if (rc) { | 2217 | if (rc) { |
2218 | cFYI(1, "Send error Write2 = %d", rc); | 2218 | cFYI(1, "Send error Write2 = %d", rc); |
2219 | } else if (resp_buf_type == 0) { | 2219 | } else if (resp_buf_type == 0) { |
@@ -2279,7 +2279,7 @@ int cifs_lockv(const unsigned int xid, struct cifs_tcon *tcon, | |||
2279 | iov[1].iov_base = (char *)buf; | 2279 | iov[1].iov_base = (char *)buf; |
2280 | iov[1].iov_len = (num_unlock + num_lock) * sizeof(LOCKING_ANDX_RANGE); | 2280 | iov[1].iov_len = (num_unlock + num_lock) * sizeof(LOCKING_ANDX_RANGE); |
2281 | 2281 | ||
2282 | cifs_stats_inc(&tcon->num_locks); | 2282 | cifs_stats_inc(&tcon->stats.cifs_stats.num_locks); |
2283 | rc = SendReceive2(xid, tcon->ses, iov, 2, &resp_buf_type, CIFS_NO_RESP); | 2283 | rc = SendReceive2(xid, tcon->ses, iov, 2, &resp_buf_type, CIFS_NO_RESP); |
2284 | if (rc) | 2284 | if (rc) |
2285 | cFYI(1, "Send error in cifs_lockv = %d", rc); | 2285 | cFYI(1, "Send error in cifs_lockv = %d", rc); |
@@ -2348,7 +2348,7 @@ CIFSSMBLock(const unsigned int xid, struct cifs_tcon *tcon, | |||
2348 | rc = SendReceiveNoRsp(xid, tcon->ses, (char *)pSMB, flags); | 2348 | rc = SendReceiveNoRsp(xid, tcon->ses, (char *)pSMB, flags); |
2349 | /* SMB buffer freed by function above */ | 2349 | /* SMB buffer freed by function above */ |
2350 | } | 2350 | } |
2351 | cifs_stats_inc(&tcon->num_locks); | 2351 | cifs_stats_inc(&tcon->stats.cifs_stats.num_locks); |
2352 | if (rc) | 2352 | if (rc) |
2353 | cFYI(1, "Send error in Lock = %d", rc); | 2353 | cFYI(1, "Send error in Lock = %d", rc); |
2354 | 2354 | ||
@@ -2511,7 +2511,7 @@ CIFSSMBClose(const unsigned int xid, struct cifs_tcon *tcon, int smb_file_id) | |||
2511 | pSMB->LastWriteTime = 0xFFFFFFFF; | 2511 | pSMB->LastWriteTime = 0xFFFFFFFF; |
2512 | pSMB->ByteCount = 0; | 2512 | pSMB->ByteCount = 0; |
2513 | rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0); | 2513 | rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0); |
2514 | cifs_stats_inc(&tcon->num_closes); | 2514 | cifs_stats_inc(&tcon->stats.cifs_stats.num_closes); |
2515 | if (rc) { | 2515 | if (rc) { |
2516 | if (rc != -EINTR) { | 2516 | if (rc != -EINTR) { |
2517 | /* EINTR is expected when user ctl-c to kill app */ | 2517 | /* EINTR is expected when user ctl-c to kill app */ |
@@ -2540,7 +2540,7 @@ CIFSSMBFlush(const unsigned int xid, struct cifs_tcon *tcon, int smb_file_id) | |||
2540 | pSMB->FileID = (__u16) smb_file_id; | 2540 | pSMB->FileID = (__u16) smb_file_id; |
2541 | pSMB->ByteCount = 0; | 2541 | pSMB->ByteCount = 0; |
2542 | rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0); | 2542 | rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0); |
2543 | cifs_stats_inc(&tcon->num_flushes); | 2543 | cifs_stats_inc(&tcon->stats.cifs_stats.num_flushes); |
2544 | if (rc) | 2544 | if (rc) |
2545 | cERROR(1, "Send error in Flush = %d", rc); | 2545 | cERROR(1, "Send error in Flush = %d", rc); |
2546 | 2546 | ||
@@ -2603,7 +2603,7 @@ renameRetry: | |||
2603 | 2603 | ||
2604 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 2604 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
2605 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 2605 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2606 | cifs_stats_inc(&tcon->num_renames); | 2606 | cifs_stats_inc(&tcon->stats.cifs_stats.num_renames); |
2607 | if (rc) | 2607 | if (rc) |
2608 | cFYI(1, "Send error in rename = %d", rc); | 2608 | cFYI(1, "Send error in rename = %d", rc); |
2609 | 2609 | ||
@@ -2684,7 +2684,7 @@ int CIFSSMBRenameOpenFile(const unsigned int xid, struct cifs_tcon *pTcon, | |||
2684 | pSMB->ByteCount = cpu_to_le16(byte_count); | 2684 | pSMB->ByteCount = cpu_to_le16(byte_count); |
2685 | rc = SendReceive(xid, pTcon->ses, (struct smb_hdr *) pSMB, | 2685 | rc = SendReceive(xid, pTcon->ses, (struct smb_hdr *) pSMB, |
2686 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 2686 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2687 | cifs_stats_inc(&pTcon->num_t2renames); | 2687 | cifs_stats_inc(&pTcon->stats.cifs_stats.num_t2renames); |
2688 | if (rc) | 2688 | if (rc) |
2689 | cFYI(1, "Send error in Rename (by file handle) = %d", rc); | 2689 | cFYI(1, "Send error in Rename (by file handle) = %d", rc); |
2690 | 2690 | ||
@@ -2841,7 +2841,7 @@ createSymLinkRetry: | |||
2841 | pSMB->ByteCount = cpu_to_le16(byte_count); | 2841 | pSMB->ByteCount = cpu_to_le16(byte_count); |
2842 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 2842 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
2843 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 2843 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2844 | cifs_stats_inc(&tcon->num_symlinks); | 2844 | cifs_stats_inc(&tcon->stats.cifs_stats.num_symlinks); |
2845 | if (rc) | 2845 | if (rc) |
2846 | cFYI(1, "Send error in SetPathInfo create symlink = %d", rc); | 2846 | cFYI(1, "Send error in SetPathInfo create symlink = %d", rc); |
2847 | 2847 | ||
@@ -2927,7 +2927,7 @@ createHardLinkRetry: | |||
2927 | pSMB->ByteCount = cpu_to_le16(byte_count); | 2927 | pSMB->ByteCount = cpu_to_le16(byte_count); |
2928 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 2928 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
2929 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 2929 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2930 | cifs_stats_inc(&tcon->num_hardlinks); | 2930 | cifs_stats_inc(&tcon->stats.cifs_stats.num_hardlinks); |
2931 | if (rc) | 2931 | if (rc) |
2932 | cFYI(1, "Send error in SetPathInfo (hard link) = %d", rc); | 2932 | cFYI(1, "Send error in SetPathInfo (hard link) = %d", rc); |
2933 | 2933 | ||
@@ -2999,7 +2999,7 @@ winCreateHardLinkRetry: | |||
2999 | 2999 | ||
3000 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 3000 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
3001 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 3001 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
3002 | cifs_stats_inc(&tcon->num_hardlinks); | 3002 | cifs_stats_inc(&tcon->stats.cifs_stats.num_hardlinks); |
3003 | if (rc) | 3003 | if (rc) |
3004 | cFYI(1, "Send error in hard link (NT rename) = %d", rc); | 3004 | cFYI(1, "Send error in hard link (NT rename) = %d", rc); |
3005 | 3005 | ||
@@ -3417,7 +3417,7 @@ queryAclRetry: | |||
3417 | 3417 | ||
3418 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 3418 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
3419 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 3419 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
3420 | cifs_stats_inc(&tcon->num_acl_get); | 3420 | cifs_stats_inc(&tcon->stats.cifs_stats.num_acl_get); |
3421 | if (rc) { | 3421 | if (rc) { |
3422 | cFYI(1, "Send error in Query POSIX ACL = %d", rc); | 3422 | cFYI(1, "Send error in Query POSIX ACL = %d", rc); |
3423 | } else { | 3423 | } else { |
@@ -3728,7 +3728,7 @@ CIFSSMBGetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon, __u16 fid, | |||
3728 | 3728 | ||
3729 | rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovec */, &buf_type, | 3729 | rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovec */, &buf_type, |
3730 | 0); | 3730 | 0); |
3731 | cifs_stats_inc(&tcon->num_acl_get); | 3731 | cifs_stats_inc(&tcon->stats.cifs_stats.num_acl_get); |
3732 | if (rc) { | 3732 | if (rc) { |
3733 | cFYI(1, "Send error in QuerySecDesc = %d", rc); | 3733 | cFYI(1, "Send error in QuerySecDesc = %d", rc); |
3734 | } else { /* decode response */ | 3734 | } else { /* decode response */ |
@@ -4330,7 +4330,7 @@ findFirstRetry: | |||
4330 | 4330 | ||
4331 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 4331 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
4332 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 4332 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
4333 | cifs_stats_inc(&tcon->num_ffirst); | 4333 | cifs_stats_inc(&tcon->stats.cifs_stats.num_ffirst); |
4334 | 4334 | ||
4335 | if (rc) {/* BB add logic to retry regular search if Unix search | 4335 | if (rc) {/* BB add logic to retry regular search if Unix search |
4336 | rejected unexpectedly by server */ | 4336 | rejected unexpectedly by server */ |
@@ -4457,7 +4457,7 @@ int CIFSFindNext(const unsigned int xid, struct cifs_tcon *tcon, | |||
4457 | 4457 | ||
4458 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 4458 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
4459 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 4459 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
4460 | cifs_stats_inc(&tcon->num_fnext); | 4460 | cifs_stats_inc(&tcon->stats.cifs_stats.num_fnext); |
4461 | if (rc) { | 4461 | if (rc) { |
4462 | if (rc == -EBADF) { | 4462 | if (rc == -EBADF) { |
4463 | psrch_inf->endOfSearch = true; | 4463 | psrch_inf->endOfSearch = true; |
@@ -4548,7 +4548,7 @@ CIFSFindClose(const unsigned int xid, struct cifs_tcon *tcon, | |||
4548 | if (rc) | 4548 | if (rc) |
4549 | cERROR(1, "Send error in FindClose = %d", rc); | 4549 | cERROR(1, "Send error in FindClose = %d", rc); |
4550 | 4550 | ||
4551 | cifs_stats_inc(&tcon->num_fclose); | 4551 | cifs_stats_inc(&tcon->stats.cifs_stats.num_fclose); |
4552 | 4552 | ||
4553 | /* Since session is dead, search handle closed on server already */ | 4553 | /* Since session is dead, search handle closed on server already */ |
4554 | if (rc == -EAGAIN) | 4554 | if (rc == -EAGAIN) |
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index ad2538a64c70..ce41fee07e5b 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -461,7 +461,7 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv) | |||
461 | if (tcon->tid != buf->Tid) | 461 | if (tcon->tid != buf->Tid) |
462 | continue; | 462 | continue; |
463 | 463 | ||
464 | cifs_stats_inc(&tcon->num_oplock_brks); | 464 | cifs_stats_inc(&tcon->stats.cifs_stats.num_oplock_brks); |
465 | spin_lock(&cifs_file_list_lock); | 465 | spin_lock(&cifs_file_list_lock); |
466 | list_for_each(tmp2, &tcon->openFileList) { | 466 | list_for_each(tmp2, &tcon->openFileList) { |
467 | netfile = list_entry(tmp2, struct cifsFileInfo, | 467 | netfile = list_entry(tmp2, struct cifsFileInfo, |
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index c9326b4ec6cd..581740998735 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c | |||
@@ -520,6 +520,72 @@ cifs_build_path_to_root(struct smb_vol *vol, struct cifs_sb_info *cifs_sb, | |||
520 | return full_path; | 520 | return full_path; |
521 | } | 521 | } |
522 | 522 | ||
523 | static void | ||
524 | cifs_clear_stats(struct cifs_tcon *tcon) | ||
525 | { | ||
526 | #ifdef CONFIG_CIFS_STATS | ||
527 | atomic_set(&tcon->stats.cifs_stats.num_writes, 0); | ||
528 | atomic_set(&tcon->stats.cifs_stats.num_reads, 0); | ||
529 | atomic_set(&tcon->stats.cifs_stats.num_flushes, 0); | ||
530 | atomic_set(&tcon->stats.cifs_stats.num_oplock_brks, 0); | ||
531 | atomic_set(&tcon->stats.cifs_stats.num_opens, 0); | ||
532 | atomic_set(&tcon->stats.cifs_stats.num_posixopens, 0); | ||
533 | atomic_set(&tcon->stats.cifs_stats.num_posixmkdirs, 0); | ||
534 | atomic_set(&tcon->stats.cifs_stats.num_closes, 0); | ||
535 | atomic_set(&tcon->stats.cifs_stats.num_deletes, 0); | ||
536 | atomic_set(&tcon->stats.cifs_stats.num_mkdirs, 0); | ||
537 | atomic_set(&tcon->stats.cifs_stats.num_rmdirs, 0); | ||
538 | atomic_set(&tcon->stats.cifs_stats.num_renames, 0); | ||
539 | atomic_set(&tcon->stats.cifs_stats.num_t2renames, 0); | ||
540 | atomic_set(&tcon->stats.cifs_stats.num_ffirst, 0); | ||
541 | atomic_set(&tcon->stats.cifs_stats.num_fnext, 0); | ||
542 | atomic_set(&tcon->stats.cifs_stats.num_fclose, 0); | ||
543 | atomic_set(&tcon->stats.cifs_stats.num_hardlinks, 0); | ||
544 | atomic_set(&tcon->stats.cifs_stats.num_symlinks, 0); | ||
545 | atomic_set(&tcon->stats.cifs_stats.num_locks, 0); | ||
546 | atomic_set(&tcon->stats.cifs_stats.num_acl_get, 0); | ||
547 | atomic_set(&tcon->stats.cifs_stats.num_acl_set, 0); | ||
548 | #endif | ||
549 | } | ||
550 | |||
551 | static void | ||
552 | cifs_print_stats(struct seq_file *m, struct cifs_tcon *tcon) | ||
553 | { | ||
554 | #ifdef CONFIG_CIFS_STATS | ||
555 | seq_printf(m, " Oplocks breaks: %d", | ||
556 | atomic_read(&tcon->stats.cifs_stats.num_oplock_brks)); | ||
557 | seq_printf(m, "\nReads: %d Bytes: %llu", | ||
558 | atomic_read(&tcon->stats.cifs_stats.num_reads), | ||
559 | (long long)(tcon->bytes_read)); | ||
560 | seq_printf(m, "\nWrites: %d Bytes: %llu", | ||
561 | atomic_read(&tcon->stats.cifs_stats.num_writes), | ||
562 | (long long)(tcon->bytes_written)); | ||
563 | seq_printf(m, "\nFlushes: %d", | ||
564 | atomic_read(&tcon->stats.cifs_stats.num_flushes)); | ||
565 | seq_printf(m, "\nLocks: %d HardLinks: %d Symlinks: %d", | ||
566 | atomic_read(&tcon->stats.cifs_stats.num_locks), | ||
567 | atomic_read(&tcon->stats.cifs_stats.num_hardlinks), | ||
568 | atomic_read(&tcon->stats.cifs_stats.num_symlinks)); | ||
569 | seq_printf(m, "\nOpens: %d Closes: %d Deletes: %d", | ||
570 | atomic_read(&tcon->stats.cifs_stats.num_opens), | ||
571 | atomic_read(&tcon->stats.cifs_stats.num_closes), | ||
572 | atomic_read(&tcon->stats.cifs_stats.num_deletes)); | ||
573 | seq_printf(m, "\nPosix Opens: %d Posix Mkdirs: %d", | ||
574 | atomic_read(&tcon->stats.cifs_stats.num_posixopens), | ||
575 | atomic_read(&tcon->stats.cifs_stats.num_posixmkdirs)); | ||
576 | seq_printf(m, "\nMkdirs: %d Rmdirs: %d", | ||
577 | atomic_read(&tcon->stats.cifs_stats.num_mkdirs), | ||
578 | atomic_read(&tcon->stats.cifs_stats.num_rmdirs)); | ||
579 | seq_printf(m, "\nRenames: %d T2 Renames %d", | ||
580 | atomic_read(&tcon->stats.cifs_stats.num_renames), | ||
581 | atomic_read(&tcon->stats.cifs_stats.num_t2renames)); | ||
582 | seq_printf(m, "\nFindFirst: %d FNext %d FClose %d", | ||
583 | atomic_read(&tcon->stats.cifs_stats.num_ffirst), | ||
584 | atomic_read(&tcon->stats.cifs_stats.num_fnext), | ||
585 | atomic_read(&tcon->stats.cifs_stats.num_fclose)); | ||
586 | #endif | ||
587 | } | ||
588 | |||
523 | struct smb_version_operations smb1_operations = { | 589 | struct smb_version_operations smb1_operations = { |
524 | .send_cancel = send_nt_cancel, | 590 | .send_cancel = send_nt_cancel, |
525 | .compare_fids = cifs_compare_fids, | 591 | .compare_fids = cifs_compare_fids, |
@@ -537,6 +603,8 @@ struct smb_version_operations smb1_operations = { | |||
537 | .find_mid = cifs_find_mid, | 603 | .find_mid = cifs_find_mid, |
538 | .check_message = checkSMB, | 604 | .check_message = checkSMB, |
539 | .dump_detail = cifs_dump_detail, | 605 | .dump_detail = cifs_dump_detail, |
606 | .clear_stats = cifs_clear_stats, | ||
607 | .print_stats = cifs_print_stats, | ||
540 | .is_oplock_break = is_valid_oplock_break, | 608 | .is_oplock_break = is_valid_oplock_break, |
541 | .check_trans2 = cifs_check_trans2, | 609 | .check_trans2 = cifs_check_trans2, |
542 | .need_neg = cifs_need_neg, | 610 | .need_neg = cifs_need_neg, |