From 4f3865fb57a04db7cca068fed1c15badc064a302 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 22 Jun 2006 14:47:34 -0700 Subject: [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 Acked-by: Joern Engel Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- lib/zlib_deflate/deflate.c | 25 ++----------------------- lib/zlib_deflate/deflate_syms.c | 3 +-- 2 files changed, 3 insertions(+), 25 deletions(-) (limited to 'lib/zlib_deflate') diff --git a/lib/zlib_deflate/deflate.c b/lib/zlib_deflate/deflate.c index 1653dd9..c3e4a2ba 100644 --- a/lib/zlib_deflate/deflate.c +++ b/lib/zlib_deflate/deflate.c @@ -164,34 +164,17 @@ static const config configuration_table[10] = { memset((char *)s->head, 0, (unsigned)(s->hash_size-1)*sizeof(*s->head)); /* ========================================================================= */ -int zlib_deflateInit_( - z_streamp strm, - int level, - const char *version, - int stream_size -) -{ - return zlib_deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, - DEF_MEM_LEVEL, - Z_DEFAULT_STRATEGY, version, stream_size); - /* To do: ignore strm->next_in if we use it as window */ -} - -/* ========================================================================= */ -int zlib_deflateInit2_( +int zlib_deflateInit2( z_streamp strm, int level, int method, int windowBits, int memLevel, - int strategy, - const char *version, - int stream_size + int strategy ) { deflate_state *s; int noheader = 0; - static char* my_version = ZLIB_VERSION; deflate_workspace *mem; ush *overlay; @@ -199,10 +182,6 @@ int zlib_deflateInit2_( * output size for (length,distance) codes is <= 24 bits. */ - if (version == NULL || version[0] != my_version[0] || - stream_size != sizeof(z_stream)) { - return Z_VERSION_ERROR; - } if (strm == NULL) return Z_STREAM_ERROR; strm->msg = NULL; diff --git a/lib/zlib_deflate/deflate_syms.c b/lib/zlib_deflate/deflate_syms.c index 767b573..ccfe25f 100644 --- a/lib/zlib_deflate/deflate_syms.c +++ b/lib/zlib_deflate/deflate_syms.c @@ -12,8 +12,7 @@ EXPORT_SYMBOL(zlib_deflate_workspacesize); EXPORT_SYMBOL(zlib_deflate); -EXPORT_SYMBOL(zlib_deflateInit_); -EXPORT_SYMBOL(zlib_deflateInit2_); +EXPORT_SYMBOL(zlib_deflateInit2); EXPORT_SYMBOL(zlib_deflateEnd); EXPORT_SYMBOL(zlib_deflateReset); MODULE_LICENSE("GPL"); -- cgit v1.1