Displaying 8 results from an estimated 8 matches for "nbdkit_extents_size".
2019 Mar 20
0
[PATCH nbdkit 1/8] server: Implement extents/can_extents calls for plugins and filters.
...Without error checking it would look like
+this:
+
+ myfilter_extents (...)
+ {
+ size_t i;
+ struct nbdkit_extents *extents2;
+ struct nbdkit_extent e;
+
+ extents2 = nbdkit_extents_new (offset);
+ next_ops->extents (nxdata, count, offset, flags, extents2, err);
+ for (i = 0; i < nbdkit_extents_size (extents2); ++i) {
+ e = nbdkit_get_extent (extents2, i);
+ e.offset = /* transform offset */;
+ nbdkit_add_extent (extents, e.offset, e.length, e.type);
+ }
+ nbdkit_extents_free (extents2);
+ }
+
+More complicated transformations may require the filter to allocate a
+new extents l...
2019 Mar 23
3
Re: [PATCH nbdkit 1/8] server: Implement extents/can_extents calls for plugins and filters.
...gt; +
> + myfilter_extents (...)
> + {
> + size_t i;
> + struct nbdkit_extents *extents2;
> + struct nbdkit_extent e;
> +
> + extents2 = nbdkit_extents_new (offset);
> + next_ops->extents (nxdata, count, offset, flags, extents2, err);
> + for (i = 0; i < nbdkit_extents_size (extents2); ++i) {
> + e = nbdkit_get_extent (extents2, i);
> + e.offset = /* transform offset */;
> + nbdkit_add_extent (extents, e.offset, e.length, e.type);
> + }
> + nbdkit_extents_free (extents2);
> + }
> +
> +More complicated transformations may require...
2019 Mar 20
15
[PATCH nbdkit 0/8] Implement extents using a simpler array.
Not sure what version we're up to, but this reimplements extents using
the new simpler structure described in this thread:
https://www.redhat.com/archives/libguestfs/2019-March/msg00077.html
I also fixed most of the things that Eric pointed out in the previous
review, although I need to go back over his replies and check I've got
everything.
This needs a bit more testing. However the
2019 Mar 25
0
Re: [PATCH nbdkit 1/8] server: Implement extents/can_extents calls for plugins and filters.
...> + {
> > + size_t i;
> > + struct nbdkit_extents *extents2;
> > + struct nbdkit_extent e;
> > +
> > + extents2 = nbdkit_extents_new (offset);
> > + next_ops->extents (nxdata, count, offset, flags, extents2, err);
> > + for (i = 0; i < nbdkit_extents_size (extents2); ++i) {
> > + e = nbdkit_get_extent (extents2, i);
> > + e.offset = /* transform offset */;
> > + nbdkit_add_extent (extents, e.offset, e.length, e.type);
> > + }
> > + nbdkit_extents_free (extents2);
> > + }
> > +
> > +More...
2019 Mar 20
0
[PATCH nbdkit 4/8] offset: Implement mapping of extents.
...struct nbdkit_extent e;
+
+ extents2 = nbdkit_extents_new (offs + offset);
+ if (extents2 == NULL) {
+ *err = errno;
+ return -1;
+ }
+ if (next_ops->extents (nxdata, count, offs + offset,
+ flags, extents2, err) == -1)
+ goto error;
+
+ for (i = 0; i < nbdkit_extents_size (extents2); ++i) {
+ e = nbdkit_get_extent (extents2, i);
+ e.offset -= offset;
+ if (nbdkit_add_extent (extents, e.offset, e.length, e.type) == -1)
+ goto error;
+ }
+ nbdkit_extents_free (extents2);
+ return 0;
+
+ error:
+ nbdkit_extents_free (extents2);
+ return -1;
+}
+
sta...
2019 Mar 20
0
[PATCH nbdkit 5/8] partition: Implement mapping of extents.
...kit_extent e;
+
+ extents2 = nbdkit_extents_new (offs + h->offset);
+ if (extents2 == NULL) {
+ *err = errno;
+ return -1;
+ }
+ if (next_ops->extents (nxdata, count, offs + h->offset,
+ flags, extents2, err) == -1)
+ goto error;
+
+ for (i = 0; i < nbdkit_extents_size (extents2); ++i) {
+ e = nbdkit_get_extent (extents2, i);
+ e.offset -= h->offset;
+ if (nbdkit_add_extent (extents, e.offset, e.length, e.type) == -1)
+ goto error;
+ }
+ nbdkit_extents_free (extents2);
+ return 0;
+
+ error:
+ nbdkit_extents_free (extents2);
+ return -1;
+}...
2019 Mar 23
1
Re: [PATCH nbdkit 3/8] server: Implement Block Status requests to read allocation status.
...t flags,
> + uint32_t count, uint64_t offset,
> + struct nbdkit_extents *extents)
> +{
> + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&conn->write_lock);
> + struct structured_reply reply;
> + size_t nr_extents = nbdkit_extents_size (extents);
> + uint32_t context_id;
> + size_t i;
> + int r;
> +
> + assert (cmd == NBD_CMD_BLOCK_STATUS);
> +
Worth asserting conn->meta_context_base_allocation?
> +
> + /* Send each block descriptor. */
> + for (i = 0; i < nr_extents; ++i) {
Where does t...
2019 Mar 20
0
[PATCH nbdkit 3/8] server: Implement Block Status requests to read allocation status.
...uint16_t cmd, uint16_t flags,
+ uint32_t count, uint64_t offset,
+ struct nbdkit_extents *extents)
+{
+ ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&conn->write_lock);
+ struct structured_reply reply;
+ size_t nr_extents = nbdkit_extents_size (extents);
+ uint32_t context_id;
+ size_t i;
+ int r;
+
+ assert (cmd == NBD_CMD_BLOCK_STATUS);
+
+ reply.magic = htobe32 (NBD_STRUCTURED_REPLY_MAGIC);
+ reply.handle = handle;
+ reply.flags = htobe16 (NBD_REPLY_FLAG_DONE);
+ reply.type = htobe16 (NBD_REPLY_TYPE_BLOCK_STATUS);
+ reply.len...