[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-690-g1696298

Tim Prouty tprouty at samba.org
Mon Feb 9 21:25:21 GMT 2009


The branch, master has been updated
       via  1696298aad3f84b6cd9008bb2684db572b34dfb5 (commit)
       via  f8c0d2fe010e06bed02fab7f51e000907535416a (commit)
       via  54c51a66e3e31c70a641d7efac2d4b08c3007278 (commit)
      from  98a4327b19e83ffad4e0be7e8895fdbd9e48d49f (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 1696298aad3f84b6cd9008bb2684db572b34dfb5
Author: Tim Prouty <tprouty at samba.org>
Date:   Mon Feb 9 09:36:40 2009 -0800

    s3 async: Fix the build on systems that have ETIMEDOUT but not ETIME
    
    Fallback on EAGAIN

commit f8c0d2fe010e06bed02fab7f51e000907535416a
Author: todd stecher <todd.stecher at gmail.com>
Date:   Sun Feb 8 23:12:02 2009 -0800

    S3 OneFS: Add in Isilon specific performance counter module

commit 54c51a66e3e31c70a641d7efac2d4b08c3007278
Author: todd stecher <todd.stecher at gmail.com>
Date:   Sun Feb 8 23:10:34 2009 -0800

    S3: New module interface for SMB message statistics gathering
    
    This changelist allows for the addition of custom performance
    monitoring modules through smb.conf. Entrypoints in the main message
    processing code have been added to capture the command, subop, ioctl,
    identity and message size statistics.

-----------------------------------------------------------------------

Summary of changes:
 docs-xml/smbdotconf/misc/perfcountmodule.xml |   13 +
 lib/async_req/async_sock.c                   |    4 +-
 source3/Makefile.in                          |   13 +-
 source3/configure.in                         |    5 +-
 source3/include/includes.h                   |    1 +
 source3/include/proto.h                      |    5 +-
 source3/include/smb.h                        |    3 +
 source3/include/smb_perfcount.h              |  106 +++++++
 source3/lib/util_sock.c                      |   11 +-
 source3/modules/perfcount_onefs.c            |  415 ++++++++++++++++++++++++++
 source3/param/loadparm.c                     |   11 +
 source3/smbd/aio.c                           |    8 +-
 source3/smbd/blocking.c                      |    6 +-
 source3/smbd/ipc.c                           |    9 +-
 source3/smbd/notify.c                        |    2 +-
 source3/smbd/nttrans.c                       |    8 +-
 source3/smbd/oplock.c                        |    9 +-
 source3/smbd/perfcount.c                     |  192 ++++++++++++
 source3/smbd/pipes.c                         |    3 +-
 source3/smbd/process.c                       |   61 +++-
 source3/smbd/reply.c                         |   10 +-
 source3/smbd/trans2.c                        |    5 +-
 22 files changed, 855 insertions(+), 45 deletions(-)
 create mode 100644 docs-xml/smbdotconf/misc/perfcountmodule.xml
 create mode 100644 source3/include/smb_perfcount.h
 create mode 100644 source3/modules/perfcount_onefs.c
 create mode 100644 source3/smbd/perfcount.c


Changeset truncated at 500 lines:

diff --git a/docs-xml/smbdotconf/misc/perfcountmodule.xml b/docs-xml/smbdotconf/misc/perfcountmodule.xml
new file mode 100644
index 0000000..f22c399
--- /dev/null
+++ b/docs-xml/smbdotconf/misc/perfcountmodule.xml
@@ -0,0 +1,13 @@
+<samba:parameter name="perfcount module"
+		 context="G"
+		 type="string"
+		 advanced="1"
+		 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
+<description>
+	<para>This parameter specifies the perfcount backend to be used when monitoring SMB
+	operations.  Only one perfcount module may be used, and it must implement all of the
+	apis contained in the smb_perfcount_handler structure defined in smb.h.
+	</para>
+</description>
+
+</samba:parameter>
diff --git a/lib/async_req/async_sock.c b/lib/async_req/async_sock.c
index 46ad29d..02ae880 100644
--- a/lib/async_req/async_sock.c
+++ b/lib/async_req/async_sock.c
@@ -116,10 +116,10 @@ bool async_req_is_errno(struct async_req *req, int *err)
 		*err = (int)error;
 		break;
 	case ASYNC_REQ_TIMED_OUT:
-#ifdef HAVE_ETIMEDOUT
+#ifdef ETIMEDOUT
 		*err = ETIMEDOUT;
 #else
-		*err = EIO;
+		*err = EAGAIN;
 #endif
 		break;
 	case ASYNC_REQ_NO_MEMORY:
diff --git a/source3/Makefile.in b/source3/Makefile.in
index ee75eb3..942c5b3 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -108,6 +108,7 @@ MODULESDIR = @modulesdir@
 INCLUDEDIR=@includedir@
 PAMMODULESDIR = @pammodulesdir@
 VFSLIBDIR = $(MODULESDIR)/vfs
+PERFCOUNTLIBDIR = $(MODULESDIR)/perfcount
 PDBLIBDIR = $(MODULESDIR)/pdb
 RPCLIBDIR = $(MODULESDIR)/rpc
 IDMAPLIBDIR = $(MODULESDIR)/idmap
@@ -220,6 +221,7 @@ NSS_MODULES = @NSS_MODULES@
 SCRIPTS = $(srcdir)/script/smbtar $(builddir)/script/findsmb
 
 VFS_MODULES = @VFS_MODULES@
+PERFCOUNT_MODULES = @PERFCOUNT_MODULES@
 PDB_MODULES = @PDB_MODULES@
 RPC_MODULES = @RPC_MODULES@
 IDMAP_MODULES = @IDMAP_MODULES@
@@ -229,7 +231,7 @@ NSS_INFO_MODULES = @NSS_INFO_MODULES@
 GPEXT_MODULES = @GPEXT_MODULES@
 MODULES = $(VFS_MODULES) $(PDB_MODULES) $(RPC_MODULES) $(IDMAP_MODULES) \
           $(CHARSET_MODULES) $(AUTH_MODULES) $(NSS_INFO_MODULES) \
-	  $(GPEXT_MODULES)
+	  $(GPEXT_MODULES) $(PERFCOUNT_MODULES)
 
 EXTRA_ALL_TARGETS = @EXTRA_ALL_TARGETS@
 
@@ -663,6 +665,7 @@ VFS_ACL_TDB_OBJ = modules/vfs_acl_tdb.o
 VFS_SMB_TRAFFIC_ANALYZER_OBJ = modules/vfs_smb_traffic_analyzer.o
 VFS_ONEFS_OBJ = modules/vfs_onefs.o modules/onefs_acl.o modules/onefs_system.o \
 		modules/onefs_open.o modules/onefs_streams.o
+PERFCOUNT_ONEFS_OBJ = modules/perfcount_onefs.o
 
 PLAINTEXT_AUTH_OBJ = auth/pampass.o auth/pass_check.o
 
@@ -698,7 +701,7 @@ SMBD_OBJ_SRV = smbd/files.o smbd/chgpasswd.o smbd/connection.o \
                smbd/reply.o smbd/sesssetup.o smbd/trans2.o smbd/uid.o \
 	       smbd/dosmode.o smbd/filename.o smbd/open.o smbd/close.o \
 	       smbd/blocking.o smbd/sec_ctx.o smbd/srvstr.o \
-	       smbd/vfs.o smbd/statcache.o smbd/seal.o \
+	       smbd/vfs.o smbd/perfcount.o smbd/statcache.o smbd/seal.o \
                smbd/posix_acls.o lib/sysacls.o $(SERVER_MUTEX_OBJ) \
 	       smbd/process.o smbd/service.o smbd/error.o \
 	       printing/printfsp.o lib/sysquotas.o lib/sysquotas_linux.o \
@@ -2553,6 +2556,10 @@ bin/onefs. at SHLIBEXT@: $(BINARY_PREREQS) $(VFS_ONEFS_OBJ)
 	@echo "Building plugin $@"
 	@$(SHLD_MODULE) $(VFS_ONEFS_OBJ) @ONEFS_LIBS@
 
+bin/pc_onefs. at SHLIBEXT@: $(BINARY_PREREQS) $(PERFCOUNT_ONEFS_OBJ)
+	@echo "Building plugin $@"
+	@$(SHLD_MODULE) $(PERFCOUNT_ONEFS_OBJ)
+
 bin/registry. at SHLIBEXT@: $(BINARY_PREREQS) libgpo/gpext/registry.o
 	@echo "Building plugin $@"
 	@$(SHLD_MODULE) libgpo/gpext/registry.o
@@ -2689,6 +2696,7 @@ installmodules:: modules installdirs
 	@$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(prefix) $(CHARSETLIBDIR) $(CHARSET_MODULES)
 	@$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(prefix) $(AUTHLIBDIR) $(AUTH_MODULES)
 	@$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(prefix) $(GPEXTLIBDIR) $(GPEXT_MODULES)
+	@$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(prefix) $(PERFCOUNTLIBDIR) $(PERFCOUNT_MODULES)
 	@$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(PDBLIBDIR) ldapsam. at SHLIBEXT@ NDS_ldapsam. at SHLIBEXT@
 	@$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(PDBLIBDIR) ldapsam. at SHLIBEXT@ NDS_ldapsam_compat. at SHLIBEXT@
 	@$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(PDBLIBDIR) ldapsam. at SHLIBEXT@ ldapsam_compat. at SHLIBEXT@
@@ -2780,6 +2788,7 @@ uninstallmodules::
 	@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(prefix) $(CHARSETLIBDIR) $(CHARSET_MODULES)
 	@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(prefix) $(AUTHLIBDIR) $(AUTH_MODULES)
 	@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(prefix) $(GPEXTLIBDIR) $(GPEXT_MODULES)
+	@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(prefix) $(PERFCOUNTLIBDIR) $(PERFCOUNT_MODULES)
 
 uninstallscripts::
 	@$(SHELL) $(srcdir)/script/uninstallscripts.sh $(INSTALLPERMS_BIN) $(DESTDIR)$(BINDIR) $(SCRIPTS)
diff --git a/source3/configure.in b/source3/configure.in
index 37ee9a1..b81e768 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -1097,7 +1097,7 @@ AC_TRY_LINK([#include <isi_version/isi_version.h>],
 echo $samba_cv_HAVE_ONEFS
 if test x"$samba_cv_HAVE_ONEFS" = x"yes"; then
     AC_DEFINE(HAVE_ONEFS,1,[Whether building on Isilon OneFS])
-    default_shared_modules="$default_shared_modules vfs_onefs"
+    default_shared_modules="$default_shared_modules vfs_onefs perfcount_onefs"
     ONEFS_LIBS="-lisi_acl"
 fi
 AC_SUBST(ONEFS_LIBS)
@@ -6419,6 +6419,9 @@ SMB_MODULE(vfs_onefs, \$(VFS_ONEFS), "bin/onefs.$SHLIBEXT", VFS)
 
 SMB_SUBSYSTEM(VFS,smbd/vfs.o)
 
+SMB_MODULE(perfcount_onefs, \$(PERFCOUNT_ONEFS), "bin/pc_onefs.$SHLIBEXT", PERFCOUNT)
+SMB_SUBSYSTEM(PERFCOUNT,smbd/perfcount.o)
+
 SMB_MODULE(gpext_registry, libgpo/gpext/registry.o, "bin/registry.$SHLIBEXT", GPEXT)
 SMB_MODULE(gpext_scripts, libgpo/gpext/scripts.o, "bin/scripts.$SHLIBEXT", GPEXT)
 SMB_MODULE(gpext_security, libgpo/gpext/security.o, "bin/security.$SHLIBEXT", GPEXT)
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 930df6e..095fcaa 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -597,6 +597,7 @@ struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx);
 #include "privileges.h"
 #include "messages.h"
 #include "locking.h"
+#include "smb_perfcount.h"
 #include "smb.h"
 #include "nameserv.h"
 #include "secrets.h"
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 537eb98..7deaff3 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4358,6 +4358,8 @@ void lp_set_posix_pathnames(void);
 enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp);
 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val);
 int lp_min_receive_file_size(void);
+char* lp_smb_perfcount_module(void);
+
 
 /* The following definitions come from param/params.c  */
 
@@ -6978,7 +6980,8 @@ SEC_DESC *get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname);
 
 void smbd_setup_sig_term_handler(void);
 void smbd_setup_sig_hup_handler(void);
