--- /dev/null
+<samba:parameter name="aio max threads"
+ type="integer"
+ context="G"
+ xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
+<description>
+ <para>
+ The integer parameter specifies the maximum number of
+ threads each smbd process will create when doing parallel asynchronous IO
+ calls. If the number of outstanding calls is greater than this
+ number the requests will not be refused but go onto a queue
+ and will be scheduled in turn as outstanding requests complete.
+ </para>
+
+ <related>aio read size</related>
+ <related>aio write size</related>
+</description>
+
+<value type="default">100</value>
+</samba:parameter>
lpcfg_do_global_parameter(lp_ctx, "printjob username", "%U");
+ lpcfg_do_global_parameter(lp_ctx, "aio max threads", "100");
+
/* Allow modules to adjust defaults */
for (defaults_hook = defaults_hooks; defaults_hook;
defaults_hook = defaults_hook->next) {
NULL, struct aio_fork_config,
return -1);
- /*********************************************************************
- * 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.
- *********************************************************************/
- set_aio_pending_size(100);
return 0;
}
goto fail;
}
- if (io_queue_init(get_aio_pending_size(), &io_ctx)) {
+ if (io_queue_init(lp_aio_max_threads(), &io_ctx)) {
goto fail;
}
DEBUG(10,("init_aio_linux: initialized with up to %d events\n",
- get_aio_pending_size()));
+ (int)lp_aio_max_threads()));
return true;
return aio_linux_recv(req, err);
}
-static int aio_linux_connect(vfs_handle_struct *handle, const char *service,
- const char *user)
-{
- /*********************************************************************
- * How many io_events to initialize ?
- * 128 per process seems insane as a default until you realize that
- * (a) Throttling is done in SMB2 via the crediting algorithm.
- * (b) 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.
- *********************************************************************/
- set_aio_pending_size(lp_parm_int(
- SNUM(handle->conn), "aio_linux", "aio num events", 128));
- return SMB_VFS_NEXT_CONNECT(handle, service, user);
-}
-
static struct vfs_fn_pointers vfs_aio_linux_fns = {
- .connect_fn = aio_linux_connect,
.pread_send_fn = aio_linux_pread_send,
.pread_recv_fn = aio_linux_recv,
.pwrite_send_fn = aio_linux_pwrite_send,
return true;
}
- ret = pthreadpool_init(get_aio_pending_size(), pp_pool);
+ ret = pthreadpool_init(lp_aio_max_threads(), pp_pool);
if (ret) {
errno = ret;
return false;
}
DEBUG(10,("init_aio_threadpool: initialized with up to %d threads\n",
- get_aio_pending_size()));
+ (int)lp_aio_max_threads()));
return true;
}
return true;
}
- ret = asys_context_init(&ctx, get_aio_pending_size());
+ ret = asys_context_init(&ctx, lp_aio_max_threads());
if (ret != 0) {
DEBUG(1, ("asys_context_init failed: %s\n", strerror(ret)));
return false;
Globals.web_port = 901;
+ Globals.aio_max_threads = 100;
+
/* Now put back the settings that were set with lp_set_cmdline() */
apply_lp_set_cmdline();
}
Statics plus accessor functions.
*****************************************************************************/
-static int aio_pending_size = 100; /* Current max threads. */
static int outstanding_aio_calls;
-int get_aio_pending_size(void)
-{
- return aio_pending_size;
-}
-
-void set_aio_pending_size(int newsize)
-{
- aio_pending_size = newsize;
-}
-
int get_outstanding_aio_calls(void)
{
return outstanding_aio_calls;
/* The following definitions come from smbd/aio.c */
-int get_aio_pending_size(void);
-void set_aio_pending_size(int newsize);
int get_outstanding_aio_calls(void);
void increment_outstanding_aio_calls(void);
void decrement_outstanding_aio_calls(void);