Displaying 15 results from an estimated 15 matches for "nbdkit_extents_foreach".
2019 Mar 12
2
Re: [PATCH nbdkit] server: Implement extents/can_extents calls for plugins and filters.
...r handling it
> +would look like this:
> +
> + myfilter_extents (...)
> + {
> + struct nbdkit_extents_map *map2 = nbdkit_extents_new ();
> + next_ops->extents (nxdata, count, offset, flags, map2, err);
> + /* transform map2 and return results in extents_map */
> + nbdkit_extents_foreach (map2, transform_offset, extents_map);
> + nbdkit_extents_free (map2);
> + }
And the fact that we can easily call nbdkit_extents_new() as needed
means that a filter could, for example, call next_ops->extents() even
for its pread implementation (of course, only for a plugin that
.can_ext...
2019 Mar 13
2
[PATCH nbdkit] server: Implement extents/can_extents calls for plugins and filters.
I'm not sure which version we're up to now. Anyway I believe
this addresses all the points that Eric raised in:
https://www.redhat.com/archives/libguestfs/2019-March/msg00038.html
https://www.redhat.com/archives/libguestfs/2019-March/msg00040.html
In particular:
- default state of extents_map is all allocated disk
- support hole + non-zero
- you can now iterate with bounds
-
2019 Mar 12
2
[PATCH nbdkit] server: Implement extents/can_extents calls for plugins and filters.
Second version based on nbdkit_extent* calls, as discussed here:
https://www.redhat.com/archives/libguestfs/2019-March/msg00033.html
Note in particular there is some subtlety about how filters would work
in this implementation. See docs/nbdkit-filter.pod for the details.
Rich.
2019 Mar 12
0
Re: [PATCH nbdkit] server: Implement extents/can_extents calls for plugins and filters.
...this:
> > +
> > + myfilter_extents (...)
> > + {
> > + struct nbdkit_extents_map *map2 = nbdkit_extents_new ();
> > + next_ops->extents (nxdata, count, offset, flags, map2, err);
> > + /* transform map2 and return results in extents_map */
> > + nbdkit_extents_foreach (map2, transform_offset, extents_map);
> > + nbdkit_extents_free (map2);
> > + }
>
> And the fact that we can easily call nbdkit_extents_new() as needed
> means that a filter could, for example, call next_ops->extents() even
> for its pread implementation (of course, o...
2019 Mar 12
0
[PATCH nbdkit] server: Implement extents/can_extents calls for plugins and filters.
...passed to the layer below. Without error handling it
+would look like this:
+
+ myfilter_extents (...)
+ {
+ struct nbdkit_extents_map *map2 = nbdkit_extents_new ();
+ next_ops->extents (nxdata, count, offset, flags, map2, err);
+ /* transform map2 and return results in extents_map */
+ nbdkit_extents_foreach (map2, transform_offset, extents_map);
+ nbdkit_extents_free (map2);
+ }
+
+If there is an error, C<.extents> should call C<nbdkit_error> with an
+error message B<and> return -1 with C<err> set to the positive errno
+value to return to the client.
+
=head1 ERROR HANDLING...
2019 Mar 13
0
[PATCH nbdkit] server: Implement extents/can_extents calls for plugins and filters.
...passed to the layer below. Without error
+handling it would look like this:
+
+ myfilter_extents (...)
+ {
+ struct nbdkit_extents_map *map2 = nbdkit_extents_new ();
+ next_ops->extents (nxdata, count, offset, flags, map2, err);
+ /* transform map2 and return results in extents_map */
+ nbdkit_extents_foreach (map2, transform_offset, extents_map);
+ nbdkit_extents_free (map2);
+ }
+
+If there is an error, C<.extents> should call C<nbdkit_error> with an
+error message B<and> return -1 with C<err> set to the positive errno
+value to return to the client.
+
+=head3 Allocating and...
2019 Mar 19
15
[PATCH nbdkit 0/9] [mainly for discussion and early review] Implement extents.
I want to post this but mainly for discussion and early review. It's
not safe for these patches to all go upstream yet (because not all
filters have been checked/adjusted), but if any patches were to go
upstream then probably 1 & 2 only are safe.
File, VDDK, memory and data plugins all work, although I have only
done minimal testing on them.
The current tests, such as they are, all
2019 Mar 19
0
[PATCH nbdkit 1/9] server: Implement extents/can_extents calls for plugins and filters.
...passed to the layer below. Without error
+handling it would look like this:
+
+ myfilter_extents (...)
+ {
+ struct nbdkit_extents_map *map2 = nbdkit_extents_new ();
+ next_ops->extents (nxdata, count, offset, flags, map2, err);
+ /* transform map2 and return results in extents_map */
+ nbdkit_extents_foreach (map2, transform_offset, extents_map, /*..*/);
+ nbdkit_extents_free (map2);
+ }
+
+If there is an error, C<.extents> should call C<nbdkit_error> with an
+error message B<and> return -1 with C<err> set to the positive errno
+value to return to the client.
+
+=head3 Allocat...
2019 Mar 20
2
New extents structure proposal
I think the extents map is just too complicated and is unnecessarily
so. How about instead we define the plugin interface to be:
int can_extents (void *handle); // as before
int extents (void *handle, uint32_t count, uint64_t offset, uint32_t flags,
struct nbdkit_extents_list *list);
and have the extents_list be a simple list. The first extent you add
must start at offset.
2019 Mar 19
0
[PATCH nbdkit 4/9] server: Export nbdkit_extent* symbols.
...e changed, 4 insertions(+)
diff --git a/server/nbdkit.syms b/server/nbdkit.syms
index 672abd2..95ef067 100644
--- a/server/nbdkit.syms
+++ b/server/nbdkit.syms
@@ -42,6 +42,10 @@
nbdkit_absolute_path;
nbdkit_debug;
nbdkit_error;
+ nbdkit_extent_add;
+ nbdkit_extents_free;
+ nbdkit_extents_foreach;
+ nbdkit_extents_new;
nbdkit_parse_bool;
nbdkit_parse_size;
nbdkit_read_password;
--
2.20.1
2019 Mar 19
0
[PATCH nbdkit 5/9] offset: Implement mapping of extents.
...bdkit_extents_new ();
+ if (map2 == NULL)
+ return -1;
+ if (next_ops->extents (nxdata, count, offs + offset,
+ flags, map2, err) == -1) {
+ nbdkit_extents_free (map2);
+ return -1;
+ }
+
+ /* Transform offsets in map2, return result in extents_map. */
+ if (nbdkit_extents_foreach (map2, subtract_offset, extents_map,
+ NBDKIT_EXTENTS_FOREACH_FLAG_RANGE,
+ offset, range) == -1) {
+ nbdkit_extents_free (map2);
+ return -1;
+ }
+ nbdkit_extents_free (map2);
+
+ return 0;
+}
+
static struct nbdkit_filter filter...
2019 Mar 20
0
Re: New extents structure proposal
...bdkit_extents_new ();
+ if (map2 == NULL)
+ return -1;
+ if (next_ops->extents (nxdata, count, offs + offset,
+ flags, map2, err) == -1) {
+ nbdkit_extents_free (map2);
+ return -1;
+ }
+
+ /* Transform offsets in map2, return result in extents_map. */
+ if (nbdkit_extents_foreach (map2, subtract_offset, extents_map,
+ NBDKIT_EXTENTS_FOREACH_FLAG_RANGE,
+ offset, range) == -1) {
+ nbdkit_extents_free (map2);
+ return -1;
+ }
+ nbdkit_extents_free (map2);
because the plugin was calling:
+ if (nbdkit_extent...
2019 Mar 19
0
[PATCH nbdkit 3/9] server: Implement Block Status requests to read allocation status.
...struct nbdkit_extents_map *extents_map,
+ struct block_descriptor **blocks,
+ size_t *nr_blocks)
+{
+ const bool req_one = flags & NBD_CMD_FLAG_REQ_ONE;
+ uint32_t foreach_flags;
+ struct copy_extents_data data;
+
+ foreach_flags = NBDKIT_EXTENTS_FOREACH_FLAG_RANGE;
+ if (req_one)
+ foreach_flags |= NBDKIT_EXTENTS_FOREACH_FLAG_ONE;
+
+ /* Calculate the number of blocks we will be returning. */
+ *nr_blocks = 0;
+ if (nbdkit_extents_foreach (extents_map,
+ count_extents, nr_blocks,
+ f...
2019 Mar 20
2
Re: [PATCH nbdkit 1/9] server: Implement extents/can_extents calls for plugins and filters.
...over nbdkit_extents_map
> +
> +One function is provided to filters only to iterate over the extents
> +map:
> +
> + typedef int (*nbdkit_extents_callback) (uint64_t offset, uint64_t length,
> + uint32_t type, void *opaque);
> +
> + int nbdkit_extents_foreach (
> + const struct nbdkit_extents_map *extents_map,
> + nbdkit_extents_callback fn, void *opaque,
> + uint32_t flags,
> + uint64_t range_offset, uint64_t range_length);
> +
> +=item C<NBDKIT_EXTENTS_FOREACH_FLAG_RANGE>
> +
>...
2019 Mar 20
2
Re: New extents structure proposal
...t; + return -1;
> + if (next_ops->extents (nxdata, count, offs + offset,
> + flags, map2, err) == -1) {
> + nbdkit_extents_free (map2);
> + return -1;
> + }
> +
> + /* Transform offsets in map2, return result in extents_map. */
> + if (nbdkit_extents_foreach (map2, subtract_offset, extents_map,
> + NBDKIT_EXTENTS_FOREACH_FLAG_RANGE,
> + offset, range) == -1) {
> + nbdkit_extents_free (map2);
> + return -1;
> + }
> + nbdkit_extents_free (map2);
>
> because the plu...