-bool srv_send_smb(int fd, char *buffer, bool do_encrypt);
+bool srv_send_smb(int fd, char *buffer, bool do_encrypt,
+		  struct smb_perfcount_data *pcd);
 int srv_set_message(char *buf,
                         int num_words,
                         int num_bytes,
diff --git a/source3/include/smb.h b/source3/include/smb.h
index eaf09dd..3da63cf 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -613,6 +613,7 @@ struct current_user {
 	NT_USER_TOKEN *nt_user_token;
 };
 
+
 struct smb_request {
 	uint8_t cmd;
 	uint16 flags2;
@@ -640,6 +641,7 @@ struct smb_request {
 	size_t unread_bytes;
 	bool encrypted;
 	connection_struct *conn;
+	struct smb_perfcount_data pcd;
 
 	/*
 	 * Chained request handling
@@ -717,6 +719,7 @@ struct pending_message_list {
 	struct pending_message_list *next, *prev;
 	struct timeval request_time; /* When was this first issued? */
 	struct timed_event *te;
+	struct smb_perfcount_data pcd;
 	bool encrypted;
 	DATA_BLOB buf;
 	DATA_BLOB private_data;
diff --git a/source3/include/smb_perfcount.h b/source3/include/smb_perfcount.h
new file mode 100644
index 0000000..218045b
--- /dev/null
+++ b/source3/include/smb_perfcount.h
@@ -0,0 +1,106 @@
+/*
+   Unix SMB/CIFS implementation.
+   Portable SMB Messaging statistics interfaces
+   Copyright (C) Todd Stecher (2008)
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _SMB_PERFCOUNT_H_
+#define _SMB_PERFCOUNT_H_
+
+#define SMB_PERFCOUNTER_INTERFACE_VERSION	1
+
+struct smb_perfcount_data{
+	struct smb_perfcount_handlers *handlers;
+	void *context;
+};
+
+struct smb_perfcount_handlers {
+	void (*perfcount_start) (struct smb_perfcount_data *pcd);
+	void (*perfcount_add) (struct smb_perfcount_data *pcd);
+	void (*perfcount_set_op) (struct smb_perfcount_data *pcd, int op);
+	void (*perfcount_set_subop) (struct smb_perfcount_data *pcd, int subop);
+	void (*perfcount_set_ioctl) (struct smb_perfcount_data *pcd, int io_ctl);
+	void (*perfcount_set_msglen_in) (struct smb_perfcount_data *pcd,
+				         uint64_t in_bytes);
+	void (*perfcount_set_msglen_out) (struct smb_perfcount_data *pcd,
+				          uint64_t out_bytes);
+	void (*perfcount_set_client) (struct smb_perfcount_data *pcd, uid_t uid,
+				      const char *user, const char *domain);
+	void (*perfcount_defer_op) (struct smb_perfcount_data *pcd,
+				    struct smb_perfcount_data *def_pcd);
+	void (*perfcount_end) (struct smb_perfcount_data *pcd);
+};
+
+bool smb_perfcount_init(void);
+
+NTSTATUS smb_register_perfcounter(int interface_version, const char *name,
+			          const struct smb_perfcount_handlers *handlers);
+
+void smb_init_perfcount_data(struct smb_perfcount_data *pcd);
+
+#define SMB_PERFCOUNT_START(_pcd_) \
+    do {if((_pcd_) && (_pcd_)->handlers) \
+	    (_pcd_)->handlers->perfcount_start((_pcd_)); \
+    } while (0)
+
+#define SMB_PERFCOUNT_ADD(_pcd_) \
+    do {if((_pcd_) && (_pcd_)->handlers) \
+	    (_pcd_)->handlers->perfcount_add((_pcd_)); \
+    } while (0)
+
+#define SMB_PERFCOUNT_SET_OP(_pcd_,_op_) \
+    do {if((_pcd_) && (_pcd_)->handlers) \
+	    (_pcd_)->handlers->perfcount_set_op((_pcd_), (_op_)); \
+    } while (0)
+
+#define SMB_PERFCOUNT_SET_SUBOP(_pcd_,_subop_) \
+    do {if((_pcd_) && (_pcd_)->handlers) \
+	    (_pcd_)->handlers->perfcount_set_subop((_pcd_), (_subop_)); \
+    } while (0)
+
+#define SMB_PERFCOUNT_SET_IOCTL(_pcd_,_subop_) \
+    do {if((_pcd_) && (_pcd_)->handlers) \
+	    (_pcd_)->handlers->perfcount_set_ioctl((_pcd_), (_subop_)); \
+    } while (0)
+
+#define SMB_PERFCOUNT_SET_MSGLEN_IN(_pcd_,_in_) \
+    do {if((_pcd_) && (_pcd_)->handlers) \
+	    (_pcd_)->handlers->perfcount_set_msglen_in((_pcd_), (_in_));\
+    } while (0)
+
+#define SMB_PERFCOUNT_SET_MSGLEN_OUT(_pcd_,_out_) \
+    do {if((_pcd_) && (_pcd_)->handlers) \
+	    (_pcd_)->handlers->perfcount_set_msglen_out((_pcd_), (_out_));\
+    } while (0)
+
+
+#define SMB_PERFCOUNT_SET_CLIENT(_pcd_,_uid_, _user_, _domain_) \
+    do {if((_pcd_) && (_pcd_)->handlers) \
+	    (_pcd_)->handlers->perfcount_set_client((_pcd_), (_uid_), \
+	       (_user_), (_domain_)); \
+    } while (0)
+
+#define SMB_PERFCOUNT_DEFER_OP(_pcd_, _def_pcd_) \
+    do {if((_pcd_) && (_pcd_)->handlers) \
+	    (_pcd_)->handlers->perfcount_defer_op((_pcd_), (_def_pcd_)); \
+    } while (0)
+
+#define SMB_PERFCOUNT_END(_pcd_) \
+    do {if((_pcd_) && (_pcd_)->handlers) \
+	    (_pcd_)->handlers->perfcount_end((_pcd_));\
+    } while (0)
+
+#endif /* _SMB_PERFCOUNT_H_ */
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index b9a7f87..c46aa2a 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -1061,10 +1061,13 @@ static void open_socket_out_connected(struct async_req *subreq)
 		return;
 	}
 
-	if ((sys_errno == ETIME)
-	    || (sys_errno == EINPROGRESS)
-	    || (sys_errno == EALREADY)
-	    || (sys_errno == EAGAIN)) {
+	if (
+#ifdef ETIMEDOUT
+		(sys_errno == ETIMEDOUT) ||
+#endif
+		(sys_errno == EINPROGRESS) ||
+		(sys_errno == EALREADY) ||
+		(sys_errno == EAGAIN)) {
 
 		/*
 		 * retry
diff --git a/source3/modules/perfcount_onefs.c b/source3/modules/perfcount_onefs.c
new file mode 100644
index 0000000..a4fbe6a
--- /dev/null
+++ b/source3/modules/perfcount_onefs.c
@@ -0,0 +1,415 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * Support for OneFS protocol statistics / perfcounters
+ *
+ * Copyright (C) Todd Stecher 2008
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "includes.h"
+#include <sys/isi_stats_protocol.h>
+#include <sys/isi_stats_cifs.h>
+
+struct onefs_op_counter {
+	struct isp_op_delta iod;
+	struct onefs_op_counter *next;
+	struct onefs_op_counter *prev;
+};
+
+struct onefs_stats_context {
+	bool deferred;
+	struct isp_op_delta iod;
+
+	/* ANDX commands stats stored here */
+	struct onefs_op_counter *ops_chain;
+};
+
+const char *onefs_stat_debug(struct isp_op_delta *iod);
+
+struct onefs_stats_context g_context;
+
+static void onefs_smb_statistics_end(struct smb_perfcount_data *pcd);
+
+struct isp_op_delta *onefs_stats_get_op_delta(struct onefs_stats_context *ctxt)
+{
+	/* operate on head of chain */
+	if (ctxt->ops_chain) {
+#ifdef ONEFS_PERF_DEBUG
+		DEBUG(0,("************* CHAINED *****\n"));
+#endif
+		return &ctxt->ops_chain->iod;
+	} else
+		return &ctxt->iod;
+}
+
+/* statistics operations */
+static void onefs_smb_statistics_start(struct smb_perfcount_data *pcd)
+{
+
+#ifdef ONEFS_PERF_DEBUG
+	if (g_context.iod.op) {
+		DEBUG(0,("**************** OP Collision! %s(%d) \n",
+			onefs_stat_debug(&g_context.iod), g_context.iod.op));
+	}
+
+#endif
+
+        ISP_OP_BEG(&g_context.iod, ISP_PROTO_CIFS, 0);
+
+        if (g_context.iod.enabled)
+		pcd->context = &g_context;
+	else
+		pcd->context = NULL;
+
+
+}
+
+static void onefs_smb_statistics_add(struct smb_perfcount_data *pcd)
+{
+	struct onefs_op_counter *oc;
+	struct onefs_stats_context *ctxt = pcd->context;
+
+        /* not enabled */
+        if (pcd->context == NULL)
+                return;
+
+	oc = SMB_MALLOC_P(struct onefs_op_counter);
+
+	if (oc == NULL)
+		return;
+
+#ifdef ONEFS_PERF_DEBUG
+	DEBUG(0,("*********** add chained op \n"));
+#endif
+
+	DLIST_ADD(ctxt->ops_chain, oc);
+        ISP_OP_BEG(&oc->iod, ISP_PROTO_CIFS, 0);
+}
+
+static void onefs_smb_statistics_set_op(struct smb_perfcount_data *pcd, int op)
+{
+	struct onefs_stats_context *ctxt = pcd->context;
+	struct isp_op_delta *iod;
+
+        /* not enabled */
+        if (pcd->context == NULL)
+                return;
+
+
+	iod = onefs_stats_get_op_delta(ctxt);
+	iod->op = isp_cifs_op_id(op);
+
+#ifdef ONEFS_PERF_DEBUG
+	DEBUG(0,("***********SET op %s(%d)\n", onefs_stat_debug(iod), op));
+#endif
+	/* no reply required */
+	if (op == SMBntcancel)
+		onefs_smb_statistics_end(pcd);
+
+}
+
+static void onefs_smb_statistics_set_subop(struct smb_perfcount_data *pcd,
+					   int subop)
+{
+	struct onefs_stats_context *ctxt = pcd->context;
+	struct isp_op_delta *iod;
+
+        /* not enabled */
+        if (pcd->context == NULL)
+                return;
+
+	iod = onefs_stats_get_op_delta(ctxt);
+	iod->op = isp_cifs_sub_op_id(iod->op, subop);
+
+#ifdef ONEFS_PERF_DEBUG
+	DEBUG(0,("********************  SET subop %s(%d)\n",
+		onefs_stat_debug(iod), subop));
+#endif
+
+	/*
+	 * finalize this one - we don't need to know when it
+	 * is set, but its useful as a counter
+	 */
+	if (subop == NT_TRANSACT_NOTIFY_CHANGE)
+		onefs_smb_statistics_end(pcd);
+}
+
+static void onefs_smb_statistics_set_ioctl(struct smb_perfcount_data *pcd,
+					   int io_ctl)
+{
+	struct onefs_stats_context *ctxt = pcd->context;
+	struct isp_op_delta *iod;
+
+        /* not enabled */
+        if (pcd->context == NULL)
+                return;
+
+	/* we only monitor shadow copy */
+	if (io_ctl != FSCTL_GET_SHADOW_COPY_DATA)
+		return;
+
+	iod = onefs_stats_get_op_delta(ctxt);
+	iod->op = isp_cifs_sub_op_id(iod->op, ISP_CIFS_NTRN_IOCTL_FGSCD);
+#ifdef ONEFS_PERF_DEBUG


-- 
Samba Shared Repository


More information about the samba-cvs mailing list