Print this page
NEX-5175 want SMB statistics separately for reads, writes, other
Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Matt Barden <Matt.Barden@nexenta.com>
NEX-4811 SMB needs to export a header for kstats
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Jeffry Molanus <jeffry.molanus@nexenta.com>
SMB-11 SMB2 message parse & dispatch
SMB-12 SMB2 Negotiate Protocol
SMB-13 SMB2 Session Setup
SMB-14 SMB2 Logoff
SMB-15 SMB2 Tree Connect
SMB-16 SMB2 Tree Disconnect
SMB-17 SMB2 Create
SMB-18 SMB2 Close
SMB-19 SMB2 Flush
SMB-20 SMB2 Read
SMB-21 SMB2 Write
SMB-22 SMB2 Lock/Unlock
SMB-23 SMB2 Ioctl
SMB-24 SMB2 Cancel
SMB-25 SMB2 Echo
SMB-26 SMB2 Query Dir
SMB-27 SMB2 Change Notify
SMB-28 SMB2 Query Info
SMB-29 SMB2 Set Info
SMB-30 SMB2 Oplocks
SMB-53 SMB2 Create Context options
(SMB2 code review cleanup 1, 2, 3)
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/smbsrv/smb_kstat.h
+++ new/usr/src/uts/common/smbsrv/smb_kstat.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
|
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23 - * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
23 + * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
24 24 */
25 25
26 26 /*
27 27 * Kstat definitions for the SMB server module.
28 28 */
29 29 #ifndef _SMBSRV_SMB_KSTAT_H
30 30 #define _SMBSRV_SMB_KSTAT_H
31 31
32 -#include <smbsrv/smb.h>
33 -#include <smbsrv/smb2.h>
32 +#include <sys/kstat.h>
34 33
35 34 #ifdef __cplusplus
36 35 extern "C" {
37 36 #endif
38 37
39 38 #define SMBSRV_KSTAT_PROCESS "smbd"
40 39 #define SMBSRV_KSTAT_MODULE "smbsrv"
41 40 #define SMBSRV_KSTAT_CLASS "net"
42 41 #define SMBSRV_KSTAT_NAME "smbsrv"
43 42 #define SMBSRV_KSTAT_NAME_CMDS "smbsrv_commands"
44 43 #define SMBSRV_KSTAT_TXRCACHE "smb_txreq"
45 44 #define SMBSRV_KSTAT_REQUEST_CACHE "smb_request_cache"
46 45 #define SMBSRV_KSTAT_SESSION_CACHE "smb_session_cache"
|
↓ open down ↓ |
3 lines elided |
↑ open up ↑ |
47 46 #define SMBSRV_KSTAT_USER_CACHE "smb_user_cache"
48 47 #define SMBSRV_KSTAT_TREE_CACHE "smb_tree_cache"
49 48 #define SMBSRV_KSTAT_OFILE_CACHE "smb_ofile_cache"
50 49 #define SMBSRV_KSTAT_ODIR_CACHE "smb_odir_cache"
51 50 #define SMBSRV_KSTAT_NODE_CACHE "smb_node_cache"
52 51 #define SMBSRV_KSTAT_MBC_CACHE "smb_mbc_cache"
53 52 #define SMBSRV_KSTAT_STATISTICS "smbsrv_statistics"
54 53 #define SMBSRV_KSTAT_UNSUPPORTED "Unsupported"
55 54 #define SMBSRV_KSTAT_WORKERS "smb_workers"
56 55
56 +/*
57 + * We don't want to pull in smb.h or smb2.h here, so we're using
58 + * local defines corresponding to SMB_COM_NUM, SMB2__NCMDS for
59 + * the ks_reqs1 and ks_reqs2 arrays, respectively. These are
60 + * sanity-checked when smb_server.c is compiled.
61 + */
62 +#define SMBSRV_KS_NREQS1 256 /* See: SMB_COM_NUM */
63 +#define SMBSRV_KS_NREQS2 20 /* See: SMB2__NCMDS */
64 +
57 65 #pragma pack(1)
58 66
59 67 typedef struct smb_kstat_utilization {
60 68 hrtime_t ku_wtime;
61 69 hrtime_t ku_wlentime;
62 70 hrtime_t ku_rtime;
63 71 hrtime_t ku_rlentime;
64 72 } smb_kstat_utilization_t;
65 73
66 74 typedef struct smb_kstat_req {
67 75 char kr_name[KSTAT_STRLEN];
68 76 char kr_pad[(~(KSTAT_STRLEN & 0x07) + 1) & 0x07];
69 77 uint64_t kr_sum;
70 78 uint64_t kr_txb;
71 79 uint64_t kr_rxb;
72 80 uint64_t kr_nreq;
73 81 uint64_t kr_a_mean;
74 82 uint64_t kr_a_stddev;
|
↓ open down ↓ |
8 lines elided |
↑ open up ↑ |
75 83 uint64_t kr_d_mean;
76 84 uint64_t kr_d_stddev;
77 85 } smb_kstat_req_t;
78 86
79 87 typedef struct smbsrv_kstats {
80 88 hrtime_t ks_start_time;
81 89 uint64_t ks_txb; /* Bytes transmitted */
82 90 uint64_t ks_rxb; /* Bytes received */
83 91 uint64_t ks_nreq; /* Requests treated */
84 92 smb_kstat_utilization_t ks_utilization;
85 - smb_kstat_req_t ks_reqs1[SMB_COM_NUM];
86 - smb_kstat_req_t ks_reqs2[SMB2__NCMDS];
93 + smb_kstat_req_t ks_reqs1[SMBSRV_KS_NREQS1];
94 + smb_kstat_req_t ks_reqs2[SMBSRV_KS_NREQS2];
87 95 uint32_t ks_nbt_sess; /* NBT sessions */
88 96 uint32_t ks_tcp_sess; /* TCP sessions */
89 97 uint32_t ks_users; /* Users logged in */
90 98 uint32_t ks_trees; /* Trees connected */
91 99 uint32_t ks_files; /* Open files */
92 100 uint32_t ks_pipes; /* Open pipes */
93 101 uint32_t ks_maxreqs; /* Max number of reqs */
94 102 uint32_t ks_padding;
95 103 } smbsrv_kstats_t;
96 104
105 +/* Array indices in ks_clsh (short for client-or-share) */
106 +#define SMBSRV_CLSH_OTHER 0
107 +#define SMBSRV_CLSH_READ 1
108 +#define SMBSRV_CLSH_WRITE 2
109 +#define SMBSRV_CLSH__NREQ 3
110 +#define SMBSRV_CLSH__NAMES { "other", "read", "write" }
111 +
112 +typedef struct smbsrv_clsh_kstats {
113 + smb_kstat_req_t ks_clsh[SMBSRV_CLSH__NREQ];
114 +} smbsrv_clsh_kstats_t;
115 +
97 116 #pragma pack()
98 117
99 118 #ifdef __cplusplus
100 119 }
101 120 #endif
102 121
103 122 #endif /* _SMBSRV_SMB_KSTAT_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX