search for: nbdkit_extents_count

Displaying 20 results from an estimated 58 matches for "nbdkit_extents_count".

2019 Apr 24
0
[PATCH nbdkit 2/2] filters: Be careful to set *err if nbdkit_add_extent or nbdkit_extents_new fail.
...nged, 13 insertions(+), 3 deletions(-) diff --git a/filters/offset/offset.c b/filters/offset/offset.c index 24ccb4c..633a1c7 100644 --- a/filters/offset/offset.c +++ b/filters/offset/offset.c @@ -156,8 +156,10 @@ offset_extents (struct nbdkit_next_ops *next_ops, void *nxdata, for (i = 0; i < nbdkit_extents_count (extents2); ++i) { e = nbdkit_get_extent (extents2, i); e.offset -= offset; - if (nbdkit_add_extent (extents, e.offset, e.length, e.type) == -1) + if (nbdkit_add_extent (extents, e.offset, e.length, e.type) == -1) { + *err = errno; return -1; + } } return 0; }...
2019 Apr 24
4
[PATCH nbdkit 2/2] filters: Be careful to set *err if nbdkit_add_extent or nbdkit_extents_new fail.
This fix isn't exhaustive but it fixes some obvious problems in the filters. Rich.
2019 Apr 23
0
[nbdkit PATCH 2/4] filters: Utilize CLEANUP_EXTENTS_FREE
...ize = next_ops->get_size (nxdata); @@ -149,20 +151,15 @@ offset_extents (struct nbdkit_next_ops *next_ops, void *nxdata, } if (next_ops->extents (nxdata, count, offs + offset, flags, extents2, err) == -1) - goto error; + return -1; for (i = 0; i < nbdkit_extents_count (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; + return -1; } - nbdkit_extents_free (extents2); return 0; - - error: - nbdkit_extents_free (extents2); - re...
2019 May 15
2
[nbdkit PATCH] Introduce cacheextents filter
.... */ +struct nbdkit_extents *cache_extents; +static uint64_t cache_start; +static uint64_t cache_end; + +static void +cacheextents_unload (void) +{ + nbdkit_extents_free (cache_extents); +} + +static int +cacheextents_add (struct nbdkit_extents *extents) +{ + size_t i = 0; + + for (i = 0; i < nbdkit_extents_count (cache_extents); i++) { + struct nbdkit_extent ex = nbdkit_get_extent (cache_extents, i); + if (nbdkit_add_extent (extents, ex.offset, ex.length, ex.type) < 0) + return -1; + } + + return 0; +} + +static int +cacheextents_fill (struct nbdkit_extents *extents) +{ + size_t i = 0; +...
2019 Apr 23
1
Re: [PATCH nbdkit v5 FINAL 10/19] offset: Implement mapping of extents.
...ents2 == NULL) { > + *err = errno; > + return -1; > + } Here, we are careful to set *err. > + if (next_ops->extents (nxdata, count, offs + offset, > + flags, extents2, err) == -1) > + goto error; And here. > + > + for (i = 0; i < nbdkit_extents_count (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; But here, *err remains unchanged. Is this a problem? Should nbdkit_add_extent() guarantee that errno...
2019 Apr 23
1
Re: [nbdkit PATCH 2/4] filters: Utilize CLEANUP_EXTENTS_FREE
...= real_size_copy - offset; > - if (next_ops->extents (nxdata, n, offset, flags, extents2, err) == -1) { > - nbdkit_extents_free (extents2); > + if (next_ops->extents (nxdata, n, offset, flags, extents2, err) == -1) > return -1; > - } > > for (i = 0; i < nbdkit_extents_count (extents2); ++i) { > struct nbdkit_extent e = nbdkit_get_extent (extents2, i); > > - if (nbdkit_add_extent (extents, e.offset, e.length, e.type) == -1) { > - nbdkit_extents_free (extents2); > + if (nbdkit_add_extent (extents, e.offset, e.length, e.type) == -1) >...
2019 May 15
0
Re: [nbdkit PATCH] Introduce cacheextents filter
...name) it. Basically it's fine, however it could really do with having a test. I have no particular comment about the name. A few more things inline below. > +static int > +cacheextents_add (struct nbdkit_extents *extents) > +{ > + size_t i = 0; > + > + for (i = 0; i < nbdkit_extents_count (cache_extents); i++) { > + struct nbdkit_extent ex = nbdkit_get_extent (cache_extents, i); > + if (nbdkit_add_extent (extents, ex.offset, ex.length, ex.type) < 0) This really only returns -1 on failure, and not any other negative values. > + return -1; > + } > + &gt...
2019 Mar 29
2
Re: [PATCH nbdkit v5 FINAL 12/19] truncate: Implement extents for beyond end of truncated region.
...ffset + count <= real_size_copy) > + n = count; > + else > + n = real_size_copy - offset; > + if (next_ops->extents (nxdata, n, offset, flags, extents2, err) == -1) { > + nbdkit_extents_free (extents2); > + return -1; > + } > + > + for (i = 0; i < nbdkit_extents_count (extents2); ++i) { > + struct nbdkit_extent e = nbdkit_get_extent (extents2, i); > + > + if (nbdkit_add_extent (extents, e.offset, e.length, e.type) == -1) { > + nbdkit_extents_free (extents2); > + return -1; > + } > + } > + nbdkit_extents_free (extents2...
2019 Mar 26
0
[PATCH nbdkit v4 01/15] server: Implement extents/can_extents calls for plugins and filters.
...yfilter_extents (..., uint32_t count, uint64_t offset, ...) + { + size_t i; + struct nbdkit_extents *extents2; + struct nbdkit_extent e; + + extents2 = nbdkit_extents_new (offset + shift); + next_ops->extents (nxdata, count, offset + shift, flags, extents2, err); + for (i = 0; i < nbdkit_extents_count (extents2); ++i) { + e = nbdkit_get_extent (extents2, i); + e.offset -= shift; + nbdkit_add_extent (extents, e.offset, e.length, e.type); + } + nbdkit_extents_free (extents2); + } + +If there is an error, C<.extents> should call C<nbdkit_error> with an +error message B&l...
2019 Mar 28
0
[PATCH nbdkit v5 FINAL 01/19] server: Implement extents/can_extents calls for plugins and filters.
...i; + struct nbdkit_extents *extents2; + struct nbdkit_extent e; + int64_t size; + + size = next_ops->get_size (nxdata); + extents2 = nbdkit_extents_new (offset + shift, size - shift); + next_ops->extents (nxdata, count, offset + shift, flags, extents2, err); + for (i = 0; i < nbdkit_extents_count (extents2); ++i) { + e = nbdkit_get_extent (extents2, i); + e.offset -= shift; + nbdkit_add_extent (extents, e.offset, e.length, e.type); + } + nbdkit_extents_free (extents2); + } + +If there is an error, C<.extents> should call C<nbdkit_error> with an +error message B&l...
2019 Mar 27
2
Re: [PATCH nbdkit 7/8] vddk: Implement extents.
...ome very large aligned block size (64K IIRC), we round down the requested offset before querying VDDK. So in the inner loop the first extent we get back might lie before the offset (before extents->start). IOW nbdkit_add_extent has succeeded but we haven't added any extents. We could call nbdkit_extents_count here, but technically we've said that's a filter-only API. I believe the test for req_one in the outer loop is fine, although it relies on QueryAllocatedBlocks not being crazy. As it's VDDK and therefore crazy by nature maybe we should consider removing that too, but it would then be...
2020 Jul 07
0
[nbdkit PATCH 2/3] extents: Add nbdkit_extents_aligned()
...(struct nbdkit_next_ops *next_ops, void *nxdata, diff --git a/include/nbdkit-filter.h b/include/nbdkit-filter.h index d81186f5..229a54b4 100644 --- a/include/nbdkit-filter.h +++ b/include/nbdkit-filter.h @@ -116,6 +116,11 @@ extern void nbdkit_extents_free (struct nbdkit_extents *); extern size_t nbdkit_extents_count (const struct nbdkit_extents *); extern struct nbdkit_extent nbdkit_get_extent (const struct nbdkit_extents *, size_t); +extern int nbdkit_extents_aligned (struct nbdkit_next_ops *next_ops, + nbdkit_backend *nxdata,...
2019 Jun 11
5
[nbdkit PATCH v2] Introduce cacheextents filter
...ct nbdkit_extents *cache_extents; +static uint64_t cache_start; +static uint64_t cache_end; + +static void +cacheextents_unload (void) +{ + nbdkit_extents_free (cache_extents); +} + +static int +cacheextents_add (struct nbdkit_extents *extents, int *err) +{ + size_t i = 0; + + for (i = 0; i < nbdkit_extents_count (cache_extents); i++) { + struct nbdkit_extent ex = nbdkit_get_extent (cache_extents, i); + if (nbdkit_add_extent (extents, ex.offset, ex.length, ex.type) == -1) { + *err = errno; + return -1; + } + } + + return 0; +} + +static int +cacheextents_fill (struct nbdkit_extents *ext...
2019 Aug 28
1
[nbdkit PATCH] offset, partition: Fix .extents with non-zero offset
...like this: int64_t size; size = next_ops->get_size (nxdata); - extents2 = nbdkit_extents_new (offset + shift, size - shift); + extents2 = nbdkit_extents_new (offset + shift, size); next_ops->extents (nxdata, count, offset + shift, flags, extents2, err); for (i = 0; i < nbdkit_extents_count (extents2); ++i) { e = nbdkit_get_extent (extents2, i); diff --git a/filters/offset/offset.c b/filters/offset/offset.c index efe5c6d1..00122770 100644 --- a/filters/offset/offset.c +++ b/filters/offset/offset.c @@ -140,9 +140,9 @@ offset_extents (struct nbdkit_next_ops *next_ops, void *nxdata...
2020 Aug 18
0
[PATCH nbdkit 8/9] include: Prefix all exports with NBDKIT_DLLEXPORT.
...0d5425 100644 --- a/include/nbdkit-filter.h +++ b/include/nbdkit-filter.h @@ -115,16 +115,24 @@ struct nbdkit_extent { uint32_t type; }; -extern struct nbdkit_extents *nbdkit_extents_new (uint64_t start, uint64_t end); -extern void nbdkit_extents_free (struct nbdkit_extents *); -extern size_t nbdkit_extents_count (const struct nbdkit_extents *); -extern struct nbdkit_extent nbdkit_get_extent (const struct nbdkit_extents *, - size_t); -extern int nbdkit_extents_aligned (struct nbdkit_next_ops *next_ops, - nbdkit_backend *nxdata,...
2019 Jun 11
0
Re: [nbdkit PATCH v2] Introduce cacheextents filter
...static uint64_t cache_end; > + > +static void > +cacheextents_unload (void) > +{ > + nbdkit_extents_free (cache_extents); > +} > + > +static int > +cacheextents_add (struct nbdkit_extents *extents, int *err) > +{ > + size_t i = 0; > + > + for (i = 0; i < nbdkit_extents_count (cache_extents); i++) { > + struct nbdkit_extent ex = nbdkit_get_extent (cache_extents, i); > + if (nbdkit_add_extent (extents, ex.offset, ex.length, ex.type) == -1) { > + *err = errno; > + return -1; > + } > + } > + > + return 0; > +} > + > +st...
2019 Mar 26
21
[PATCH nbdkit v4 00/15] Implement Block Status.
I'm not sure exactly which version we're up to, but let's say it's version 4. I'm a lot happier with this version: - all filters have been reviewed and changed where I think that's necessary - can_extents is properly defined and implemented now - NBD protocol is followed - I believe it addresses all previous review points where possible The "only" thing
2020 Mar 23
0
[PATCH nbdkit 1/3] include: Function indirection for PE DLL
...nbdkit-filter.h @@ -110,11 +110,31 @@ struct nbdkit_extent { uint32_t type; }; +#if defined(NBDKIT_INTERNAL) || !defined(WINDOWS_COMPAT) extern struct nbdkit_extents *nbdkit_extents_new (uint64_t start, uint64_t end); extern void nbdkit_extents_free (struct nbdkit_extents *); extern size_t nbdkit_extents_count (const struct nbdkit_extents *); extern struct nbdkit_extent nbdkit_get_extent (const struct nbdkit_extents *, size_t); +#else +static struct nbdkit_extents *nbdkit_extents_new (uint64_t start, uint64_t end) +{ + return _nbdkit_functions.extents_new...
2019 Mar 28
32
[PATCH nbdkit v5 FINAL 00/19] Implement extents.
This has already been pushed upstream. I am simply posting these here so we have a reference in the mailing list in case we find bugs later (as I'm sure we will - it's a complex patch series). Great thanks to Eric Blake for tireless review on this one. It also seems to have identified a few minor bugs in qemu along the way. Rich.
2019 Mar 27
0
Re: [PATCH nbdkit 7/8] vddk: Implement extents.
...ed block size (64K IIRC), we round down the requested offset > before querying VDDK. So in the inner loop the first extent we get > back might lie before the offset (before extents->start). IOW > nbdkit_add_extent has succeeded but we haven't added any extents. We > could call nbdkit_extents_count here, but technically we've said > that's a filter-only API. > Indeed - if you round down, you have to iterate at least until you've crossed back over the original offset. Tracking that takes more coding effort than just blindly always giving the full 64k result (which is guaran...