1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

s3: smbd: Remove aio_pending_size from globals.

Access via functions only.

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Christof Schmitt <cs@samba.org>
This commit is contained in:
Jeremy Allison 2015-11-12 09:20:05 -08:00 committed by Christof Schmitt
parent 0137105c86
commit 803938260d
8 changed files with 30 additions and 14 deletions

View File

@ -909,7 +909,7 @@ static int aio_fork_connect(vfs_handle_struct *handle, const char *service,
* Essentially we want this to be unlimited unless smb.conf
* says different.
*********************************************************************/
aio_pending_size = 100;
set_aio_pending_size(100);
return 0;
}

View File

@ -113,12 +113,12 @@ static bool init_aio_linux(struct vfs_handle_struct *handle)
goto fail;
}
if (io_queue_init(aio_pending_size, &io_ctx)) {
if (io_queue_init(get_aio_pending_size(), &io_ctx)) {
goto fail;
}
DEBUG(10,("init_aio_linux: initialized with up to %d events\n",
aio_pending_size));
get_aio_pending_size()));
return true;
@ -333,8 +333,8 @@ static int aio_linux_connect(vfs_handle_struct *handle, const char *service,
* Essentially we want this to be unlimited unless smb.conf
* says different.
*********************************************************************/
aio_pending_size = lp_parm_int(
SNUM(handle->conn), "aio_linux", "aio num events", 128);
set_aio_pending_size(lp_parm_int(
SNUM(handle->conn), "aio_linux", "aio num events", 128));
return SMB_VFS_NEXT_CONNECT(handle, service, user);
}

View File

@ -51,7 +51,7 @@ static bool init_aio_threadpool(struct tevent_context *ev_ctx,
return true;
}
ret = pthreadpool_init(aio_pending_size, pp_pool);
ret = pthreadpool_init(get_aio_pending_size(), pp_pool);
if (ret) {
errno = ret;
return false;
@ -69,7 +69,7 @@ static bool init_aio_threadpool(struct tevent_context *ev_ctx,
}
DEBUG(10,("init_aio_threadpool: initialized with up to %d threads\n",
aio_pending_size));
get_aio_pending_size()));
return true;
}

View File

@ -716,7 +716,7 @@ static bool vfswrap_init_asys_ctx(struct smbd_server_connection *conn)
return true;
}
ret = asys_context_init(&ctx, aio_pending_size);
ret = asys_context_init(&ctx, get_aio_pending_size());
if (ret != 0) {
DEBUG(1, ("asys_context_init failed: %s\n", strerror(ret)));
return false;

View File

@ -25,6 +25,22 @@
#include "../lib/util/tevent_unix.h"
#include "lib/tevent_wait.h"
/****************************************************************************
Statics plus accessor functions.
*****************************************************************************/
static int aio_pending_size = 100; /* tevent supports 100 signals SA_SIGINFO */
int get_aio_pending_size(void)
{
return aio_pending_size;
}
void set_aio_pending_size(int newsize)
{
aio_pending_size = newsize;
}
/****************************************************************************
The buffer we keep around whilst an aio request is in process.
*****************************************************************************/
@ -186,7 +202,7 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
return NT_STATUS_RETRY;
}
if (outstanding_aio_calls >= aio_pending_size) {
if (outstanding_aio_calls >= get_aio_pending_size()) {
DEBUG(10,("schedule_aio_read_and_X: Already have %d aio "
"activities outstanding.\n",
outstanding_aio_calls ));
@ -452,7 +468,7 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
return NT_STATUS_RETRY;
}
if (outstanding_aio_calls >= aio_pending_size) {
if (outstanding_aio_calls >= get_aio_pending_size()) {
DEBUG(3,("schedule_aio_write_and_X: Already have %d aio "
"activities outstanding.\n",
outstanding_aio_calls ));
@ -711,7 +727,7 @@ NTSTATUS schedule_smb2_aio_read(connection_struct *conn,
return NT_STATUS_RETRY;
}
if (outstanding_aio_calls >= aio_pending_size) {
if (outstanding_aio_calls >= get_aio_pending_size()) {
DEBUG(10,("smb2: Already have %d aio "
"activities outstanding.\n",
outstanding_aio_calls ));
@ -867,7 +883,7 @@ NTSTATUS schedule_aio_smb2_write(connection_struct *conn,
return NT_STATUS_RETRY;
}
if (outstanding_aio_calls >= aio_pending_size) {
if (outstanding_aio_calls >= get_aio_pending_size()) {
DEBUG(3,("smb2: Already have %d aio "
"activities outstanding.\n",
outstanding_aio_calls ));

View File

@ -24,7 +24,6 @@
#include "messages.h"
#include <tdb.h>
int aio_pending_size = 100; /* tevent supports 100 signals SA_SIGINFO */
int outstanding_aio_calls = 0;
#ifdef USE_DMAPI

View File

@ -22,7 +22,6 @@
#include "librpc/gen_ndr/smbXsrv.h"
#include "smbprofile.h"
extern int aio_pending_size;
extern int outstanding_aio_calls;
#ifdef USE_DMAPI

View File

@ -66,6 +66,8 @@ void srv_set_signing(struct smbXsrv_connection *conn,
/* The following definitions come from smbd/aio.c */
int get_aio_pending_size(void);
void set_aio_pending_size(int newsize);
struct aio_extra;
bool aio_write_through_requested(struct aio_extra *aio_ex);
NTSTATUS schedule_aio_read_and_X(connection_struct *conn,