search for: truncate_extents

Displaying 13 results from an estimated 13 matches for "truncate_extents".

2019 Mar 28
0
[PATCH nbdkit v5 FINAL 12/19] truncate: Implement extents for beyond end of truncated region.
...diff --git a/filters/truncate/truncate.c b/filters/truncate/truncate.c index b95432a..e8e56f7 100644 --- a/filters/truncate/truncate.c +++ b/filters/truncate/truncate.c @@ -285,6 +285,60 @@ truncate_zero (struct nbdkit_next_ops *next_ops, void *nxdata, return 0; } +/* Extents. */ +static int +truncate_extents (struct nbdkit_next_ops *next_ops, void *nxdata, + void *handle, uint32_t count, uint64_t offset, + uint32_t flags, struct nbdkit_extents *extents, int *err) +{ + uint32_t n; + uint64_t real_size_copy; + struct nbdkit_extents *extents2; + size_t i; + + pthread...
2019 Apr 24
0
[PATCH nbdkit 2/2] filters: Be careful to set *err if nbdkit_add_extent or nbdkit_extents_new fail.
...ents, e.offset, e.length, e.type) == -1) { + *err = errno; return -1; + } } return 0; } diff --git a/filters/truncate/truncate.c b/filters/truncate/truncate.c index 076ae22..0c5dedb 100644 --- a/filters/truncate/truncate.c +++ b/filters/truncate/truncate.c @@ -319,6 +319,10 @@ truncate_extents (struct nbdkit_next_ops *next_ops, void *nxdata, * returned data to the original array. */ extents2 = nbdkit_extents_new (offset, real_size_copy); + if (extents2 == NULL) { + *err = errno; + return -1; + } if (offset + count <= real_size_copy) n = count; else @@ -32...
2019 Apr 23
1
Re: [nbdkit PATCH 2/4] filters: Utilize CLEANUP_EXTENTS_FREE
...++++-------- > filters/truncate/truncate.c | 12 ++++-------- > filters/offset/Makefile.am | 5 ++++- > filters/partition/Makefile.am | 5 ++++- > filters/truncate/Makefile.am | 5 ++++- > 6 files changed, 25 insertions(+), 27 deletions(-) > > @@ -322,20 +323,15 @@ truncate_extents (struct nbdkit_next_ops *next_ops, void *nxdata, > n = count; > else > n = 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...
2019 Apr 23
0
[nbdkit PATCH 2/4] filters: Utilize CLEANUP_EXTENTS_FREE
...ex dfc6873..076ae22 100644 --- a/filters/truncate/truncate.c +++ b/filters/truncate/truncate.c @@ -43,6 +43,7 @@ #include <nbdkit-filter.h> +#include "cleanup.h" #include "ispowerof2.h" #include "iszero.h" #include "rounding.h" @@ -292,7 +293,7 @@ truncate_extents (struct nbdkit_next_ops *next_ops, void *nxdata, { uint32_t n; uint64_t real_size_copy; - struct nbdkit_extents *extents2; + CLEANUP_EXTENTS_FREE struct nbdkit_extents *extents2 = NULL; size_t i; pthread_mutex_lock (&lock); @@ -322,20 +323,15 @@ truncate_extents (struct nbdkit_n...
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 27
0
[nbdkit PATCH 2/4] truncate: Fix corruption when plugin changes per-connection size
...size_copy) + if (offset < h->real_size) { + if (offset + count <= h->real_size) n = count; else - n = real_size_copy - offset; + n = h->real_size - offset; return next_ops->zero (nxdata, n, offset, flags, err); } return 0; @@ -292,21 +306,17 @@ truncate_extents (struct nbdkit_next_ops *next_ops, void *nxdata, uint32_t flags, struct nbdkit_extents *extents, int *err) { uint32_t n; - uint64_t real_size_copy; + struct handle *h = handle; CLEANUP_EXTENTS_FREE struct nbdkit_extents *extents2 = NULL; size_t i; - pthread_mutex_lo...
2019 Apr 24
0
[nbdkit PATCH 2/4] truncate: Factor out reading real_size under mutex
...uint32_t n; - uint64_t real_size_copy; - - pthread_mutex_lock (&lock); - real_size_copy = real_size; - pthread_mutex_unlock (&lock); + uint64_t real_size_copy = get_real_size (); if (offset < real_size_copy) { if (offset + count <= real_size_copy) @@ -292,14 +281,10 @@ truncate_extents (struct nbdkit_next_ops *next_ops, void *nxdata, uint32_t flags, struct nbdkit_extents *extents, int *err) { uint32_t n; - uint64_t real_size_copy; + uint64_t real_size_copy = get_real_size (); CLEANUP_EXTENTS_FREE struct nbdkit_extents *extents2 = NULL; size_t i; -...
2019 Apr 27
8
[nbdkit PATCH 0/4] Fix truncate handling of real_size
While working on adding assertions to pthread_mutex_lock calls, I noticed that the truncate filter's use of mutex didn't really protect us, and isn't really necessary. Cleaning that up also spotted a couple of other potential cleanups. Eric Blake (4): filters: Drop useless .open callbacks truncate: Fix corruption when plugin changes per-connection size truncate: Test for safe
2019 Apr 23
8
[nbdkit PATCH 0/4] Start using cleanup macros in filters/plugins
There's more that can be done (in particular, use of CLEANUP_FREE), but this is enough to at least see if I'm on the right track. I couldn't figure out an obvious difference between common/include and common/utils, but it looks like the former is for things that are inlineable via .h only, while the latter is when you need to link in a convenience library, so this landed in the
2019 Apr 24
7
[nbdkit PATCH 0/4] More mutex sanity checking
I do have a question about whether patch 2 is right, or whether I've exposed a bigger problem in the truncate (and possibly other) filter, but the rest seem fairly straightforward. Eric Blake (4): server: Check for pthread lock failures truncate: Factor out reading real_size under mutex plugins: Check for mutex failures filters: Check for mutex failures filters/cache/cache.c
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
2019 May 16
27
[nbdkit PATCH v2 00/24] implement NBD_CMD_CACHE
Since v1: - rework .can_cache to be tri-state, with default of no advertisement (ripple effect through other patches) - add a lot more patches in order to round out filter support And in the meantime, Rich pushed NBD_CMD_CACHE support into libnbd, so in theory we now have a way to test cache commands through the entire stack. Eric Blake (24): server: Internal hooks for implementing
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.