search for: metacontext

Displaying 20 results from an estimated 82 matches for "metacontext".

2019 Jun 27
1
[libnbd PATCH] block-status: Make callback usage consistent with pread_structured
...4 insertions(+), 51 deletions(-) diff --git a/generator/generator b/generator/generator index ec09836..c29460c 100755 --- a/generator/generator +++ b/generator/generator @@ -1527,7 +1527,8 @@ punching a hole."; Callback ("extent", [Opaque "data"; String "metacontext"; UInt64 "offset"; ArrayAndLen (UInt32 "entries", - "nr_entries")]); + "nr_entries"); +...
2020 Oct 16
3
[libnbd PATCH] info: Add support for new 'qemu-nbd -A' qemu:allocation-depth
...and upstream, although it looks like I've got positive review. info/nbdinfo.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/info/nbdinfo.c b/info/nbdinfo.c index 24ec129..1afdf98 100644 --- a/info/nbdinfo.c +++ b/info/nbdinfo.c @@ -780,6 +780,13 @@ extent_description (const char *metacontext, uint32_t type) case 1: return "dirty"; } } + else if (strcmp (metacontext, "qemu:allocation-depth") == 0) { + switch (type & 3) { + case 0: return "unallocated"; + case 1: return "local"; + case 2: return "backing"; +...
2023 Mar 03
1
[PATCH v2 5/6] spec: Introduce NBD_FLAG_BLOCK_STATUS_PAYLOAD
...`NBD_FLAG_BLOCK_STATUS_PAYLOAD`: Indicates that the server > > + understands the use of the `NBD_CMD_FLAG_PAYLOAD_LEN` flag to > > + `NBD_CMD_BLOCK_STATUS` to allow the client to request that the > > + server filters its response to a specific subset of negotiated > > + metacontext ids passed in via a client payload, rather than the > > + default of replying to all metacontext ids. Servers MUST NOT > > + advertise this bit unless the client successfully negotiates > > + extended headers via `NBD_OPT_EXTENDED_HEADERS`, and SHOULD NOT > > + advertise...
2019 Jun 27
0
Re: [libnbd PATCH] generator: Add support for namespace constants
...rop/dirty-bitmap.c @@ -30,7 +30,6 @@ static const char *unixsocket; static const char *bitmap; -static const char *base_allocation = "base:allocation"; struct data { bool req_one; /* input: true if req_one was passed to request */ @@ -53,7 +52,7 @@ cb (void *opaque, const char *metacontext, uint64_t offset, assert (offset == 0); assert (data->count-- > 0); /* [qemu-nbd] */ - if (strcmp (metacontext, base_allocation) == 0) { + if (strcmp (metacontext, LIBNBD_CONTEXT_BASE_ALLOCATION) == 0) { assert (!data->seen_base); /* [qemu-nbd] */ data->seen_base = tr...
2019 Jun 04
0
[PATCH libnbd v2 2/4] generator: Callback returns int instead of void.
...index b3a89d0..8d34173 100644 --- a/interop/dirty-bitmap.c +++ b/interop/dirty-bitmap.c @@ -32,7 +32,7 @@ static const char *base_allocation = "base:allocation"; static int calls; /* Track which contexts passed through callback */ -static void +static int cb (void *data, const char *metacontext, uint64_t offset, uint32_t *entries, size_t len) { @@ -71,6 +71,8 @@ cb (void *data, const char *metacontext, uint64_t offset, fprintf (stderr, "unexpected context %s\n", metacontext); exit (EXIT_FAILURE); } + + return 0; } int diff --git a/lib/debug.c b/lib/debug....
2020 Oct 27
0
Re: [libnbd PATCH] info: Add support for new 'qemu-nbd -A' qemu:allocation-depth
...(-) diff --git a/info/nbdinfo.c b/info/nbdinfo.c index 2b22f51..b152f28 100644 --- a/info/nbdinfo.c +++ b/info/nbdinfo.c @@ -767,28 +767,30 @@ get_content (struct nbd_handle *nbd, int64_t size) } /* Callback handling --map. */ -static const char * +static char * extent_description (const char *metacontext, uint32_t type) { + char *ret; + if (strcmp (metacontext, "base:allocation") == 0) { switch (type) { - case 0: return "allocated"; - case 1: return "hole"; - case 2: return "zero"; - case 3: return "hole,zero"; + case 0: ret...
2019 Jun 04
0
[libnbd PATCH 2/2] api: Recover from block status callback failure
...k. +cause a deadlock. If the callback returns C<-1>, any remaining +contexts will be ignored and the overall block status command +will fail with the same value of C<errno> left after the +failing callback. The extent function is called once per type of metadata available. The C<metacontext> parameter is a string diff --git a/generator/states-reply-structured.c b/generator/states-reply-structured.c index c7ba892..5791360 100644 --- a/generator/states-reply-structured.c +++ b/generator/states-reply-structured.c @@ -357,34 +357,37 @@ assert (h->bs_entries); assert (lengt...
2019 Jun 27
3
[libnbd PATCH] generator: Add support for namespace constants
This just defines the namespace, its contexts and related constants and the only supported one is currently base:allocation. The names of the constants are not very future-proof, but shorter than LIBNBD_META_NS_CONTEXT_BASE_ALLOCATION or similar. Currently the output looks like this: /* "base" namespace */ /* "base" namespace contexts */ /* "base:allocation"
2020 Sep 26
1
[PATCH nbdinfo proposal] info: Add a --map option for displaying allocation metadata
This is a rough-and-ready implementation of nbdinfo --map option, to display the allocation and other metadata of NBD exports. I only tested it lightly against nbdkit. It needs at least some tests. Command like these should work: nbdinfo --map nbd://localhost nbdinfo --map=qemu:dirty-bitmap nbd://localhost Rich.
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 26
2
[PATCH nbdinfo v2] info: Add a --map option for displaying allocation metadata.
Fixes bugs with JSON output in the previous patch, and adds some tests. Rich.
2019 Jul 24
0
[PATCH libnbd 2/3] lib: Implement closure lifetimes.
...]; @@ -1541,13 +1536,12 @@ punching a hole."; "block_status", { default_call with args = [ UInt64 "count"; UInt64 "offset"; - Closure (false, - { cbname="extent"; - cbargs=[String "metacontext"; - UInt64 "offset"; - ArrayAndLen (UInt32 "entries", - "nr_entries"); - Mutable (Int "error")]} ); + Clo...
2019 Jun 04
1
Re: [PATCH libnbd v2 2/4] generator: Callback returns int instead of void.
...rop/dirty-bitmap.c > +++ b/interop/dirty-bitmap.c > @@ -32,7 +32,7 @@ static const char *base_allocation = "base:allocation"; > > static int calls; /* Track which contexts passed through callback */ > > -static void > +static int > cb (void *data, const char *metacontext, uint64_t offset, > uint32_t *entries, size_t len) > { > @@ -71,6 +71,8 @@ cb (void *data, const char *metacontext, uint64_t offset, > fprintf (stderr, "unexpected context %s\n", metacontext); > exit (EXIT_FAILURE); > } > + > + return 0; In fac...
2020 Oct 01
1
Re: [PATCH nbdinfo v2] info: Add a --map option for displaying allocation metadata.
...mory plugin uses a 32K page size, and extents > +# are always aligned with this. > +nbdkit -U - memory 1M --run ' > + nbdsh -u "$uri" \ ...since you are depending on it. > +/* Callback handling --map. */ > +static const char * > +extent_description (const char *metacontext, uint32_t type) > +{ > + if (strcmp (metacontext, "base:allocation") == 0) { Should we favor the use of LIBNBD_CONTEXT_BASE_ALLOCATION instead of open-coding this? > + switch (type) { > + case 0: return "allocated"; > + case 1: return "zero";...
2019 Jul 24
0
[PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
...]; @@ -1541,13 +1536,12 @@ punching a hole."; "block_status", { default_call with args = [ UInt64 "count"; UInt64 "offset"; - Closure (false, - { cbname="extent"; - cbargs=[String "metacontext"; - UInt64 "offset"; - ArrayAndLen (UInt32 "entries", - "nr_entries"); - Mutable (Int "error")]} ); + Clo...
2020 Sep 26
0
[PATCH nbdinfo v2] info: Add a --map option for displaying allocation metadata.
...ist_one_export (struct nbd_handle *nbd, const char *desc, static void list_all_exports (struct nbd_handle *nbd1, const char *uri); static void print_json_string (const char *); static char *get_content (struct nbd_handle *, int64_t size); +static int extent_callback (void *user_data, const char *metacontext, + uint64_t offset, + uint32_t *entries, size_t nr_entries, + int *error); static void __attribute__((noreturn)) usage (FILE *fp, int exitcode) @@ -60,6 +65,7 @@ usage (FILE *fp, int exitcode) " nbdinfo nb...
2019 Aug 13
0
[PATCH libnbd 1/6] generator: Share single list of all Closures.
...cbname = "completion"; + cbargs = [ CBMutable (Int "error") ] +} +let debug_closure = { + cbname = "debug"; + cbargs = [ CBString "context"; CBString "msg" ] +} +let extent_closure = { + cbname = "extent"; + cbargs = [ CBString "metacontext"; + CBUInt64 "offset"; + CBArrayAndLen (UInt32 "entries", + "nr_entries"); + CBMutable (Int "error") ] +} +let all_closures = [ chunk_closure; completion_closure; + debug_...
2019 May 28
0
[libnbd PATCH 2/4] api: Rearrange flags argument to block_status
...default_call with - args = [ UInt64 "count"; UInt64 "offset"; UInt32 "flags"; + args = [ UInt64 "count"; UInt64 "offset"; Opaque "data"; Callback ("extent", [Opaque "data"; String "metacontext"; UInt64 "offset"; ArrayAndLen (UInt32 "entries", - "nr_entries")]) ]; + "nr_entries")]); +...
2019 Jul 16
2
[PATCH libnbd] generator: Define new Closure type
** INCOMPLETE ** This is the generator change as discussed on the list already. The Python and OCaml bindings are not yet done. It passes all [C only] tests and valgrind. Note that nbd_add_close_callback is inconsistent with other closure types because it passes the user_data parameter after the function. (This is not caused by the current patch, it was already inconsistent). We decided that
2019 Jul 25
0
[PATCH libnbd v3 1/2] lib: Implement closure lifetimes.
..."block_status", { default_call with args = [ UInt64 "count"; UInt64 "offset"; - Closure (false, - { cbname="extent"; + Closure { cbname="extent"; cbargs=[String "metacontext"; UInt64 "offset"; ArrayAndLen (UInt32 "entries", "nr_entries"); - Mutable (Int "error")]} ); +...