Displaying 15 results from an estimated 15 matches for "nbd_aio_in_flight".
2019 Jun 29
0
[libnbd PATCH 1/6] api: Add nbd_aio_in_flight
...handles[1] = nbd_aio_pwrite (nbd, out, packetsize, packetsize, 0);
if (handles[1] == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
goto error;
}
- in_flight++;
/* Now wait for commands to retire, or for deadlock to occur */
- while (in_flight > 0) {
+ while (nbd_aio_in_flight (nbd) > 0) {
if (nbd_aio_is_dead (nbd) || nbd_aio_is_closed (nbd)) {
fprintf (stderr, "connection is dead or closed\n");
goto error;
@@ -96,23 +92,20 @@ try_deadlock (void *arg)
/* If a command is ready to retire, retire it. */
while ((done = nbd_aio_peek_...
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 14
3
[libnbd PATCH 0/2] Drop generated file from git
Rich recently patched things to generate one man page per function
rather than libnbd-api.3 (nice), but in doing so got stumped by a
problem with a fresh git clone (automake fails for any 'include'
directive that does not already exist). I've figured out how to hack
around it, but the hack requires GNU make. We already use GNU make
constructs elsewhere (such as $(wildcard)), but
2019 Jun 29
19
[libnbd PATCH 0/6] new APIs: aio_in_flight, aio_FOO_notify
I still need to wire in the use of *_notify functions into nbdkit to
prove whether it makes the code any faster or easier to maintain, but
at least the added example shows one good use case for the new API.
Eric Blake (6):
api: Add nbd_aio_in_flight
generator: Allow DEAD state actions to run
generator: Allow Int64 in callbacks
states: Prepare for aio notify callback
api: Add new nbd_aio_FOO_notify functions
examples: New example for strict read validations
.gitignore | 1 +
docs/libnbd.pod...
2020 Sep 11
3
[libnbd PATCH] api: Add LIBNBD_SHUTDOWN_IMMEDIATE flag
...ists for future NBD
-protocol extensions).";
+The C<flags> argument is a bitmask, including zero or more of the
+following shutdown flags:
+
+=over 4
+
+=item C<LIBNBD_SHUTDOWN_IMMEDIATE> = 1
+
+If there are any pending requests which have not yet been sent to
+the server (see L<nbd_aio_in_flight(3)>), abandon them without
+sending them to the server, rather than the usual practice of
+issuing those commands before informing the server of the intent
+to disconnect.
+
+=back
+";
see_also = [Link "close"; Link "aio_disconnect"];
example = Some "examp...
2020 Sep 17
0
Re: [libnbd PATCH] api: Add LIBNBD_SHUTDOWN_IMMEDIATE flag
...ot;;
> +The C<flags> argument is a bitmask, including zero or more of the
> +following shutdown flags:
> +
> +=over 4
> +
> +=item C<LIBNBD_SHUTDOWN_IMMEDIATE> = 1
> +
> +If there are any pending requests which have not yet been sent to
> +the server (see L<nbd_aio_in_flight(3)>), abandon them without
> +sending them to the server, rather than the usual practice of
> +issuing those commands before informing the server of the intent
> +to disconnect.
> +
> +=back
> +";
> see_also = [Link "close"; Link "aio_disconnect"...
2019 Aug 06
0
[PATCH libnbd 1/3] api: Change nbd_read_only -> nbd_is_read_only.
...allel-load.c
+++ b/tests/aio-parallel-load.c
@@ -231,7 +231,7 @@ start_thread (void *arg)
assert (nbd_get_size (nbd) == EXPORTSIZE);
assert (nbd_can_multi_conn (nbd) > 0);
- assert (nbd_read_only (nbd) == 0);
+ assert (nbd_is_read_only (nbd) == 0);
/* Issue commands. */
assert (nbd_aio_in_flight (nbd) == 0);
diff --git a/tests/aio-parallel.c b/tests/aio-parallel.c
index 166b560..f8d4891 100644
--- a/tests/aio-parallel.c
+++ b/tests/aio-parallel.c
@@ -239,7 +239,7 @@ start_thread (void *arg)
assert (nbd_get_size (nbd) == EXPORTSIZE);
assert (nbd_can_multi_conn (nbd) > 0);
- asse...
2019 Jul 25
4
[PATCH libnbd] api: New nbd_kill_command API for sending a signal to the command subprocess.
Reverts commit 387cbe67c3db27e8a61117fedb6e7fad76e409ef.
---
generator/generator | 18 +++++++++++++++++-
lib/handle.c | 28 +++++++++++++++++++++++++++-
tests/closure-lifetimes.c | 4 +++-
3 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/generator/generator b/generator/generator
index 2cd83f1..25e4aa5 100755
--- a/generator/generator
+++ b/generator/generator
2019 Jun 28
1
[libnbd PATCH] disconnect: Prevent any further commands
...llowing replies from the
server for existing in-flight commands.
The protocol also recommends that NBD_CMD_DISC not be sent until there
are no other pending in-flight commands, but at the moment, we place
that burden on the client. Perhaps we should add a knob to
nbd_shutdown and/or add a new API nbd_aio_in_flight returning the
number of in-flight commands, to make things easier?
---
lib/disconnect.c | 6 ++++--
lib/internal.h | 2 ++
lib/rw.c | 5 +++++
tests/errors.c | 9 ++++++---
4 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/lib/disconnect.c b/lib/disconnect.c
index 95e9a37...
2019 Aug 06
5
[PATCH libnbd 0/3] One API and small documentation changes.
One API change, some small documentation changes.
2019 Aug 14
0
[libnbd PATCH 2/2] docs: Drop docs/Makefile.inc from git
...- nbd_aio_get_fd \
- nbd_aio_get_direction \
- nbd_aio_notify_read \
- nbd_aio_notify_write \
- nbd_aio_is_created \
- nbd_aio_is_connecting \
- nbd_aio_is_ready \
- nbd_aio_is_processing \
- nbd_aio_is_dead \
- nbd_aio_is_closed \
- nbd_aio_command_completed \
- nbd_aio_peek_command_completed \
- nbd_aio_in_flight \
- nbd_connection_state \
- nbd_get_package_name \
- nbd_get_version \
- nbd_kill_command \
- nbd_supports_tls \
- nbd_supports_uri \
- $(NULL)
diff --git a/generator/generator b/generator/generator
index 257303f..9fe98f5 100755
--- a/generator/generator
+++ b/generator/generator
@@ -3733,9 +3733,...
2019 Aug 15
1
[PATCH libnbd] docs: Change docs/Makefile.inc back to a regular include, readd to git.
...+ nbd_aio_get_fd \
+ nbd_aio_get_direction \
+ nbd_aio_notify_read \
+ nbd_aio_notify_write \
+ nbd_aio_is_created \
+ nbd_aio_is_connecting \
+ nbd_aio_is_ready \
+ nbd_aio_is_processing \
+ nbd_aio_is_dead \
+ nbd_aio_is_closed \
+ nbd_aio_command_completed \
+ nbd_aio_peek_command_completed \
+ nbd_aio_in_flight \
+ nbd_connection_state \
+ nbd_get_package_name \
+ nbd_get_version \
+ nbd_kill_subprocess \
+ nbd_supports_tls \
+ nbd_supports_uri \
+ $(NULL)
diff --git a/generator/generator b/generator/generator
index 6cc06cc..437f432 100755
--- a/generator/generator
+++ b/generator/generator
@@ -3766,7 +37...
2019 Jul 27
3
[PATCH libnbd] lib: Use symbol versions.
...000007320 T nbd_aio_connect_command@@LIBNBD_1.0
[etc]
$ nm -D --with-symbol-versions examples/.libs/glib-main-loop | grep LIBNBD
U nbd_aio_connect_command@LIBNBD_1.0
U nbd_aio_get_direction@LIBNBD_1.0
U nbd_aio_get_fd@LIBNBD_1.0
U nbd_aio_in_flight@LIBNBD_1.0
U nbd_aio_is_ready@LIBNBD_1.0
U nbd_aio_notify_read@LIBNBD_1.0
U nbd_aio_notify_write@LIBNBD_1.0
U nbd_aio_peek_command_completed@LIBNBD_1.0
U nbd_aio_pread_callback@LIBNBD_1.0
U nbd_aio...
2019 Jun 29
0
[libnbd PATCH 6/6] examples: New example for strict read validations
...aio_pread_structured_notify (nbd, buf, sizeof buf, offset, d,
+ read_chunk, read_verify,
+ flags) == -1) {
+ fprintf (stderr, "%s\n", nbd_get_error ());
+ exit (EXIT_FAILURE);
+ }
+ }
+
+ while (nbd_aio_in_flight (nbd) > 0) {
+ int64_t handle = nbd_aio_peek_command_completed (nbd);
+
+ if (handle == -1) {
+ fprintf (stderr, "%s\n", nbd_get_error ());
+ exit (EXIT_FAILURE);
+ }
+ if (handle == 0) {
+ if (nbd_poll (nbd, -1) == -1) {
+ fprintf (stderr, "%s\n&...
2019 Jul 23
4
[libnbd PATCH] api: Allow completion callbacks to auto-retire
...nged, 116 insertions(+), 61 deletions(-)
diff --git a/examples/glib-main-loop.c b/examples/glib-main-loop.c
index c633c1d..2230077 100644
--- a/examples/glib-main-loop.c
+++ b/examples/glib-main-loop.c
@@ -188,6 +188,8 @@ finalize (GSource *sp)
DEBUG (source, "finalize");
+ assert (nbd_aio_in_flight (source->nbd) == 0);
+ assert (nbd_aio_peek_command_completed (source->nbd) == -1);
nbd_close (source->nbd);
}
@@ -418,7 +420,7 @@ finished_read (void *vp, int64_t rcookie, int *error)
/* Create a writer idle handler. */
g_idle_add (write_data, NULL);
- return 0;
+ return 1;...