lkml.org 
[lkml]   [2014]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] btrfs compression: merge inflate and deflate z_streams
On Tue, Jul 01, 2014 at 12:32:10AM +0900, Sergey Senozhatsky wrote:
> `struct workspace' used for zlib compression contains two zlib
> z_stream-s: `def_strm' used in zlib_compress_pages(), and `inf_strm'
> used in zlib_decompress/zlib_decompress_biovec(). None of these
> functions use `inf_strm' and `def_strm' simultaniously, meaning that
> for every compress/decompress operation we need only one z_stream
> (out of two available).
>
> `inf_strm' and `def_strm' are different in size of ->workspace. For
> inflate stream we vmalloc() zlib_inflate_workspacesize() bytes, for
> deflate stream - zlib_deflate_workspacesize() bytes. On my system zlib
> returns the following workspace sizes, correspondingly: 42312 and 268104
> (+ guard pages).
>
> Keep only one `z_stream' in `struct workspace' and use it for both
> compression and decompression. Hence, instead of vmalloc() of two
> z_stream->worskpace-s, allocate only one of size:
> max(zlib_deflate_workspacesize(), zlib_inflate_workspacesize())
>
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

Reviewed-by: David Sterba <dsterba@suse.cz>


\
 
 \ /
  Last update: 2014-07-01 17:21    [W:0.057 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site