Upstream patch to fix performance regression in virt-builder (RHBZ#1188866).
- Change the way Python double-build is done so we only have to apply patches in one place.
This commit is contained in:
parent
7551c9b6b6
commit
b865a8529b
@ -0,0 +1,63 @@
|
|||||||
|
From ff1cf989fd49cfb82db428e66034c7b2d6bebe8a Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||||
|
Date: Wed, 4 Feb 2015 13:17:40 +0000
|
||||||
|
Subject: [PATCH] builder: Fix large performance regression in pxzcat
|
||||||
|
(RHBZ#1188866).
|
||||||
|
|
||||||
|
Commit 9135129b0f6e8eb171131ea0f7d729a960b74cb3 changed
|
||||||
|
two stack buffers to pointers:
|
||||||
|
|
||||||
|
- uint8_t buf[BUFFER_SIZE];
|
||||||
|
- unsigned char outbuf[BUFFER_SIZE];
|
||||||
|
+ CLEANUP_FREE uint8_t *buf = NULL;
|
||||||
|
+ CLEANUP_FREE uint8_t *outbuf = NULL;
|
||||||
|
|
||||||
|
but we were still using sizeof buf to calculate the size of the
|
||||||
|
buffer. sizeof buf == 8 so the original code which used large buffers
|
||||||
|
for reading/writing the file changed to using 8 byte buffers.
|
||||||
|
---
|
||||||
|
builder/pxzcat-c.c | 8 ++++----
|
||||||
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/builder/pxzcat-c.c b/builder/pxzcat-c.c
|
||||||
|
index bd4c0a8..0bbd296 100644
|
||||||
|
--- a/builder/pxzcat-c.c
|
||||||
|
+++ b/builder/pxzcat-c.c
|
||||||
|
@@ -640,14 +640,14 @@ worker_thread (void *vp)
|
||||||
|
strm.next_in = NULL;
|
||||||
|
strm.avail_in = 0;
|
||||||
|
strm.next_out = outbuf;
|
||||||
|
- strm.avail_out = sizeof outbuf;
|
||||||
|
+ strm.avail_out = BUFFER_SIZE;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
lzma_action action = LZMA_RUN;
|
||||||
|
|
||||||
|
if (strm.avail_in == 0) {
|
||||||
|
strm.next_in = buf;
|
||||||
|
- n = pread (global->fd, buf, sizeof buf, position);
|
||||||
|
+ n = pread (global->fd, buf, BUFFER_SIZE, position);
|
||||||
|
if (n == -1) {
|
||||||
|
perror (global->filename);
|
||||||
|
return &state->status;
|
||||||
|
@@ -661,7 +661,7 @@ worker_thread (void *vp)
|
||||||
|
r = lzma_code (&strm, action);
|
||||||
|
|
||||||
|
if (strm.avail_out == 0 || r == LZMA_STREAM_END) {
|
||||||
|
- size_t wsz = sizeof outbuf - strm.avail_out;
|
||||||
|
+ size_t wsz = BUFFER_SIZE - strm.avail_out;
|
||||||
|
|
||||||
|
/* Don't write if the block is all zero, to preserve output file
|
||||||
|
* sparseness. However we have to update oposition.
|
||||||
|
@@ -675,7 +675,7 @@ worker_thread (void *vp)
|
||||||
|
oposition += wsz;
|
||||||
|
|
||||||
|
strm.next_out = outbuf;
|
||||||
|
- strm.avail_out = sizeof outbuf;
|
||||||
|
+ strm.avail_out = BUFFER_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r == LZMA_STREAM_END)
|
||||||
|
--
|
||||||
|
2.1.0
|
||||||
|
|
@ -25,13 +25,16 @@ Summary: Access and modify virtual machine disk images
|
|||||||
Name: libguestfs
|
Name: libguestfs
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Version: 1.29.24
|
Version: 1.29.24
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
|
|
||||||
# Source and patches.
|
# Source and patches.
|
||||||
URL: http://libguestfs.org/
|
URL: http://libguestfs.org/
|
||||||
Source0: http://libguestfs.org/download/1.29-development/%{name}-%{version}.tar.gz
|
Source0: http://libguestfs.org/download/1.29-development/%{name}-%{version}.tar.gz
|
||||||
|
|
||||||
|
# Upstream patch to fix performance regression in virt-builder (RHBZ#1188866).
|
||||||
|
Patch0001: 0001-builder-Fix-large-performance-regression-in-pxzcat-R.patch
|
||||||
|
|
||||||
# Basic build requirements:
|
# Basic build requirements:
|
||||||
BuildRequires: perl(Pod::Simple)
|
BuildRequires: perl(Pod::Simple)
|
||||||
BuildRequires: perl(Pod::Man)
|
BuildRequires: perl(Pod::Man)
|
||||||
@ -746,13 +749,18 @@ for %{name}.
|
|||||||
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
|
%setup -q
|
||||||
|
|
||||||
|
%patch0001 -p1
|
||||||
|
|
||||||
# For Python 3 we must build libguestfs twice. This creates:
|
# For Python 3 we must build libguestfs twice. This creates:
|
||||||
# %{name}-%{version}/
|
# %{name}-%{version}/
|
||||||
# %{name}-%{version}/python3/
|
# %{name}-%{version}/python3/
|
||||||
# with a second copy of the sources in the python3 subdir.
|
# with a second copy of the sources in the python3 subdir.
|
||||||
%setup -q
|
pushd ..
|
||||||
%setup -q -T -D -a 0
|
cp -a %{name}-%{version} tmp-python3
|
||||||
mv %{name}-%{version} python3
|
mv tmp-python3 %{name}-%{version}/python3
|
||||||
|
popd
|
||||||
|
|
||||||
if [ "$(getenforce | tr '[A-Z]' '[a-z]')" != "disabled" ]; then
|
if [ "$(getenforce | tr '[A-Z]' '[a-z]')" != "disabled" ]; then
|
||||||
# For sVirt to work, the local temporary directory we use in the
|
# For sVirt to work, the local temporary directory we use in the
|
||||||
@ -1283,6 +1291,11 @@ popd
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Feb 04 2015 Richard W.M. Jones <rjones@redhat.com> - 1:1.29.24-2
|
||||||
|
- Upstream patch to fix performance regression in virt-builder (RHBZ#1188866).
|
||||||
|
- Change the way Python double-build is done so we only have to
|
||||||
|
apply patches in one place.
|
||||||
|
|
||||||
* Tue Feb 03 2015 Richard W.M. Jones <rjones@redhat.com> - 1:1.29.24-1
|
* Tue Feb 03 2015 Richard W.M. Jones <rjones@redhat.com> - 1:1.29.24-1
|
||||||
- New upstream version 1.29.24.
|
- New upstream version 1.29.24.
|
||||||
- Add Python 3 bindings.
|
- Add Python 3 bindings.
|
||||||
|
Loading…
Reference in New Issue
Block a user