[SCM] Samba Shared Repository - branch master updated
Volker Lendecke
vlendec at samba.org
Mon Apr 9 11:40:03 MDT 2012
The branch, master has been updated
via 5184f41 libreplace: We have a poll replacement based on select
via 670e85f tevent: Fix a typo
via 8a907c9 s3: Fix the pthreadpool build on OS/X
via 5856ab8 s3: Initialize aio_pending_size from aio_pthread
via 5f3ac4d s3: Initialize aio_pending_size from aio_pthread
via eff3609 s3: Move the aio signal init to the vfs module
from 7da56a1 autobuild: Also test a distribution-style build with external libs
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 5184f41cd8f51fd426bb6b7d6fea657df44dd8a4
Author: Volker Lendecke <vl at samba.org>
Date: Mon Apr 9 00:44:38 2012 +0200
libreplace: We have a poll replacement based on select
Autobuild-User: Volker Lendecke <vl at samba.org>
Autobuild-Date: Mon Apr 9 19:39:51 CEST 2012 on sn-devel-104
commit 670e85fde6b5f4970d5e9464446d1a67ee0d0afe
Author: Volker Lendecke <vl at samba.org>
Date: Mon Apr 9 00:40:38 2012 +0200
tevent: Fix a typo
commit 8a907c9c6563d9b1df35d31390bd07f76758773c
Author: Volker Lendecke <vl at samba.org>
Date: Mon Apr 9 09:17:29 2012 +0200
s3: Fix the pthreadpool build on OS/X
OS/X does not have clock_gettime, and without replace.h we do not
get the replacement macro
commit 5856ab89fa2f5736af641bc05102ad47390e84b7
Author: Volker Lendecke <vl at samba.org>
Date: Sun Apr 8 21:49:59 2012 +0200
s3: Initialize aio_pending_size from aio_pthread
commit 5f3ac4d6c4754c98e54eed4b09ccd267bb570fa7
Author: Volker Lendecke <vl at samba.org>
Date: Sun Apr 8 21:47:38 2012 +0200
s3: Initialize aio_pending_size from aio_pthread
commit eff36099c12e936a880c9f2e102b9cf8a7166d40
Author: Volker Lendecke <vl at samba.org>
Date: Sun Apr 8 20:11:53 2012 +0200
s3: Move the aio signal init to the vfs module
On platforms that don't have an RT signal space, signal initialization
fails. aio_fork and aio_pthread don't need the signal, so this would
block them from running as well.
-----------------------------------------------------------------------
Summary of changes:
lib/replace/README | 1 +
lib/tevent/tevent_poll.c | 2 +-
source3/lib/pthreadpool/pthreadpool.c | 1 +
source3/modules/vfs_aio_fork.c | 19 +++++++++++++++
source3/modules/vfs_aio_pthread.c | 41 +++++++++++++++++---------------
source3/modules/vfs_default.c | 8 ++++++
source3/smbd/aio.c | 28 +++++-----------------
source3/smbd/proto.h | 1 +
8 files changed, 60 insertions(+), 41 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/replace/README b/lib/replace/README
index bf4e67f..787ee85 100644
--- a/lib/replace/README
+++ b/lib/replace/README
@@ -72,6 +72,7 @@ link
readlink
symlink
realpath
+poll
Types:
bool
diff --git a/lib/tevent/tevent_poll.c b/lib/tevent/tevent_poll.c
index 0a9c0f0..d2e45c8 100644
--- a/lib/tevent/tevent_poll.c
+++ b/lib/tevent/tevent_poll.c
@@ -177,7 +177,7 @@ static void poll_event_set_fd_flags(struct tevent_fd *fde, uint16_t flags)
}
/*
- event loop handling using select()
+ event loop handling using poll()
*/
static int poll_event_loop_poll(struct tevent_context *ev,
struct timeval *tvalp)
diff --git a/source3/lib/pthreadpool/pthreadpool.c b/source3/lib/pthreadpool/pthreadpool.c
index fffbd05..0430377 100644
--- a/source3/lib/pthreadpool/pthreadpool.c
+++ b/source3/lib/pthreadpool/pthreadpool.c
@@ -28,6 +28,7 @@
#include <fcntl.h>
#include "system/time.h"
#include "system/filesys.h"
+#include "replace.h"
#include "pthreadpool.h"
#include "lib/util/dlinklist.h"
diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c
index 0d928cb..d10cc9f 100644
--- a/source3/modules/vfs_aio_fork.c
+++ b/source3/modules/vfs_aio_fork.c
@@ -23,6 +23,7 @@
#include "system/filesys.h"
#include "system/shmem.h"
#include "smbd/smbd.h"
+#include "smbd/globals.h"
#ifndef MAP_FILE
#define MAP_FILE 0
@@ -879,7 +880,25 @@ static int aio_fork_suspend(struct vfs_handle_struct *handle,
return ret;
}
+static int aio_fork_connect(vfs_handle_struct *handle, const char *service,
+ const char *user)
+{
+ /*********************************************************************
+ * 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.
+ *********************************************************************/
+ aio_pending_size = 100;
+ return SMB_VFS_NEXT_CONNECT(handle, service, user);
+}
+
static struct vfs_fn_pointers vfs_aio_fork_fns = {
+ .connect_fn = aio_fork_connect,
.aio_read_fn = aio_fork_read,
.aio_write_fn = aio_fork_write,
.aio_return_fn = aio_fork_return_fn,
diff --git a/source3/modules/vfs_aio_pthread.c b/source3/modules/vfs_aio_pthread.c
index c172ff0..1cddea3 100644
--- a/source3/modules/vfs_aio_pthread.c
+++ b/source3/modules/vfs_aio_pthread.c
@@ -25,6 +25,7 @@
#include "system/filesys.h"
#include "system/shmem.h"
#include "smbd/smbd.h"
+#include "smbd/globals.h"
#include "lib/pthreadpool/pthreadpool.h"
struct aio_extra;
@@ -49,21 +50,6 @@ static void aio_pthread_handle_completion(struct event_context *event_ctx,
uint16 flags,
void *p);
-/************************************************************************
- 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(struct vfs_handle_struct *handle)
-{
- return lp_parm_int(SNUM(handle->conn),
- "aio_pthread", "aio num threads", 100);
-}
/************************************************************************
Ensure thread pool is initialized.
@@ -73,14 +59,12 @@ static bool init_aio_threadpool(struct vfs_handle_struct *handle)
{
struct fd_event *sock_event = NULL;
int ret = 0;
- int num_threads;
if (pool) {
return true;
}
- num_threads = aio_get_num_threads(handle);
- ret = pthreadpool_init(num_threads, &pool);
+ ret = pthreadpool_init(aio_pending_size, &pool);
if (ret) {
errno = ret;
return false;
@@ -98,7 +82,7 @@ static bool init_aio_threadpool(struct vfs_handle_struct *handle)
}
DEBUG(10,("init_aio_threadpool: initialized with up to %d threads\n",
- num_threads));
+ aio_pending_size));
return true;
}
@@ -608,7 +592,26 @@ static int aio_pthread_suspend(struct vfs_handle_struct *handle,
return ret;
}
+static int aio_pthread_connect(vfs_handle_struct *handle, const char *service,
+ const char *user)
+{
+ /*********************************************************************
+ * 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.
+ *********************************************************************/
+ aio_pending_size = lp_parm_int(
+ SNUM(handle->conn), "aio_pthread", "aio num threads", 100);
+ return SMB_VFS_NEXT_CONNECT(handle, service, user);
+}
+
static struct vfs_fn_pointers vfs_aio_pthread_fns = {
+ .connect_fn = aio_pthread_connect,
.aio_read_fn = aio_pthread_read,
.aio_write_fn = aio_pthread_write,
.aio_return_fn = aio_pthread_return_fn,
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 915eae6..dd54417 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -2059,6 +2059,10 @@ static int vfswrap_fsetxattr(struct vfs_handle_struct *handle, struct files_stru
static int vfswrap_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
{
int ret;
+ if (!initialize_async_io_handler()) {
+ errno = ENOSYS;
+ return -1;
+ }
/*
* aio_read must be done as root, because in the glibc aio
* implementation the helper thread needs to be able to send a signal
@@ -2074,6 +2078,10 @@ static int vfswrap_aio_read(struct vfs_handle_struct *handle, struct files_struc
static int vfswrap_aio_write(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
{
int ret;
+ if (!initialize_async_io_handler()) {
+ errno = ENOSYS;
+ return -1;
+ }
/*
* aio_write must be done as root, because in the glibc aio
* implementation the helper thread needs to be able to send a signal
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index 000206a..e5347a4 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -71,7 +71,7 @@ static void smbd_aio_signal_handler(struct tevent_context *ev_ctx,
}
-static bool initialize_async_io_handler(void)
+bool initialize_async_io_handler(void)
{
static bool tried_signal_setup = false;
@@ -156,11 +156,6 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
size_t min_aio_read_size = lp_aio_read_size(SNUM(conn));
int ret;
- /* Ensure aio is initialized. */
- if (!initialize_async_io_handler()) {
- return NT_STATUS_RETRY;
- }
-
if (fsp->base_fsp != NULL) {
/* No AIO on streams yet */
DEBUG(10, ("AIO on streams not yet supported\n"));
@@ -263,11 +258,6 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
size_t min_aio_write_size = lp_aio_write_size(SNUM(conn));
int ret;
- /* Ensure aio is initialized. */
- if (!initialize_async_io_handler()) {
- return NT_STATUS_RETRY;
- }
-
if (fsp->base_fsp != NULL) {
/* No AIO on streams yet */
DEBUG(10, ("AIO on streams not yet supported\n"));
@@ -426,11 +416,6 @@ NTSTATUS schedule_smb2_aio_read(connection_struct *conn,
size_t min_aio_read_size = lp_aio_read_size(SNUM(conn));
int ret;
- /* Ensure aio is initialized. */
- if (!initialize_async_io_handler()) {
- return NT_STATUS_RETRY;
- }
-
if (fsp->base_fsp != NULL) {
/* No AIO on streams yet */
DEBUG(10, ("AIO on streams not yet supported\n"));
@@ -532,11 +517,6 @@ NTSTATUS schedule_aio_smb2_write(connection_struct *conn,
size_t min_aio_write_size = lp_aio_write_size(SNUM(conn));
int ret;
- /* Ensure aio is initialized. */
- if (!initialize_async_io_handler()) {
- return NT_STATUS_RETRY;
- }
-
if (fsp->base_fsp != NULL) {
/* No AIO on streams yet */
DEBUG(10, ("AIO on streams not yet supported\n"));
@@ -1058,6 +1038,12 @@ void cancel_aio_by_fsp(files_struct *fsp)
}
#else
+
+bool initialize_async_io_handler(void)
+{
+ return false;
+}
+
NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
struct smb_request *smbreq,
files_struct *fsp, off_t startpos,
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index ca267a0..5ab5185 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -64,6 +64,7 @@ void srv_set_signing(struct smbd_server_connection *conn,
/* The following definitions come from smbd/aio.c */
+bool initialize_async_io_handler(void);
NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
struct smb_request *req,
files_struct *fsp, off_t startpos,
--
Samba Shared Repository
More information about the samba-cvs
mailing list