s3: smbd: Remove aio_pending_size from globals.
[kai/samba-autobuild/.git] / source3 / smbd / aio.c
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 ));