mirror of
https://github.com/samba-team/samba.git
synced 2025-08-02 00:22:11 +03:00
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>
This commit is contained in:
committed by
Christof Schmitt
parent
803938260d
commit
17f4110c47
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
Reference in New Issue
Block a user