search for: nbd_aio_command_complet

Displaying 20 results from an estimated 74 matches for "nbd_aio_command_complet".

2019 Jun 29
0
[libnbd PATCH 5/6] api: Add new nbd_aio_FOO_notify functions
...2..fe73c15 100755 --- a/generator/generator +++ b/generator/generator @@ -1708,9 +1708,40 @@ on the connection."; Issue a read command to the NBD server. This returns the unique positive 64 bit handle for this command, or C<-1> on error. To check if the command completed, call -C<nbd_aio_command_completed>. Note that you must ensure +C<nbd_aio_command_completed>, or use C<nbd_aio_pread_notify>. +Note that you must ensure C<buf> is valid until the command +has completed. Other parameters behave as documented in +C<nbd_pread>."; + }; + + "aio_pread_notify&quo...
2019 Jul 23
4
[libnbd PATCH] api: Allow completion callbacks to auto-retire
When using the nbd_aio_FOO_callback commands, there is nothing further to be learned about the command by calling nbd_aio_command_completed() compared to what the callback already had access to. There are still scenarios where manually retiring the command after the fact is useful (whether the return was 0 to keep the status unchanged, or -1 to alter the retirement status to *error), but by allowing a return value of 1, we can reduc...
2019 Aug 13
0
[PATCH libnbd] api: Rename nbd_aio_*_callback to nbd_aio_*.
...- permitted_states = [ Connected ]; - shortdesc = "read from the NBD server"; - longdesc = "\ -Issue a read command to the NBD server. This returns the -unique positive 64 bit cookie for this command, or C<-1> on -error. To check if the command completed, call -C<nbd_aio_command_completed>, or use C<nbd_aio_pread_callback>. -Note that you must ensure C<buf> is valid until the command -has completed. Other parameters behave as documented in -C<nbd_pread>."; - }; - - "aio_pread_callback", { default_call with args = [ BytesPersistOut (...
2019 Aug 13
2
[PATCH libnbd] api: Rename nbd_aio_*_callback to nbd_aio_*.
This applies on top of the OClosure v2 series posted a few minutes ago. Rich.
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
2019 Jun 29
0
[libnbd PATCH 4/6] states: Prepare for aio notify callback
...can change the command from success to failure if the server violated protocol by not returning chunks to cover the entire read). We also want the client to be aware of any issued/in-flight commands that failed because they were stranded when the state machine moved to CLOSED or DEAD. Previously, nbd_aio_command_completed() would never locate such stranded commands, but adding a common point to fire the notifier for such commands makes it also possible to move those commands to the completion queue. This patch sets up the framework, with observable effects for stranded commands per the testsuite changes, but noth...
2019 Jul 01
0
[nbdkit PATCH 2/2] nbd: Use nbdkit aio_*_notify variants
...reached, but under a heavily-loaded system, it is conceivable that the libnbd state machine can manage to fire off our request and receive a server reply all before returning to the thread waiting on the semaphore, in which case the notify callback could set the cookie first. We still have to call nbd_aio_command_completed to retire the command, but now we can call it from the context of the thread that made the request rather than from the central reader thread, and we can check that the retired command has the same status as expected from the notify callback. Repeating a setup from commit e897ed70, I'm not s...
2019 May 28
6
[RFC libnbd PATCH 0/4] Add CMD_FLAG_DF support
RFC because this is an API break, but we haven't declared stable API yet. If we like it, I'm working on using libnbd to implement the nbdkit-nbd plugin; knowing whether it is API version 0.1 or 0.2 will be useful. I also dabbled with allowing optional parameters in python, although my OCaml is weak enough that there may be cleaner ways to approach that. Eric Blake (4): api: Add flags
2019 Jun 27
2
[libnbd PATCH] tests: Add test for abrupt server death
...)) == -1) { + fprintf (stderr, "%s: test failed: nbd_aio_pread\n", argv[0]); + goto fail; + } + if (nbd_aio_peek_command_completed (nbd) != 0) { + fprintf (stderr, "%s: test failed: nbd_aio_peek_command_completed\n", + argv[0]); + goto fail; + } + if (nbd_aio_command_completed (nbd, handle) != 0) { + fprintf (stderr, "%s: test failed: nbd_aio_command_completed\n", argv[0]); + goto fail; + } + + /* Kill the server forcefully (SIGINT is not always strong enough, + * as nbdkit waits for pending transactions to finish before + * actually exiting), alt...
2019 Aug 15
2
Re: [PATCH libnbd v2 10/10] generator: Check requirements for BytesPersistIn/Out and completion callbacks.
...osure completion optarg. > + *) I like it. Other than the unintended semantic change in patch 4, I think this series is ready to go. We still had another potential API change to squeeze into 0.9.8: Right now, the API is overloading 'command': nbd_connect_command/nbd_kill_command vs. nbd_aio_command_completed/nbd_aio_peek_command_completed Keeping nbd_connect_command may be okay (it takes a command line to create a subprocess), but we may want to rename nbd_kill_command to nbd_kill_child or similar, to make it obvious that it is NOT associated with attempting an early abort of any synchronous nbd_pre...
2019 Jul 24
2
[libnbd PATCH] docs: Mention that nbd_close is not thread-safe
...nerator/generator index 896ad2a..bdd8fd7 100755 --- a/generator/generator +++ b/generator/generator @@ -3532,7 +3532,8 @@ for how to get further details of the error. Closes the handle and frees any associated resources. The final status of any command that has not been retired (whether by C<nbd_aio_command_completed> or by a low-level completion callback -returning C<1>) is lost. +returning C<1>) is lost. This function is not safe to call while +any other thread is still using any C<nbd_*> API on the same handle. =head1 GETTING THE LATEST ERROR MESSAGE IN THE THREAD -- 2.20.1
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
0
[libnbd PATCH 1/6] api: Add nbd_aio_in_flight
...(void *arg) /* If a command is ready to retire, retire it. */ while ((done = nbd_aio_peek_command_completed (nbd)) > 0) { - for (i = 0; i < in_flight; ++i) { + for (i = 0; i < sizeof handles / sizeof handles[0]; ++i) { if (handles[i] == done) { r = nbd_aio_command_completed (nbd, handles[i]); if (r == -1) { fprintf (stderr, "%s\n", nbd_get_error ()); goto error; } - assert (r); - memmove (&handles[i], &handles[i+1], - sizeof (handles[0]) * (in_flight - i - 1)); -...
2019 Jul 18
1
Re: [libnbd PATCH 4/6] states: Prepare for aio notify callback
On 6/29/19 8:28 AM, Eric Blake wrote: > > We also want the client to be aware of any issued/in-flight commands > that failed because they were stranded when the state machine moved to > CLOSED or DEAD. Previously, nbd_aio_command_completed() would never > locate such stranded commands, but adding a common point to fire the > notifier for such commands makes it also possible to move those > commands to the completion queue. > > +++ b/generator/states.c > @@ -111,6 +111,31 @@ send_from_wbuf (struct nbd_handle *h)...
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
2020 Sep 11
0
[libnbd PATCH v2 3/5] api: Add nbd_set_strict_mode
...ds"; - Link "is_read_only"; Link "pwrite"]; + Link "is_read_only"; Link "pwrite"; Link "set_strict_mode"]; }; "aio_disconnect", { @@ -2132,9 +2211,10 @@ To check if the command completed, call L<nbd_aio_command_completed(3)>. Or supply the optional C<completion_callback> which will be invoked as described in L<libnbd(3)/Completion callbacks>. -Other parameters behave as documented in L<nbd_flush(3)>."; +Other parameters behave as documented in L<nbd_flush(3)>." +^ strict_ca...
2019 Jul 01
3
[nbdkit PATCH 0/2] Use new libnbd _notify functions
I'm not observing any noticeable performance differences, but I'm liking the diffstat. I can't push this patch until we release a new libnbd version with the _notify API addition, but am posting it now for playing with things. Eric Blake (2): nbd: Move transaction info from heap to stack nbd: Use nbdkit aio_*_notify variants plugins/nbd/nbd.c | 217
2019 Jun 28
3
[libnbd PATCH] tests: Enhance errors test
...-1) { + fprintf (stderr, "%s: test failed: " + "nbd_aio_notify_write in wrong state did not fail\n", + argv[0]); + exit (EXIT_FAILURE); + } + check (EINVAL, "nbd_aio_notify_write: "); + + /* Check for status of a bogus handle */ + if (nbd_aio_command_completed (nbd, 0) != -1) { + fprintf (stderr, "%s: test failed: " + "nbd_aio_command_completed on bogus handle did not fail\n", + argv[0]); exit (EXIT_FAILURE); } - if (errnum != ENOTCONN) { + check (EINVAL, "nbd_aio_command_completed: ");...
2020 Sep 11
3
[libnbd PATCH] api: Add LIBNBD_SHUTDOWN_IMMEDIATE flag
...ill_subprocess: %s\n", argv[0], + nbd_get_error ()); + exit (EXIT_FAILURE); + } + if (nbd_aio_peek_command_completed (nbd) != 0) { + fprintf (stderr, "%s: test failed: nbd_aio_peek_command_completed\n", + argv[0]); + exit (EXIT_FAILURE); + } + if (nbd_aio_command_completed (nbd, cookie) != 0) { + fprintf (stderr, "%s: test failed: nbd_aio_command_completed\n", argv[0]); + exit (EXIT_FAILURE); + } + + /* Send an immediate shutdown. This will abort the second write, as + * well as kick the state machine to finish the first. + */ + if (nbd_shut...
2019 Jul 24
1
Re: [PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
...> + cmd->cb.fn.read (LIBNBD_CALLBACK_FREE, cmd->cb.fn_user_data, > + NULL, 0, 0, 0, NULL); > + if (cmd->cb.callback) > + cmd->cb.callback (LIBNBD_CALLBACK_FREE, cmd->cb.user_data, > + 0, NULL); > + > free (cmd); nbd_aio_command_completed is skipped when a user calls nbd_close. While we've documented that nbd_close loses the exit status of any unretired command (different from the fact that completion callbacks run on transition to DEAD but the handle is still around), it is still probably worth tweaking nbd_close's use o...