From: Jeremy Allison Date: Thu, 12 Nov 2015 17:20:05 +0000 (-0800) Subject: s3: smbd: Remove aio_pending_size from globals. X-Git-Url: http://git.samba.org/?p=obnox%2Fsamba%2Fsamba-obnox.git;a=commitdiff_plain;h=803938260dadef63d2685860bb63a700c95424e0 s3: smbd: Remove aio_pending_size from globals. Access via functions only. Signed-off-by: Jeremy Allison Signed-off-by: Christof Schmitt --- diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c index 7fca3d1a6ec..25a72c62f5f 100644 --- a/source3/modules/vfs_aio_fork.c +++ b/source3/modules/vfs_aio_fork.c @@ -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; } diff --git a/source3/modules/vfs_aio_linux.c b/source3/modules/vfs_aio_linux.c index 74ebb3c62f7..599272e3861 100644 --- a/source3/modules/vfs_aio_linux.c +++ b/source3/modules/vfs_aio_linux.c @@ -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); } diff --git a/source3/modules/vfs_aio_pthread.c b/source3/modules/vfs_aio_pthread.c index 059d745a941..72c812f14e0 100644 --- a/source3/modules/vfs_aio_pthread.c +++ b/source3/modules/vfs_aio_pthread.c @@ -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; } diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index bbe8cca97a9..5d0966e18a8 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -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; diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c index 253782bba2d..a750a1a5982 100644 --- a/source3/smbd/aio.c +++ b/source3/smbd/aio.c @@ -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 )); diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c index a50123474f0..f552bc848c6 100644 --- a/source3/smbd/globals.c +++ b/source3/smbd/globals.c @@ -24,7 +24,6 @@ #include "messages.h" #include -int aio_pending_size = 100; /* tevent supports 100 signals SA_SIGINFO */ int outstanding_aio_calls = 0; #ifdef USE_DMAPI diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index b567a5869e7..86774cf0943 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -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 diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 2eac3ecd8a7..caeecc71898 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -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,