All of lore.kernel.org
 help / color / mirror / Atom feed
From: Danielle Church <dchurch@cheri.shyou.org>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 2/2] btrfs: do not flush zlib buffer after every input page
Date: Sat, 3 Jan 2015 22:49:27 -0500 (EST)	[thread overview]
Message-ID: <alpine.LNX.2.00.1501032237360.30995@cheri.shyou.org> (raw)
In-Reply-To: <alpine.LNX.2.00.1501032236270.30995@cheri.shyou.org>

Moving the Z_FINISH into the loop also means we don't have to force a 
flush after every input page to guarantee that there won't be more than 4 
KiB to write at the end.  This patch lets zlib decide when to flush 
buffer, which offers a very moderate space savings (on my system, my 400MB 
test logfile goes from an 11.9% compression ratio to 11.2%, which is 
nothing to write home about) and might offer a similarly-slight 
performance boost.

Since the end result is still a valid zlib stream, it is completely 
backwards-compatible with the existing method.

Signed-off-by: Danielle Church <dchurch@cheri.shyou.org>
---
  fs/btrfs/zlib.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c
index 1dc0455..df7d957 100644
--- a/fs/btrfs/zlib.c
+++ b/fs/btrfs/zlib.c
@@ -89,7 +89,7 @@ static int zlib_compress_pages(struct list_head *ws,
  	struct page *in_page = NULL;
  	struct page *out_page = NULL;
  	unsigned long bytes_left;
-	int deflate_flush = Z_SYNC_FLUSH;
+	int deflate_flush = Z_NO_FLUSH;

  	*out_pages = 0;
  	*total_out = 0;
-- 
2.2.1

      reply	other threads:[~2015-01-04  3:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-04  3:48 [PATCH 1/2] btrfs: fix compress=zlib when stream end crosses page boundary Danielle Church
2015-01-04  3:49 ` Danielle Church [this message]

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=alpine.LNX.2.00.1501032237360.30995@cheri.shyou.org \
    --to=dchurch@cheri.shyou.org \
    --cc=linux-btrfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.