summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_aio_pthread.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-04-08 21:47:38 +0200
committerVolker Lendecke <vl@samba.org>2012-04-09 18:05:01 +0200
commit5f3ac4d6c4754c98e54eed4b09ccd267bb570fa7 (patch)
treeddbf30bb7b01cfb58d23c1ba2e54369e61442265 /source3/modules/vfs_aio_pthread.c
parenteff36099c12e936a880c9f2e102b9cf8a7166d40 (diff)
downloadsamba-5f3ac4d6c4754c98e54eed4b09ccd267bb570fa7.tar.gz
samba-5f3ac4d6c4754c98e54eed4b09ccd267bb570fa7.tar.bz2
samba-5f3ac4d6c4754c98e54eed4b09ccd267bb570fa7.zip
s3: Initialize aio_pending_size from aio_pthread
Diffstat (limited to 'source3/modules/vfs_aio_pthread.c')
-rw-r--r--source3/modules/vfs_aio_pthread.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/source3/modules/vfs_aio_pthread.c b/source3/modules/vfs_aio_pthread.c
index c172ff04b2..1cddea39d4 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,