Martin Kletzander
2019-May-15 12:46 UTC
[Libguestfs] [nbdkit PATCH] extents: Do not shorten overlaps by 0
When offset + length == exts->end the code which is shortening the extents is subtracting 0 from length. And it is not optimized out. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- server/extents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/extents.c b/server/extents.c index d3d1a15ab97c..c422491601f0 100644 --- a/server/extents.c +++ b/server/extents.c @@ -168,7 +168,7 @@ nbdkit_add_extent (struct nbdkit_extents *exts, return 0; /* Shorten extents that overlap the end of the range. */ - if (offset + length >= exts->end) { + if (offset + length > exts->end) { overlap = offset + length - exts->end; length -= overlap; } -- 2.21.0
Eric Blake
2019-May-15 14:07 UTC
Re: [Libguestfs] [nbdkit PATCH] extents: Do not shorten overlaps by 0
On 5/15/19 7:46 AM, Martin Kletzander wrote:> When offset + length == exts->end the code which is shortening the extents is > subtracting 0 from length. And it is not optimized out. > > Signed-off-by: Martin Kletzander <mkletzan@redhat.com> > --- > server/extents.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-)ACK.> > diff --git a/server/extents.c b/server/extents.c > index d3d1a15ab97c..c422491601f0 100644 > --- a/server/extents.c > +++ b/server/extents.c > @@ -168,7 +168,7 @@ nbdkit_add_extent (struct nbdkit_extents *exts, > return 0; > > /* Shorten extents that overlap the end of the range. */ > - if (offset + length >= exts->end) { > + if (offset + length > exts->end) { > overlap = offset + length - exts->end; > length -= overlap; > } >-- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Richard W.M. Jones
2019-May-15 14:47 UTC
Re: [Libguestfs] [nbdkit PATCH] extents: Do not shorten overlaps by 0
On Wed, May 15, 2019 at 02:46:13PM +0200, Martin Kletzander wrote:> When offset + length == exts->end the code which is shortening the extents is > subtracting 0 from length. And it is not optimized out. > > Signed-off-by: Martin Kletzander <mkletzan@redhat.com> > --- > server/extents.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/server/extents.c b/server/extents.c > index d3d1a15ab97c..c422491601f0 100644 > --- a/server/extents.c > +++ b/server/extents.c > @@ -168,7 +168,7 @@ nbdkit_add_extent (struct nbdkit_extents *exts, > return 0; > > /* Shorten extents that overlap the end of the range. */ > - if (offset + length >= exts->end) { > + if (offset + length > exts->end) { > overlap = offset + length - exts->end; > length -= overlap; > }ACK too. I have pushed this, thanks. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
Possibly Parallel Threads
- Re: [PATCH nbdkit v5 FINAL 01/19] server: Implement extents/can_extents calls for plugins and filters.
- [PATCH nbdkit 0/8] Implement extents using a simpler array.
- [nbdkit PATCH] extents: Cap maximum reply length
- [PATCH nbdkit v5 FINAL 00/19] Implement extents.
- [PATCH nbdkit 2/2] filters: Be careful to set *err if nbdkit_add_extent or nbdkit_extents_new fail.