aboutsummaryrefslogtreecommitdiffstats
path: root/lib/zlib_deflate
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2006-06-22 17:47:34 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-22 18:05:58 -0400
commit4f3865fb57a04db7cca068fed1c15badc064a302 (patch)
tree4c923c72b6ac9b633c87cc73b55a75c7cfd0f044 /lib/zlib_deflate
parent4f1bcaf094ccc512c23e10104c05a6f8e5b7a9e4 (diff)
[PATCH] zlib_inflate: Upgrade library code to a recent version
Upgrade the zlib_inflate implementation in the kernel from a patched version 1.1.3/4 to a patched 1.2.3. The code in the kernel is about seven years old and I noticed that the external zlib library's inflate performance was significantly faster (~50%) than the code in the kernel on ARM (and faster again on x86_32). For comparison the newer deflate code is 20% slower on ARM and 50% slower on x86_32 but gives an approx 1% compression ratio improvement. I don't consider this to be an improvement for kernel use so have no plans to change the zlib_deflate code. Various changes have been made to the zlib code in the kernel, the most significant being the extra functions/flush option used by ppp_deflate. This update reimplements the features PPP needs to ensure it continues to work. This code has been tested on ARM under both JFFS2 (with zlib compression enabled) and ppp_deflate and on x86_32. JFFS2 sees an approx. 10% real world file read speed improvement. This patch also removes ZLIB_VERSION as it no longer has a correct value. We don't need version checks anyway as the kernel's module handling will take care of that for us. This removal is also more in keeping with the zlib author's wishes (http://www.zlib.net/zlib_faq.html#faq24) and I've added something to the zlib.h header to note its a modified version. Signed-off-by: Richard Purdie <rpurdie@rpsys.net> Acked-by: Joern Engel <joern@wh.fh-wedel.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'lib/zlib_deflate')
-rw-r--r--lib/zlib_deflate/deflate.c25
-rw-r--r--lib/zlib_deflate/deflate_syms.c3
2 files changed, 3 insertions, 25 deletions
diff --git a/lib/zlib_deflate/deflate.c b/lib/zlib_deflate/deflate.c
index 1653dd9bb01a..c3e4a2baf835 100644
--- a/lib/zlib_deflate/deflate.c
+++ b/lib/zlib_deflate/deflate.c
@@ -164,34 +164,17 @@ static const config configuration_table[10] = {
164 memset((char *)s->head, 0, (unsigned)(s->hash_size-1)*sizeof(*s->head)); 164 memset((char *)s->head, 0, (unsigned)(s->hash_size-1)*sizeof(*s->head));
165 165
166/* ========================================================================= */ 166/* ========================================================================= */
167int zlib_deflateInit_( 167int zlib_deflateInit2(
168 z_streamp strm,
169 int level,
170 const char *version,
171 int stream_size
172)
173{
174 return zlib_deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS,
175 DEF_MEM_LEVEL,
176 Z_DEFAULT_STRATEGY, version, stream_size);
177 /* To do: ignore strm->next_in if we use it as window */
178}
179
180/* ========================================================================= */
181int zlib_deflateInit2_(
182 z_streamp strm, 168 z_streamp strm,
183 int level, 169 int level,
184 int method, 170 int method,
185 int windowBits, 171 int windowBits,
186 int memLevel, 172 int memLevel,
187 int strategy, 173 int strategy
188 const char *version,
189 int stream_size
190) 174)
191{ 175{
192 deflate_state *s; 176 deflate_state *s;
193 int noheader = 0; 177 int noheader = 0;
194 static char* my_version = ZLIB_VERSION;
195 deflate_workspace *mem; 178 deflate_workspace *mem;
196 179
197 ush *overlay; 180 ush *overlay;
@@ -199,10 +182,6 @@ int zlib_deflateInit2_(
199 * output size for (length,distance) codes is <= 24 bits. 182 * output size for (length,distance) codes is <= 24 bits.
200 */ 183 */
201 184
202 if (version == NULL || version[0] != my_version[0] ||
203 stream_size != sizeof(z_stream)) {
204 return Z_VERSION_ERROR;
205 }
206 if (strm == NULL) return Z_STREAM_ERROR; 185 if (strm == NULL) return Z_STREAM_ERROR;
207 186
208 strm->msg = NULL; 187 strm->msg = NULL;
diff --git a/lib/zlib_deflate/deflate_syms.c b/lib/zlib_deflate/deflate_syms.c
index 767b573d1ef6..ccfe25f3920f 100644
--- a/lib/zlib_deflate/deflate_syms.c
+++ b/lib/zlib_deflate/deflate_syms.c
@@ -12,8 +12,7 @@
12 12
13EXPORT_SYMBOL(zlib_deflate_workspacesize); 13EXPORT_SYMBOL(zlib_deflate_workspacesize);
14EXPORT_SYMBOL(zlib_deflate); 14EXPORT_SYMBOL(zlib_deflate);
15EXPORT_SYMBOL(zlib_deflateInit_); 15EXPORT_SYMBOL(zlib_deflateInit2);
16EXPORT_SYMBOL(zlib_deflateInit2_);
17EXPORT_SYMBOL(zlib_deflateEnd); 16EXPORT_SYMBOL(zlib_deflateEnd);
18EXPORT_SYMBOL(zlib_deflateReset); 17EXPORT_SYMBOL(zlib_deflateReset);
19MODULE_LICENSE("GPL"); 18MODULE_LICENSE("GPL");