[PATCH] Add infrastructure for gathering statistics on SMB messages

Todd Stecher todd.stecher at isilon.com
Wed Feb 4 01:32:00 GMT 2009

Isilon has a centralized performance monitoring system for all of its
wire protocols, including CIFS, and requires entry points into the SMBD
process for gathering interesting SMB message characteristics such as
the per-command message size, command, sub-command, some specific
ioctls, response latency, and the connected identity.  This patch adds a
pluggable module system to gather that data. 

1. Perfcount module system

Unfortunately, reusing VFS wasn't an option.  Many of the interesting
statistics are gathered during pre-connect operations.   It was
reasonable to assume that other folks might be interested in specific
SMB message details without enabling full profiling.  

This patch introduces a lightweight pluggable perfcounter system to
allow for custom statistics gathering through samba modules.  Every
perfcount module must support each of the monitoring interfaces (
exposed through struct smb_perfcount_handlers in smb_perfcount.h).
There can be only 1 perfcount module for a process - they cannot be

2. Data gathering

Each handler has a corresponding macro which checks for the presence of
a perfcount module, and stores interesting state on the parent structure
(typically a request structure, but also delayed / pending messages).
The handler for each monitored item (command, subcommand, ioctl,
lengths, identity) has its own macro - they are very granular, for

#define SMB_PERFCOUNT_SET_OP(_pcd_,_op_) 
#define SMB_PERFCOUNT_SET_MSGLEN_IN(_pcd_,_in_)

The patch intersperses macros throughout the codebase to track the
lifetime and characteristics of an individual request, ending when the
request is sent to the client (srv_send_smb / sendfile()).

3. OneFS perfcount module

The OneFS / Isilon implementation of a perfcount module is also attached
as an example.

Comments appreciated.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-S3-Add-in-Isilon-specific-performance-counter-modu.patch
Type: application/octet-stream
Size: 15202 bytes
Desc: 0002-S3-Add-in-Isilon-specific-performance-counter-modu.patch
Url : http://lists.samba.org/archive/samba-technical/attachments/20090203/bcbb3f9e/0002-S3-Add-in-Isilon-specific-performance-counter-modu.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-S3-New-module-interface-for-SMB-message-statistics.patch
Type: application/octet-stream
Size: 32824 bytes
Desc: 0001-S3-New-module-interface-for-SMB-message-statistics.patch
Url : http://lists.samba.org/archive/samba-technical/attachments/20090203/bcbb3f9e/0001-S3-New-module-interface-for-SMB-message-statistics.obj

More information about the samba-technical mailing list