[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Fri Jan 6 18:19:02 MST 2012


The branch, master has been updated
       via  eff69aa Add "repack" command to tdbtool.
       via  b8b98b8 Remove the commented out code.
       via  d6950d4 Comment out sys_get_number_of_cores() as we're no longer using this.
       via  12bef84 Add "aio num threads" parameter to allow manual configuration of threads via smb.conf if required. Ignore the number of cores. See comments inline.
       via  5cddd22 Fix format warning message.
      from  76ca46e s3: Avoid a potential alignment requirement issue

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


- Log -----------------------------------------------------------------
commit eff69aa0f908f5cb44b3cb846c8a4ada874240fa
Author: Ira Cooper <ira at wakeful.net>
Date:   Fri Jan 6 15:45:06 2012 -0800

    Add "repack" command to tdbtool.
    
    Autobuild-User: Jeremy Allison <jra at samba.org>
    Autobuild-Date: Sat Jan  7 02:18:41 CET 2012 on sn-devel-104

commit b8b98b8908d52a09a5a6ecc36423dc484813a2d5
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Jan 6 14:56:36 2012 -0800

    Remove the commented out code.

commit d6950d4ec9615b8c177da1ca28c5eefb7bca490d
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Jan 6 14:55:30 2012 -0800

    Comment out sys_get_number_of_cores() as we're no longer using this.

commit 12bef8460791903b5f3a195973d0d5e8de895608
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Jan 6 14:33:56 2012 -0800

    Add "aio num threads" parameter to allow manual configuration of
    threads via smb.conf if required. Ignore the number of cores. See
    comments inline.

commit 5cddd22cd8d933cbd4e83edfd518556acaf732f9
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Jan 6 14:25:06 2012 -0800

    Fix format warning message.

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

Summary of changes:
 docs-xml/manpages-3/tdbtool.8.xml |   10 ++++-
 lib/tdb/tools/tdbtool.c           |    7 +++
 source3/include/proto.h           |    2 +
 source3/lib/system.c              |    2 +
 source3/locking/locking.c         |    2 +-
 source3/modules/vfs_aio_pthread.c |   84 +++++++------------------------------
 6 files changed, 37 insertions(+), 70 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages-3/tdbtool.8.xml b/docs-xml/manpages-3/tdbtool.8.xml
index 9f96db2..51fc540 100644
--- a/docs-xml/manpages-3/tdbtool.8.xml
+++ b/docs-xml/manpages-3/tdbtool.8.xml
@@ -201,6 +201,14 @@
 
 		<varlistentry>
 		<term>
+		<option>repack</option>
+		</term>
+		<listitem><para>Repack a database using a temporary file to remove fragmentation.
+		</para></listitem>
+		</varlistentry>
+
+		<varlistentry>
+		<term>
 		<option>quit</option>
 		</term>
 		<listitem><para>Exit <command>tdbtool</command>.
@@ -220,7 +228,7 @@
 
 <refsect1>
 	<title>VERSION</title>
-	<para>This man page is correct for version 3.0.25 of the Samba suite.</para>
+	<para>This man page is correct for version 3.6 of the Samba suite.</para>
 </refsect1>
 
 <refsect1>
diff --git a/lib/tdb/tools/tdbtool.c b/lib/tdb/tools/tdbtool.c
index d93f742..dc5747f 100644
--- a/lib/tdb/tools/tdbtool.c
+++ b/lib/tdb/tools/tdbtool.c
@@ -61,6 +61,7 @@ enum commands {
 	CMD_NEXT,
 	CMD_SYSTEM,
 	CMD_CHECK,
+	CMD_REPACK,
 	CMD_QUIT,
 	CMD_HELP
 };
@@ -98,6 +99,7 @@ COMMAND_TABLE cmd_table[] = {
 	{"quit",	CMD_QUIT},
 	{"q",		CMD_QUIT},
 	{"!",		CMD_SYSTEM},
+	{"repack",	CMD_REPACK},
 	{NULL,		CMD_HELP}
 };
 
@@ -203,6 +205,7 @@ static void help(void)
 "  list                 : print the database hash table and freelist\n"
 "  free                 : print the database freelist\n"
 "  check                : check the integrity of an opened database\n"
+"  repack               : repack the database\n"
 "  speed                : perform speed tests on the database\n"
 "  ! command            : execute system command\n"
 "  1 | first            : print the first record\n"
@@ -608,6 +611,10 @@ static int do_command(void)
 			bIterate = 0;
 			tdb_transaction_commit(tdb);
 			return 0;
+		case CMD_REPACK:
+			bIterate = 0;
+			tdb_repack(tdb);
+			return 0;
 		case CMD_TRANSACTION_CANCEL:
 			bIterate = 0;
 			tdb_transaction_cancel(tdb);
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 9dcd334..2bccaa6 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -390,7 +390,9 @@ int sys_lsetxattr (const char *path, const char *name, const void *value, size_t
 int sys_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags);
 uint32 unix_dev_major(SMB_DEV_T dev);
 uint32 unix_dev_minor(SMB_DEV_T dev);
+#if 0
 int sys_get_number_of_cores(void);
+#endif
 int sys_aio_read(SMB_STRUCT_AIOCB *aiocb);
 int sys_aio_write(SMB_STRUCT_AIOCB *aiocb);
 ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb);
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 6934f62..821dd8d 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -2480,6 +2480,7 @@ uint32 unix_dev_minor(SMB_DEV_T dev)
 #endif
 }
 
