Statics plus accessor functions.
*****************************************************************************/
-static int aio_pending_size = 100; /* tevent supports 100 signals SA_SIGINFO */
+static int aio_pending_size = 100; /* Current max threads. */
static int outstanding_aio_calls;
int get_aio_pending_size(void)
return NT_STATUS_RETRY;
}
- if (get_outstanding_aio_calls() >= get_aio_pending_size()) {
- DEBUG(10,("schedule_aio_read_and_X: Already have %d aio "
- "activities outstanding.\n",
- get_outstanding_aio_calls() ));
- return NT_STATUS_RETRY;
- }
-
/* The following is safe from integer wrap as we've already checked
smb_maxcnt is 128k or less. Wct is 12 for read replies */
return NT_STATUS_RETRY;
}
- if (get_outstanding_aio_calls() >= get_aio_pending_size()) {
- DEBUG(3,("schedule_aio_write_and_X: Already have %d aio "
- "activities outstanding.\n",
- 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",
- fsp_str_dbg(fsp), (double)startpos,
- (unsigned int)numtowrite,
- (unsigned int)smbreq->mid ));
- return NT_STATUS_RETRY;
- }
-
bufsize = smb_size + 6*2;
if (!(aio_ex = create_aio_extra(NULL, fsp, bufsize))) {
return NT_STATUS_RETRY;
}
- if (get_outstanding_aio_calls() >= get_aio_pending_size()) {
- DEBUG(10,("smb2: Already have %d aio "
- "activities outstanding.\n",
- get_outstanding_aio_calls() ));
- return NT_STATUS_RETRY;
- }
-
/* Create the out buffer. */
*preadbuf = data_blob_talloc(ctx, NULL, smb_maxcnt);
if (preadbuf->data == NULL) {
return NT_STATUS_RETRY;
}
- if (get_outstanding_aio_calls() >= get_aio_pending_size()) {
- DEBUG(3,("smb2: Already have %d aio "
- "activities outstanding.\n",
- get_outstanding_aio_calls() ));
- return NT_STATUS_RETRY;
- }
-
if (smbreq->unread_bytes) {
/* Can't do async with recvfile. */
return NT_STATUS_RETRY;
return tevent_req_post(req, ev);
}
- if (get_outstanding_aio_calls() >= get_aio_pending_size()) {
- /* No more allowed aio. Synchronous flush. */
- NTSTATUS status = sync_file(smbreq->conn, fsp, true);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(5,("sync_file for %s returned %s\n",
- fsp_str_dbg(fsp),
- nt_errstr(status)));
- tevent_req_nterror(req, status);
- return tevent_req_post(req, ev);
- }
- tevent_req_done(req);
- return tevent_req_post(req, ev);
- }
-
ret = flush_write_cache(fsp, SAMBA_SYNC_FLUSH);
if (ret == -1) {
tevent_req_nterror(req, map_nt_error_from_unix(errno));