search for: nbdplug_notify

Displaying 7 results from an estimated 7 matches for "nbdplug_notify".

2019 Jul 17
3
[nbdkit PATCH 0/2] Another libnbd API bump
libnbd 0.1.7 was released today, which breaks compilation of nbdkit-nbd-plugin. We could work around it by using #ifdef LIBNBD_HAVE_XXX to learn about the renamed functions, but supporting older versions is not all that important when we don't yet have API stability. So patch 1 copes by just bumping the minimum version instead, except that we have yet another pending libnbd patch with an API
2019 Jul 17
0
[nbdkit PATCH 2/2] nbd: Another libnbd API bump
.../nbd/nbd.c @@ -673,7 +673,7 @@ nbdplug_pread (void *handle, void *buf, uint32_t count, uint64_t offset, assert (!flags); nbdplug_prepare (&s); nbdplug_register (h, &s, nbd_aio_pread_callback (h->nbd, buf, count, offset, - &s, nbdplug_notify, 0)); + nbdplug_notify, &s, 0)); return nbdplug_reply (h, &s); } @@ -689,7 +689,7 @@ nbdplug_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset, assert (!(flags & ~NBDKIT_FLAG_FUA)); nbdplug_prepare (&s...
2019 Aug 15
3
[nbdkit PATCH] nbd: Another libnbd version bump
...der (void *handle) return NULL; } -/* Prepare for a transaction. */ -static void -nbdplug_prepare (struct transaction *trans) -{ - memset (trans, 0, sizeof *trans); - if (sem_init (&trans->sem, 0, 0)) - assert (false); -} - +/* Callback used at end of a transaction. */ static int -nbdplug_notify (unsigned valid_flag, void *opaque, int *error) +nbdplug_notify (void *opaque, int *error) { struct transaction *trans = opaque; - if (!(valid_flag & LIBNBD_CALLBACK_VALID)) - return 0; - /* There's a possible race here where trans->cookie has not yet been * updated by nb...
2019 Jul 01
0
[nbdkit PATCH 2/2] nbd: Use nbdkit aio_*_notify variants
...(&trans->sem)) { - nbdkit_error ("failed to post semaphore: %m"); - abort (); - } - } nbdkit_debug ("exiting state machine thread"); return NULL; } @@ -411,6 +353,23 @@ nbdplug_prepare (struct transaction *trans) assert (false); } +static int +nbdplug_notify (void *opaque, int64_t cookie, int *error) +{ + struct transaction *trans = opaque; + + nbdkit_debug ("cookie %" PRId64 " completed state machine, status %d", + cookie, *error); + assert (trans->cookie == 0 || trans->cookie == cookie); + trans->cookie...
2019 Jul 30
1
[PATCH nbdkit] nbd: Update for libnbd 0.9.6.
...0..e8bc779 100644 --- a/plugins/nbd/nbd.c +++ b/plugins/nbd/nbd.c @@ -57,6 +57,7 @@ /* The per-transaction details */ struct transaction { + int64_t cookie; sem_t sem; uint32_t early_err; uint32_t err; @@ -353,15 +354,19 @@ nbdplug_prepare (struct transaction *trans) } static int -nbdplug_notify (unsigned valid_flag, void *opaque, int64_t cookie, int *error) +nbdplug_notify (unsigned valid_flag, void *opaque, int *error) { struct transaction *trans = opaque; if (!(valid_flag & LIBNBD_CALLBACK_VALID)) return 0; + /* There's a possible race here where trans->cooki...
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 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