Displaying 20 results from an estimated 67 matches for "meta_contexts".
Did you mean:
meta_context
2019 Jun 04
0
[libnbd PATCH 2/2] api: Recover from block status callback failure
...e-swap the entries returned, but apart from that we
- * don't validate them.
- */
- for (i = 0; i < length/4; ++i)
- h->bs_entries[i] = be32toh (h->bs_entries[i]);
-
- /* Look up the context ID. */
- context_id = h->bs_entries[0];
- for (meta_context = h->meta_contexts;
- meta_context;
- meta_context = meta_context->next)
- if (context_id == meta_context->context_id)
- break;
-
- if (meta_context) {
- /* Call the caller's extent function. */
- if (cmd->extent_fn (cmd->data, meta_context->name, cmd->of...
2019 Jun 27
1
[libnbd PATCH] block-status: Make callback usage consistent with pread_structured
...e-swap the entries returned, but apart from that we
+ * don't validate them.
+ */
+ for (i = 0; i < length/4; ++i)
+ h->bs_entries[i] = be32toh (h->bs_entries[i]);
+
+ /* Look up the context ID. */
+ context_id = h->bs_entries[0];
+ for (meta_context = h->meta_contexts;
+ meta_context;
+ meta_context = meta_context->next)
+ if (context_id == meta_context->context_id)
+ break;
+
+ if (meta_context) {
+ /* Call the caller's extent function. */
+ int error = cmd->error;
+
+ if (cmd->cb.fn.extent (cmd->...
2019 Jun 04
3
[libnbd PATCH 0/2] Better handling of failed block_status callback
Rather than moving the connection to DEAD, we can just ignore further
contexts to the existing command handle, and fail the overall command
with the same errno as the failed callback.
Eric Blake (2):
states: Track cmd->error as errno, not wire value
api: Recover from block status callback failure
generator/generator | 5 ++-
generator/states-reply-simple.c | 2 +-
2020 Sep 28
0
[libnbd PATCH 3/3] api: Add nbd_opt_list_meta_context
...tion mode.
+
+The NBD protocol allows a client to decide how many queries to ask
+the server. Rather than taking that list of queries as a parameter
+to this function, libnbd reuses the current list of requested meta
+contexts as set by L<nbd_add_meta_context(3)>; you can use
+L<nbd_clear_meta_contexts(3)> to set up a different list of queries.
+When the list is empty, a server will typically reply with all
+contexts that it supports; when the list is non-empty, the server
+will reply only with supported contexts that match the client's
+request. Note that a reply by the server might be e...
2020 Sep 28
8
[libnbd PATCH 0/3] opt_list_meta_context
...do:
- write interop tests for qemu-nbd and nbdkit (including my proposed
patch addition of qemu-nbd -A to show qemu:allocation-depth)
- figure out if we can make 'nbdinfo --map' use the new API to
automatically select all contexts advertised by the server
Eric Blake (3):
api: Add get_nr_meta_contexts, clear_meta_contexts
generator: Rename OPT_SET_META_CONTEXT states
api: Add nbd_opt_list_meta_context
lib/internal.h | 1 +
generator/API.ml | 162 +++++++++++++++++-
generator/Makefile.am | 4 +-
generato...
2019 Jun 04
1
Re: [PATCH libnbd v2 2/4] generator: Callback returns int instead of void.
On 6/4/19 4:59 AM, Richard W.M. Jones wrote:
> Callback functions now return an int instead of a void. This allows
> in some cases for the callback to indicate that there was an error.
>
> This is a small change to the API:
Indeed; and my work to let nbdkit-nbd use libnbd is slightly impacted.
If I want to support both 0.1.2 and 0.1.x, I now have to do a
conditional compilation
2023 Aug 04
2
[libnbd PATCH v4 01/25] block_status: Add some sanity checking of server lengths
...const char *name;
> + uint32_t orig_len, len, flags;
> + uint64_t total, cap;
> + bool stop;
>
> switch (recv_into_rbuf (h)) {
> case -1: SET_NEXT_STATE (%.DEAD); return 0;
> @@ -481,30 +486,63 @@ REPLY.CHUNK_REPLY.RECV_BS_ENTRIES:
> if (context_id == h->meta_contexts.ptr[i].context_id)
> break;
>
> - if (i < h->meta_contexts.len) {
> - int error = cmd->error;
> - const char *name = h->meta_contexts.ptr[i].name;
> -
> - /* Need to byte-swap the entries returned, but apart from that
> - * we do...
2019 May 23
2
[PATCH libnbd] api: Get rid of nbd_connection.
This isn't quite finished because not all of the tests or examples
have been updated, but it demonstrates an idea: Should we forget about
the concept of having multiple connections managed under a single
handle?
In this patch there is a single ‘struct nbd_handle *’ which manages a
single state machine and connection (and therefore no nbd_connection).
To connect to a multi-conn server you must
2019 Jul 25
0
[PATCH libnbd v3 2/2] lib: Remove nbd_add_close_callback.
...*h)
if (h->debug_fn)
h->debug_fn (LIBNBD_CALLBACK_FREE, h->debug_data, NULL, NULL);
- for (cc = h->close_callbacks; cc != NULL; cc = cc_next) {
- cc_next = cc->next;
- cc->cb (cc->user_data);
- free (cc);
- }
-
free (h->bs_entries);
for (m = h->meta_contexts; m != NULL; m = m_next) {
m_next = m->next;
@@ -202,34 +195,6 @@ nbd_unlocked_add_meta_context (struct nbd_handle *h, const char *name)
return 0;
}
-/* This is not generated because we don't want to offer it to other
- * programming languages.
- */
-int
-nbd_add_close_callback (st...
2020 Oct 02
4
[libnbd PATCH v2 0/2] opt_list_meta_context
In v2: ack'ed preliminary patches have been pushed, and I've added a
lot of testsuite coverage as well as putting the new API to use in
nbdinfo.
Eric Blake (2):
api: Add nbd_opt_list_meta_context
info: List available meta-contexts
lib/internal.h | 1 +
generator/API.ml | 84 ++++++++-
2020 Aug 10
5
[PATCH nbdkit] python: Implement can_extents + extents.
---
plugins/python/nbdkit-python-plugin.pod | 19 ++++++-
plugins/python/python.c | 75 +++++++++++++++++++++++++
tests/test-python-plugin.py | 8 ++-
tests/test_python.py | 73 +++++++++++++++++++++++-
4 files changed, 169 insertions(+), 6 deletions(-)
diff --git a/plugins/python/nbdkit-python-plugin.pod b/plugins/python/nbdkit-python-plugin.pod
2019 Jun 04
0
[PATCH libnbd v2 2/4] generator: Callback returns int instead of void.
Callback functions now return an int instead of a void. This allows
in some cases for the callback to indicate that there was an error.
This is a small change to the API:
For nbd_set_debug_callback the signature has changed, but the return
value is ignored.
For nbd_block_status and nbd_aio_block_status the extent function can
return an error, which causes the block status command to return an
2019 Jun 14
0
[libnbd PATCH 5/7] states: Factor out NBD_REP payload prep
Instead of repeating a check for valid reply headers in each sub-state
machine, let's have a common helper function do all the
work. Additionally, a central location will make it easier to
uniformly capture any NBD_REP_ERR message payloads.
---
generator/generator | 8 +--
generator/states-newstyle-opt-go.c | 40 +++----------
2019 Jun 18
0
[libnbd PATCH 4/8] states: Prepare for read callback
The next patch will add a new 'nbd_aio_pread_callback' function for
allowing the user more immediate access as each chunk of a structured
reply read is received. But before we do that, let's refactor the
command code. This includes a revert of 12843a1a, since the read
callback will need both a buffer and the user's opaque object at the
same time.
---
2020 Aug 10
0
Re: [PATCH nbdkit] python: Implement can_extents + extents.
On Mon, Aug 10, 2020 at 1:51 PM Richard W.M. Jones <rjones@redhat.com> wrote:
>
> ---
> plugins/python/nbdkit-python-plugin.pod | 19 ++++++-
> plugins/python/python.c | 75 +++++++++++++++++++++++++
> tests/test-python-plugin.py | 8 ++-
> tests/test_python.py | 73 +++++++++++++++++++++++-
> 4 files changed, 169
2019 Jun 14
10
[libnbd PATCH 0/7] state machine refactoring
I'm still playing with ideas on how to split rstate from wstate (so
that we can send a request without waiting for POLLIN to complete a
pending reply), but this is some preliminary refactoring I found
useful. I also fixed a couple of bugs while in the area (already
pushed).
There's a question of whether we want nbd_handle to be nearly 5k, or
if we should instead keep it small and add one
2019 Jun 29
0
[libnbd PATCH 2/6] generator: Allow DEAD state actions to run
...;
@@ -76,7 +76,7 @@
NEWSTYLE.OPT_SET_META_CONTEXT.SEND_EXPORTNAME:
switch (send_from_wbuf (h)) {
- case -1: SET_NEXT_STATE (%.DEAD); return -1;
+ case -1: SET_NEXT_STATE (%.DEAD); return 0;
case 0:
h->sbuf.nrqueries =
htobe32 (nbd_internal_string_list_length (h->request_meta_contexts));
@@ -89,7 +89,7 @@
NEWSTYLE.OPT_SET_META_CONTEXT.SEND_NRQUERIES:
switch (send_from_wbuf (h)) {
- case -1: SET_NEXT_STATE (%.DEAD); return -1;
+ case -1: SET_NEXT_STATE (%.DEAD); return 0;
case 0:
h->querynum = 0;
SET_NEXT_STATE (%PREPARE_NEXT_QUERY);
@@ -115,7 +115,7 @@...
2019 Jul 25
0
[libnbd PATCH] lib: Reduce number of read/block_status callbacks
When the server sets NBD_REPLY_FLAG_DONE on a data or block status
chunk, we can use that fact to pass (VALID|FREE) and avoid a separate
callback later just for FREE.
---
As I've been promising in other threads...
generator/states-reply-structured.c | 33 +++++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/generator/states-reply-structured.c
2019 Aug 12
0
[PATCH libnbd 1/7] api: Add semi-private function for freeing persistent data.
This adds a C-only semi-private function for freeing various types of
persistent data passed to libnbd.
There are some similarities with nbd_add_close_callback which we
removed in commit 7f191b150b52ed50098976309a6af883d245fc56.
---
generator/generator | 57 ++++++++++++++++++++
lib/Makefile.am | 1 +
lib/free.c | 129 ++++++++++++++++++++++++++++++++++++++++++++
lib/handle.c
2019 Aug 14
2
[libnbd PATCH] lib: Consolidate free callbacks to just happen at retire time
When we introduced valid_flags, there was an incentive to do as few
callbacks as possible, favoring cb(VALID|FREE) calls over the sequence
cb(VALID);cb(FREE). To make it work, we set .callback=NULL after an
early free, so that the later check during retirement didn't free
again.
But now that our .free callback is distinct from our other callbacks,
there is no longer an advantage to bundling