[Libguestfs] [nbdkit PATCH] extents: Do not shorten overlaps by 0
Eric Blake
eblake at redhat.com
Wed May 15 14:07:33 UTC 2019
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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20190515/c5f5c546/attachment.sig>
More information about the Libguestfs
mailing list