+static NTSTATUS benchrw_readwrite(struct torture_context *tctx,
+ struct benchrw_state *state);
+static void benchrw_callback(struct smbcli_request *req);
+
+static void benchrw_rw_callback(struct smbcli_request *req)
+{
+ struct benchrw_state *state = req->async.private;
+ struct torture_context *tctx = state->tctx;
+
+ if (!NT_STATUS_IS_OK(req->status)) {
+ state->mode = ERROR;
+ return;
+ }
+
+ state->completed++;
+ state->num_parallel_requests--;
+
+ if ((state->completed >= torture_numops)
+ && (state->num_parallel_requests == 0)) {
+ benchrw_callback(req);
+ talloc_free(req);
+ return;
+ }
+
+ talloc_free(req);
+
+ if (state->completed + state->num_parallel_requests
+ < torture_numops) {
+ benchrw_readwrite(tctx, state);
+ }
+}
+