summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2015-11-12 09:25:41 -0800
committerChristof Schmitt <cs@samba.org>2015-11-13 01:44:21 +0100
commit17f4110c47d53148979a3617e80b29fe3bd41efc (patch)
treed42017623702bdd3dd97ed6377d2e2ddd77c6be0
parent803938260dadef63d2685860bb63a700c95424e0 (diff)
downloadsamba-17f4110c47d53148979a3617e80b29fe3bd41efc.tar.gz
s3: smbd: Remove outstanding_aio_calls from globals.
Access via functions only. Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Christof Schmitt <cs@samab.org>
-rw-r--r--source3/modules/vfs_default.c4
-rw-r--r--source3/smbd/aio.c41
-rw-r--r--source3/smbd/globals.c2
-rw-r--r--source3/smbd/globals.h2
-rw-r--r--source3/smbd/proto.h3
5 files changed, 34 insertions, 18 deletions
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 5d0966e18a8..f3ebb897580 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -866,14 +866,14 @@ static void vfswrap_asys_finished(struct tevent_context *ev,
uint16_t flags, void *p)
{
struct asys_context *asys_ctx = (struct asys_context *)p;
- struct asys_result results[outstanding_aio_calls];
+ struct asys_result results[get_outstanding_aio_calls()];
int i, ret;
if ((flags & TEVENT_FD_READ) == 0) {
return;
}
- ret = asys_results(asys_ctx, results, outstanding_aio_calls);
+ ret = asys_results(asys_ctx, results, get_outstanding_aio_calls());
if (ret < 0) {
DEBUG(1, ("asys_results returned %s\n", strerror(-ret)));
return;
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index a750a1a5982..1216a0d4bf1 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -30,6 +30,7 @@
*****************************************************************************/
static int aio_pending_size = 100; /* tevent supports 100 signals SA_SIGINFO */
+static int outstanding_aio_calls;
int get_aio_pending_size(void)
{
@@ -41,6 +42,21 @@ void set_aio_pending_size(int newsize)
aio_pending_size = newsize;
}
+int get_outstanding_aio_calls(void)
+{
+ return outstanding_aio_calls;
+}
+
+void increment_outstanding_aio_calls(void)
+{
+ outstanding_aio_calls++;
+}
+
+void decrement_outstanding_aio_calls(void)
+{
+ outstanding_aio_calls--;
+}
+
/****************************************************************************
The buffer we keep around whilst an aio request is in process.
*****************************************************************************/
@@ -66,7 +82,7 @@ bool aio_write_through_requested(struct aio_extra *aio_ex)
static int aio_extra_destructor(struct aio_extra *aio_ex)
{
- outstanding_aio_calls--;
+ decrement_outstanding_aio_calls();
return 0;
}
@@ -98,7 +114,7 @@ static struct aio_extra *create_aio_extra(TALLOC_CTX *mem_ctx,
}
talloc_set_destructor(aio_ex, aio_extra_destructor);
aio_ex->fsp = fsp;
- outstanding_aio_calls++;
+ increment_outstanding_aio_calls();
return aio_ex;
}
@@ -202,10 +218,10 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
return NT_STATUS_RETRY;
}
- if (outstanding_aio_calls >= get_aio_pending_size()) {
+ if (get_outstanding_aio_calls() >= get_aio_pending_size()) {
DEBUG(10,("schedule_aio_read_and_X: Already have %d aio "
"activities outstanding.\n",
- outstanding_aio_calls ));
+ get_outstanding_aio_calls() ));
return NT_STATUS_RETRY;
}
@@ -468,10 +484,10 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
return NT_STATUS_RETRY;
}
- if (outstanding_aio_calls >= get_aio_pending_size()) {
+ if (get_outstanding_aio_calls() >= get_aio_pending_size()) {
DEBUG(3,("schedule_aio_write_and_X: Already have %d aio "
"activities outstanding.\n",
- outstanding_aio_calls ));
+ get_outstanding_aio_calls() ));
DEBUG(10,("schedule_aio_write_and_X: failed to schedule "
"aio_write for file %s, offset %.0f, len = %u "
"(mid = %u)\n",
@@ -554,7 +570,8 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
"%s, offset %.0f, len = %u (mid = %u) "
"outstanding_aio_calls = %d\n",
fsp_str_dbg(fsp), (double)startpos, (unsigned int)numtowrite,
- (unsigned int)aio_ex->smbreq->mid, outstanding_aio_calls ));
+ (unsigned int)aio_ex->smbreq->mid,
+ get_outstanding_aio_calls() ));
return NT_STATUS_OK;
}
@@ -727,10 +744,10 @@ NTSTATUS schedule_smb2_aio_read(connection_struct *conn,
return NT_STATUS_RETRY;
}
- if (outstanding_aio_calls >= get_aio_pending_size()) {
+ if (get_outstanding_aio_calls() >= get_aio_pending_size()) {
DEBUG(10,("smb2: Already have %d aio "
"activities outstanding.\n",
- outstanding_aio_calls ));
+ get_outstanding_aio_calls() ));
return NT_STATUS_RETRY;
}
@@ -883,10 +900,10 @@ NTSTATUS schedule_aio_smb2_write(connection_struct *conn,
return NT_STATUS_RETRY;
}
- if (outstanding_aio_calls >= get_aio_pending_size()) {
+ if (get_outstanding_aio_calls() >= get_aio_pending_size()) {
DEBUG(3,("smb2: Already have %d aio "
"activities outstanding.\n",
- outstanding_aio_calls ));
+ get_outstanding_aio_calls() ));
return NT_STATUS_RETRY;
}
@@ -955,7 +972,7 @@ NTSTATUS schedule_aio_smb2_write(connection_struct *conn,
(double)in_offset,
(unsigned int)in_data.length,
(unsigned int)aio_ex->smbreq->mid,
- outstanding_aio_calls ));
+ get_outstanding_aio_calls() ));
return NT_STATUS_OK;
}
diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c
index f552bc848c6..70805a1b2a5 100644
--- a/source3/smbd/globals.c
+++ b/source3/smbd/globals.c
@@ -24,8 +24,6 @@
#include "messages.h"
#include <tdb.h>
-int outstanding_aio_calls = 0;
-
#ifdef USE_DMAPI
struct smbd_dmapi_context *dmapi_ctx = NULL;
#endif
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 86774cf0943..0422cbeb995 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -22,8 +22,6 @@
#include "librpc/gen_ndr/smbXsrv.h"
#include "smbprofile.h"
-extern int outstanding_aio_calls;
-
#ifdef USE_DMAPI
struct smbd_dmapi_context;
extern struct smbd_dmapi_context *dmapi_ctx;
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index caeecc71898..95414e638b0 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -68,6 +68,9 @@ void srv_set_signing(struct smbXsrv_connection *conn,
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);
struct aio_extra;
bool aio_write_through_requested(struct aio_extra *aio_ex);
NTSTATUS schedule_aio_read_and_X(connection_struct *conn,