summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-02-24 11:32:22 +0100
committerVolker Lendecke <vl@samba.org>2008-02-24 11:39:59 +0100
commitfcee8fee63fc907f106477a55d651b5a1be692bf (patch)
tree06290c088f7d87984908f17b56a7bf7877b10ca3 /source3/smbd
parent21b6a036780ae0c020e199043c25c63fbbf8fa95 (diff)
downloadsamba-fcee8fee63fc907f106477a55d651b5a1be692bf.tar.gz
samba-fcee8fee63fc907f106477a55d651b5a1be692bf.tar.bz2
samba-fcee8fee63fc907f106477a55d651b5a1be692bf.zip
Allow "max mux" async i/o requests
In the negprot reply, we allowed the client to issued "max mux" concurrent requests. The OS might allow less, for example AFAIK AIX has a configurable limit of concurrent AIO requests. We will fall back to sync operation for the requests that are too many when aio_read/aio_write return an error. Jeremy, please check! (This used to be commit 8f86f7f25c4eb71bbdfcc6bf2d12eaaae9a8d9ec)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/aio.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index 78189d32f7..2889e3c13f 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -141,10 +141,10 @@ static struct aio_extra *find_aio_ex(uint16 mid)
We can have these many aio buffers in flight.
*****************************************************************************/
-#define AIO_PENDING_SIZE 10
+static int aio_pending_size;
static sig_atomic_t signals_received;
static int outstanding_aio_calls;
-static uint16 aio_pending_array[AIO_PENDING_SIZE];
+static uint16 *aio_pending_array;
/****************************************************************************
Signal handler when an aio request completes.
@@ -152,7 +152,7 @@ static uint16 aio_pending_array[AIO_PENDING_SIZE];
void aio_request_done(uint16_t mid)
{
- if (signals_received < AIO_PENDING_SIZE) {
+ if (signals_received < aio_pending_size) {
aio_pending_array[signals_received] = mid;
signals_received++;
}
@@ -182,6 +182,10 @@ void initialize_async_io_handler(void)
{
struct sigaction act;
+ aio_pending_size = lp_maxmux();
+ aio_pending_array = SMB_MALLOC_ARRAY(uint16, aio_pending_size);
+ SMB_ASSERT(aio_pending_array != NULL);
+
ZERO_STRUCT(act);
act.sa_sigaction = signal_handler;
act.sa_flags = SA_SIGINFO;
@@ -231,7 +235,7 @@ bool schedule_aio_read_and_X(connection_struct *conn,
return False;
}
- if (outstanding_aio_calls >= AIO_PENDING_SIZE) {
+ if (outstanding_aio_calls >= aio_pending_size) {
DEBUG(10,("schedule_aio_read_and_X: Already have %d aio "
"activities outstanding.\n",
outstanding_aio_calls ));
@@ -320,7 +324,7 @@ bool schedule_aio_write_and_X(connection_struct *conn,
return False;
}
- if (outstanding_aio_calls >= AIO_PENDING_SIZE) {
+ if (outstanding_aio_calls >= aio_pending_size) {
DEBUG(3,("schedule_aio_write_and_X: Already have %d aio "
"activities outstanding.\n",
outstanding_aio_calls ));