s3: smbd: Remove aio_pending_size from globals.
authorJeremy Allison <jra@samba.org>
Thu, 12 Nov 2015 17:20:05 +0000 (09:20 -0800)
committerChristof Schmitt <cs@samba.org>
Fri, 13 Nov 2015 00:44:21 +0000 (01:44 +0100)
Access via functions only.

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Christof Schmitt <cs@samba.org>
source3/modules/vfs_aio_fork.c
source3/modules/vfs_aio_linux.c
source3/modules/vfs_aio_pthread.c
source3/modules/vfs_default.c
source3/smbd/aio.c
source3/smbd/globals.c
source3/smbd/globals.h
source3/smbd/proto.h

index 7fca3d1a6ec7724090c2db6b4165dbe0db83aeaa..25a72c62f5ff9418b0e6cf3c6dd9f7f98d2e5bff 100644 (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;
 }
 
index 74ebb3c62f78575b871051697658ae8d22f96ebe..599272e386125d0999c5898a14fff960380766db 100644 (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);
 }
 
index 059d745a941c53db38a5a2e02b9f9cea926935ae..72c812f14e0140a29659c9a2226516b113c266e8 100644 (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;
 }
index bbe8cca97a9e42572fd35abd1ebeb8dbd7fa4c37..5d0966e18a84985a7f9da609816e520b9fc82935 100644 (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;
index 253782bba2d50cc13e060db94b8dc61336219f92..a750a1a5982d413ee2271438ce9e87167c56adf5 100644 (file)
 #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 ));
index a50123474f080be63aa78f00c9eccedb3c697976..f552bc848c6fe545b7a55de156da253eb0cc503d 100644 (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
index b567a5869e7096777ad9cd6fa2abe93573a9afd5..86774cf09439be86d3fbb948836ff2295fa32f66 100644 (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
index 2eac3ecd8a70994cff14aeab619aab4a8f06ea5a..caeecc71898eaa387d707cd5ea86209d99b5a619 100644 (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,