+#if 0
 /*******************************************************************
  Return the number of CPUs.
 ********************************************************************/
@@ -2524,6 +2525,7 @@ int sys_get_number_of_cores(void)
 	}
 	return ret;
 }
+#endif
 
 #if defined(WITH_AIO)
 
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 0c457b7..db4f45f 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -503,7 +503,7 @@ char *share_mode_str(TALLOC_CTX *ctx, int num, const struct share_mode_entry *e)
 		 procid_str_static(&e->pid),
 		 e->share_access, e->private_options,
 		 e->access_mask, (unsigned long long)e->op_mid,
-		 e->op_type, e->share_file_id,
+		 e->op_type, (unsigned long long)e->share_file_id,
 		 (unsigned int)e->uid, (unsigned int)e->flags,
 		 file_id_string_tos(&e->id),
 		 (unsigned int)e->name_hash);
diff --git a/source3/modules/vfs_aio_pthread.c b/source3/modules/vfs_aio_pthread.c
index 9217b69..78cea8e 100644
--- a/source3/modules/vfs_aio_pthread.c
+++ b/source3/modules/vfs_aio_pthread.c
@@ -51,77 +51,37 @@ static void aio_pthread_handle_completion(struct event_context *event_ctx,
 
 /************************************************************************
  How many threads to initialize ?
+ 100 per process seems insane as a default until you realize that
+ (a) Threads terminate after 1 second when idle.
+ (b) Throttling is done in SMB2 via the crediting algorithm.
+ (c) SMB1 clients are limited to max_mux (50) outstanding requests and
+     Windows clients don't use this anyway.
+ Essentially we want this to be unlimited unless smb.conf says different.
 ***********************************************************************/
 
-static int aio_get_num_threads(void)
+static int aio_get_num_threads(struct vfs_handle_struct *handle)
 {
-	int num_cores = sys_get_number_of_cores();
-	DEBUG(10,("aio_get_num_threads: sys_get_number_of_cores "
-		"returned %d\n",
-		num_cores));
-	num_cores *= 2;
-	if (num_cores < 1) {
-		num_cores = 1;
-	}
-	/* Even on a single processor box give a little
-	   concurrency. */
-	return MIN(4,num_cores);
+	return lp_parm_bool(SNUM(handle->conn),
+				"aio_pthread",
+				"aio num threads",
+				100);
 }
 
-#if 0
-/************************************************************************
- Called every 30 seconds to destroy pool if it's idle.
-***********************************************************************/
-
-static void idle_pool_destroy_timer(struct tevent_context *ev,
-			struct tevent_timer *te,
-			struct timeval current_time,
-			void *private_data)
-{
-	struct timeval ne;
-
-	TALLOC_FREE(te);
-
-	if (pool && pd_list == NULL) {
-		if (pthreadpool_destroy(pool) == 0) {
-			pool = NULL;
-		}
-		DEBUG(10,("idle_pool_destroy_timer: destroyed AIO pool.\n"));
-		return;
-	}
-
-	/* Here, the IO is still active. */
-
-	/* Set an event up for 30 seconds time - if we have
-	   no outstanding IO at this time shut the threadpool
-	   down. */
-	ne = tevent_timeval_current_ofs(30, 0);
-	tevent_add_timer(server_event_context(),
-			NULL,
-			ne,
-			idle_pool_destroy_timer,
-			NULL);
-}
-#endif
-
 /************************************************************************
  Ensure thread pool is initialized.
 ***********************************************************************/
 
-static bool init_aio_threadpool(void)
+static bool init_aio_threadpool(struct vfs_handle_struct *handle)
 {
 	struct fd_event *sock_event = NULL;
 	int ret = 0;
 	int num_threads;
-#if 0
-	struct timeval ne;
-#endif
 
 	if (pool) {
 		return true;
 	}
 
-	num_threads = aio_get_num_threads();
+	num_threads = aio_get_num_threads(handle);
 	ret = pthreadpool_init(num_threads, &pool);
 	if (ret) {
 		errno = ret;
@@ -139,19 +99,7 @@ static bool init_aio_threadpool(void)
 		return false;
 	}
 
-#if 0
-	/* Set an event up for 30 seconds time - if we have
-	   no outstanding IO at this time shut the threadpool
-	   down. */
-	ne = tevent_timeval_current_ofs(30, 0);
-	tevent_add_timer(server_event_context(),
-			NULL,
-			ne,
-			idle_pool_destroy_timer,
-			NULL);
-#endif
-
-	DEBUG(10,("init_aio_threadpool: initialized with %d threads\n",
+	DEBUG(10,("init_aio_threadpool: initialized with up to %d threads\n",
 			num_threads));
 
 	return true;
@@ -228,7 +176,7 @@ static int aio_pthread_read(struct vfs_handle_struct *handle,
 	struct aio_private_data *pd = NULL;
 	int ret;
 
-	if (!init_aio_threadpool()) {
+	if (!init_aio_threadpool(handle)) {
 		return -1;
 	}
 
@@ -265,7 +213,7 @@ static int aio_pthread_write(struct vfs_handle_struct *handle,
 	struct aio_private_data *pd = NULL;
 	int ret;
 
-	if (!init_aio_threadpool()) {
+	if (!init_aio_threadpool(handle)) {
 		return -1;
 	}
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list