linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Chris Mason <clm@fb.com>, Josef Bacik <jbacik@fb.com>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs compression: merge inflate and deflate z_streams
Date: Tue, 1 Jul 2014 16:44:15 +0200	[thread overview]
Message-ID: <20140701144415.GJ1553@suse.cz> (raw)
In-Reply-To: <1404142330-1621-1-git-send-email-sergey.senozhatsky@gmail.com>

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>

  reply	other threads:[~2014-07-01 14:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-30 15:32 [PATCH] btrfs compression: merge inflate and deflate z_streams Sergey Senozhatsky
2014-07-01 14:44 ` David Sterba [this message]
2014-07-07 14:29   ` Sergey Senozhatsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140701144415.GJ1553@suse.cz \
    --to=dsterba@suse.cz \
    --cc=clm@fb.com \
    --cc=jbacik@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sergey.senozhatsky@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).