Displaying 5 results from an estimated 5 matches for "cmds_to_issue_tail".
2019 Jul 18
0
[libnbd PATCH 2/2] lib: Do O(1) rather than O(n) queue insertion
...ator/states-issue-command.c
index 8828f51..78b2ca1 100644
--- a/generator/states-issue-command.c
+++ b/generator/states-issue-command.c
@@ -105,6 +105,8 @@
cmd = h->cmds_to_issue;
assert (cmd->cookie == be64toh (h->request.handle));
h->cmds_to_issue = cmd->next;
+ if (h->cmds_to_issue_tail == cmd)
+ h->cmds_to_issue_tail = NULL;
cmd->next = h->cmds_in_flight;
h->cmds_in_flight = cmd;
SET_NEXT_STATE (%.READY);
diff --git a/generator/states-reply.c b/generator/states-reply.c
index 4b22c39..1a0c149 100644
--- a/generator/states-reply.c
+++ b/generator/states-repl...
2019 Jul 18
3
[libnbd PATCH 0/2] in_flight improvements
Noticed while thinking about the recent threads wondering if we need a
more efficient lookup from cookie back to command. Both of these fix
bugs, but are tricky enough that I'm posting for review.
Eric Blake (2):
lib: Decrement in_flight at response, not retirement
lib: Do O(1) rather than O(n) queue insertion
generator/states-issue-command.c | 2 ++
generator/states-reply.c |
2019 Aug 05
1
[libnbd PATCH] lib: Always return cookie once command is queued
...be calling more API to
+ * await results, and will eventually learn that the machine has
+ * moved on to DEAD at that time.
*/
h->in_flight++;
if (h->cmds_to_issue != NULL) {
@@ -240,7 +246,7 @@ nbd_internal_command_common (struct nbd_handle *h,
h->cmds_to_issue = h->cmds_to_issue_tail = cmd;
if (nbd_internal_is_state_ready (get_next_state (h)) &&
nbd_internal_run (h, cmd_issue) == -1)
- return -1;
+ nbd_internal_debug (h, "command queued, ignoring state machine failure");
}
return cmd->cookie;
--
2.20.1
2020 Sep 11
3
[libnbd PATCH] api: Add LIBNBD_SHUTDOWN_IMMEDIATE flag
...e not yet had any bytes
+ * sent to the server, so that NBD_CMD_DISC will be first in line.
+ */
+ if (flags & LIBNBD_SHUTDOWN_IMMEDIATE) {
+ struct command **cmd = &h->cmds_to_issue;
+ if (!nbd_internal_is_state_ready (get_next_state (h))) {
+ assert (*cmd);
+ h->cmds_to_issue_tail = *cmd;
+ cmd = &((*cmd)->next);
+ }
+ nbd_internal_abort_commands (h, cmd);
+ }
+
if (!h->disconnect_request &&
(nbd_internal_is_state_ready (get_next_state (h)) ||
nbd_internal_is_state_processing (get_next_state (h)))) {
diff --git a/tests/Makefile...
2020 Sep 17
0
Re: [libnbd PATCH] api: Add LIBNBD_SHUTDOWN_IMMEDIATE flag
...sent to the server, so that NBD_CMD_DISC will be first in line.
> + */
> + if (flags & LIBNBD_SHUTDOWN_IMMEDIATE) {
> + struct command **cmd = &h->cmds_to_issue;
> + if (!nbd_internal_is_state_ready (get_next_state (h))) {
> + assert (*cmd);
> + h->cmds_to_issue_tail = *cmd;
> + cmd = &((*cmd)->next);
> + }
> + nbd_internal_abort_commands (h, cmd);
> + }
> +
> if (!h->disconnect_request &&
> (nbd_internal_is_state_ready (get_next_state (h)) ||
> nbd_internal_is_state_processing (get_next_st...