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/cifs/smb1ops.c | |
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/cifs/smb1ops.c')
-rw-r--r-- | fs/cifs/smb1ops.c | 68 |
1 files changed, 68 insertions, 0 deletions
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, |