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)

*** 18,38 **** * * CDDL HEADER END */ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. ! * Copyright 2013 Nexenta Systems, Inc. All rights reserved. */ /* * Kstat definitions for the SMB server module. */ #ifndef _SMBSRV_SMB_KSTAT_H #define _SMBSRV_SMB_KSTAT_H ! #include <smbsrv/smb.h> ! #include <smbsrv/smb2.h> #ifdef __cplusplus extern "C" { #endif --- 18,37 ---- * * CDDL HEADER END */ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. ! * Copyright 2016 Nexenta Systems, Inc. All rights reserved. */ /* * Kstat definitions for the SMB server module. */ #ifndef _SMBSRV_SMB_KSTAT_H #define _SMBSRV_SMB_KSTAT_H ! #include <sys/kstat.h> #ifdef __cplusplus extern "C" { #endif
*** 52,61 **** --- 51,69 ---- #define SMBSRV_KSTAT_MBC_CACHE "smb_mbc_cache" #define SMBSRV_KSTAT_STATISTICS "smbsrv_statistics" #define SMBSRV_KSTAT_UNSUPPORTED "Unsupported" #define SMBSRV_KSTAT_WORKERS "smb_workers" + /* + * We don't want to pull in smb.h or smb2.h here, so we're using + * local defines corresponding to SMB_COM_NUM, SMB2__NCMDS for + * the ks_reqs1 and ks_reqs2 arrays, respectively. These are + * sanity-checked when smb_server.c is compiled. + */ + #define SMBSRV_KS_NREQS1 256 /* See: SMB_COM_NUM */ + #define SMBSRV_KS_NREQS2 20 /* See: SMB2__NCMDS */ + #pragma pack(1) typedef struct smb_kstat_utilization { hrtime_t ku_wtime; hrtime_t ku_wlentime;
*** 80,91 **** hrtime_t ks_start_time; uint64_t ks_txb; /* Bytes transmitted */ uint64_t ks_rxb; /* Bytes received */ uint64_t ks_nreq; /* Requests treated */ smb_kstat_utilization_t ks_utilization; ! smb_kstat_req_t ks_reqs1[SMB_COM_NUM]; ! smb_kstat_req_t ks_reqs2[SMB2__NCMDS]; uint32_t ks_nbt_sess; /* NBT sessions */ uint32_t ks_tcp_sess; /* TCP sessions */ uint32_t ks_users; /* Users logged in */ uint32_t ks_trees; /* Trees connected */ uint32_t ks_files; /* Open files */ --- 88,99 ---- hrtime_t ks_start_time; uint64_t ks_txb; /* Bytes transmitted */ uint64_t ks_rxb; /* Bytes received */ uint64_t ks_nreq; /* Requests treated */ smb_kstat_utilization_t ks_utilization; ! smb_kstat_req_t ks_reqs1[SMBSRV_KS_NREQS1]; ! smb_kstat_req_t ks_reqs2[SMBSRV_KS_NREQS2]; uint32_t ks_nbt_sess; /* NBT sessions */ uint32_t ks_tcp_sess; /* TCP sessions */ uint32_t ks_users; /* Users logged in */ uint32_t ks_trees; /* Trees connected */ uint32_t ks_files; /* Open files */
*** 92,101 **** --- 100,120 ---- uint32_t ks_pipes; /* Open pipes */ uint32_t ks_maxreqs; /* Max number of reqs */ uint32_t ks_padding; } smbsrv_kstats_t; + /* Array indices in ks_clsh (short for client-or-share) */ + #define SMBSRV_CLSH_OTHER 0 + #define SMBSRV_CLSH_READ 1 + #define SMBSRV_CLSH_WRITE 2 + #define SMBSRV_CLSH__NREQ 3 + #define SMBSRV_CLSH__NAMES { "other", "read", "write" } + + typedef struct smbsrv_clsh_kstats { + smb_kstat_req_t ks_clsh[SMBSRV_CLSH__NREQ]; + } smbsrv_clsh_kstats_t; + #pragma pack() #ifdef __cplusplus } #endif