search for: nbdkit_extents_foreach_flag_range

Displaying 9 results from an estimated 9 matches for "nbdkit_extents_foreach_flag_range".

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 5/9] offset: Implement mapping of extents.
...ata, 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 = { .name = "offset", .longname = "nbdkit offset filter&quo...
2019 Mar 20
2
Re: [PATCH nbdkit 1/9] server: Implement extents/can_extents calls for plugins and filters.
...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> > + > +If this flag is included then the C<range_offset> and C<range_length> > +parameters are used, so only extents overlapping > +C<[range_offset...range_offset+range_length-1]> are returned. Must range_offset+range_length-1 lie within the reported next_opts-&gt...
2019 Mar 20
0
Re: New extents structure proposal
...ata, 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_add (extents_map, offset, n, type) == -1) But if we drop offset from the interface, the offset filte...
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.
...lls those functions as +necessary. + +The C<flags> parameter can contain: + +=over 4 + +=item C<NBDKIT_EXTENTS_FOREACH_FLAG_ONE> + +Only call C<fn> for the first extent, and then return. (This is used +to implement C<NBD_CMD_FLAG_REQ_ONE> in the NBD protocol.) + +=item C<NBDKIT_EXTENTS_FOREACH_FLAG_RANGE> + +If this flag is included then the C<range_offset> and C<range_length> +parameters are used, so only extents overlapping +C<[range_offset...range_offset+range_length-1]> are returned. + +If this flag is not included in C<flags> then the range parameters are +I<ignor...
2019 Mar 20
2
Re: New extents structure proposal
...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_add (extents_map, offset, n, type) == -1) > > But...
2019 Mar 20
0
Re: [PATCH nbdkit 1/9] server: Implement extents/can_extents calls for plugins and filters.
...; > > + void nbdkit_extents_free (struct nbdkit_extents_map *); > > + > > +Frees an existing extents map. > > Is this like free() where it is safe to call on NULL? Yes - otherwise CLEANUP_EXTENTS_FREE wouldn't work. Do we need to document this? > > +=item C<NBDKIT_EXTENTS_FOREACH_FLAG_RANGE> > > + > > +If this flag is included then the C<range_offset> and C<range_length> > > +parameters are used, so only extents overlapping > > +C<[range_offset...range_offset+range_length-1]> are returned. > > Must range_offset+range_length-1 lie wit...
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, + foreach_flag...