From patchwork Sun Jan 4 03:49:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danielle Church X-Patchwork-Id: 5562611 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A415F9F162 for ; Sun, 4 Jan 2015 03:59:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3FD75201BC for ; Sun, 4 Jan 2015 03:59:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 41A302017D for ; Sun, 4 Jan 2015 03:59:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752164AbbADD7L (ORCPT ); Sat, 3 Jan 2015 22:59:11 -0500 Received: from cheri.shyou.org ([74.208.174.96]:45454 "EHLO cheri.shyou.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751768AbbADD7K (ORCPT ); Sat, 3 Jan 2015 22:59:10 -0500 Received: from localhost (localhost [127.0.0.1]) by cheri.shyou.org (Postfix) with ESMTP id EB3191303E0 for ; Sat, 3 Jan 2015 22:49:29 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cheri.shyou.org; h=content-type:content-type:mime-version:user-agent:references :message-id:in-reply-to:subject:subject:from:from:date:date :received:received; s=d1024; t=1420343367; bh=UFpCFBErQy0Zxnnc3n QGheCPyAtdFXoc2tmrVD38oy4=; b=NEiQ0C8yeijxX+V/6Wwr1khWFjUzgGH7mY FJFQ15Pf63yTYkInI7KD//OoroD/upXqDXWGtTOMj+YAJUmgUikQWcgpAdKkQS8U jZvZEf/W0MkwyE0ZmiiEpPa9BmyqY7Vu5rlMUJ/siz81FlkyTHMHvMieQjic0R3/ eLA6THOdw= X-Virus-Scanned: amavisd-new at shyou.org Received: from cheri.shyou.org ([127.0.0.1]) by localhost (cheri.shyou.org [127.0.0.1]) (amavisd-new, port 10026) with LMTP id OEMHMh0KzmW4 for ; Sat, 3 Jan 2015 22:49:27 -0500 (EST) Received: by cheri.shyou.org (Postfix, from userid 1000) id 145AC1303D6; Sat, 3 Jan 2015 22:49:27 -0500 (EST) Date: Sat, 3 Jan 2015 22:49:27 -0500 (EST) From: Danielle Church To: linux-btrfs@vger.kernel.org Subject: [PATCH 2/2] btrfs: do not flush zlib buffer after every input page In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;