Displaying 7 results from an estimated 7 matches for "cmds_done_tail".
2019 Jul 18
0
[libnbd PATCH 2/2] lib: Do O(1) rather than O(n) queue insertion
...1,14 +171,12 @@ save_reply_state (struct nbd_handle *h)
else
h->cmds_in_flight = cmd->next;
cmd->next = NULL;
- if (h->cmds_done) {
- prev_cmd = h->cmds_done;
- while (prev_cmd->next)
- prev_cmd = prev_cmd->next;
- prev_cmd->next = cmd;
+ if (h->cmds_done_tail != NULL)
+ h->cmds_done_tail = h->cmds_done_tail->next = cmd;
+ else {
+ assert (h->cmds_done == NULL);
+ h->cmds_done = h->cmds_done_tail = cmd;
}
- else
- h->cmds_done = cmd;
h->in_flight--;
assert (h->in_flight >= 0);
diff --git a/generator/s...
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 Jul 23
4
[libnbd PATCH] api: Allow completion callbacks to auto-retire
...break;
+ case 1:
+ retire = true;
+ break;
+ }
+ }
/* Move it to the end of the cmds_done list. */
if (prev_cmd != NULL)
@@ -171,23 +189,19 @@ save_reply_state (struct nbd_handle *h)
else
h->cmds_in_flight = cmd->next;
cmd->next = NULL;
- if (h->cmds_done_tail != NULL)
- h->cmds_done_tail = h->cmds_done_tail->next = cmd;
+ if (retire)
+ free (cmd);
else {
- assert (h->cmds_done == NULL);
- h->cmds_done = h->cmds_done_tail = cmd;
+ if (h->cmds_done_tail != NULL)
+ h->cmds_done_tail = h->cmds_done_tail->...
2019 Aug 12
0
[PATCH libnbd 2/7] lib: Allow retired commands to use free_callback on their buffer.
...c
+++ b/generator/states-reply.c
@@ -194,7 +194,7 @@ save_reply_state (struct nbd_handle *h)
h->cmds_in_flight = cmd->next;
cmd->next = NULL;
if (retire)
- nbd_internal_retire_and_free_command (cmd);
+ nbd_internal_retire_and_free_command (h, cmd);
else {
if (h->cmds_done_tail != NULL)
h->cmds_done_tail = h->cmds_done_tail->next = cmd;
diff --git a/generator/states.c b/generator/states.c
index 9ed57ae..a11c1d1 100644
--- a/generator/states.c
+++ b/generator/states.c
@@ -142,7 +142,7 @@ void abort_commands (struct nbd_handle *h,
if (cmd->error == 0...
2019 Jul 25
0
[PATCH libnbd v3 1/2] lib: Implement closure lifetimes.
...) {
case -1:
if (error)
cmd->error = error;
@@ -190,7 +194,7 @@ save_reply_state (struct nbd_handle *h)
h->cmds_in_flight = cmd->next;
cmd->next = NULL;
if (retire)
- free (cmd);
+ nbd_internal_retire_and_free_command (cmd);
else {
if (h->cmds_done_tail != NULL)
h->cmds_done_tail = h->cmds_done_tail->next = cmd;
diff --git a/generator/states.c b/generator/states.c
index 2d7e197..a7f7ca0 100644
--- a/generator/states.c
+++ b/generator/states.c
@@ -123,9 +123,13 @@ void abort_commands (struct nbd_handle *h,
next = cmd->next;...
2019 Jul 25
4
[PATCH libnbd v3 0/2] lib: Implement closure lifetimes.
I think I've addressed everything that was raised in review.
Some of the highlights:
- Callbacks should be freed reliably along all exit paths.
- There's a simple test of closure lifetimes.
- I've tried to use VALID|FREE in all the places where I'm confident
that it's safe and correct to do. There may be more places. Note
this is an optimization and shouldn't
2019 Aug 12
14
[PATCH libnbd 0/7] Add free callbacks and remove valid_flag.
As proposed here:
https://www.redhat.com/archives/libguestfs/2019-August/msg00130.html
I didn't actually read Eric's replies to that yet because I've been
concentrating on writing these patches all day. Anyway here they are
and I'll look at what Eric said about the proposal next.
Rich.