s3: smbd: Remove checks causing fallback to sync on pread/pwrite/fsync.
authorJeremy Allison <jra@samba.org>
Thu, 12 Nov 2015 21:07:21 +0000 (13:07 -0800)
committerJeremy Allison <jra@samba.org>
Fri, 13 Nov 2015 20:36:19 +0000 (21:36 +0100)
Rely on pthreadpool queueing instead of falling back.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
source3/smbd/aio.c
source3/smbd/smb2_flush.c

index 1216a0d4bf1ee854d0e0f3ea64e8334e0192ea08..3923eacdf64d9b9a644a9724f906dd4b65049846 100644 (file)
@@ -29,7 +29,7 @@
  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)
@@ -218,13 +218,6 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
                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 */
 
@@ -484,19 +477,6 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
                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))) {
@@ -744,13 +724,6 @@ NTSTATUS schedule_smb2_aio_read(connection_struct *conn,
                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) {
@@ -900,13 +873,6 @@ NTSTATUS schedule_aio_smb2_write(connection_struct *conn,
                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;
index d26707acc0c96c7481aeca4d00130da57ae69421..00b05354a2e089e04a8fcc23789c65442568f0c0 100644 (file)
@@ -162,20 +162,6 @@ static struct tevent_req *smbd_smb2_flush_send(TALLOC_CTX *mem_ctx,
                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));