From patchwork Mon Nov 6 02:43:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 10042551 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CE9656037D for ; Mon, 6 Nov 2017 02:43:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3F3B28E40 for ; Mon, 6 Nov 2017 02:43:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C65582909A; Mon, 6 Nov 2017 02:43:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BF3928E40 for ; Mon, 6 Nov 2017 02:43:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751140AbdKFCnf (ORCPT ); Sun, 5 Nov 2017 21:43:35 -0500 Received: from prv3-mh.provo.novell.com ([137.65.250.26]:60508 "EHLO prv3-mh.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750817AbdKFCnd (ORCPT ); Sun, 5 Nov 2017 21:43:33 -0500 Received: from adam-pc.lan (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Sun, 05 Nov 2017 19:43:24 -0700 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz, lakshmipathi.g@gmail.com Subject: [PATCH 2/2] btrfs: compression: Return correct default zlib compression level Date: Mon, 6 Nov 2017 10:43:19 +0800 Message-Id: <20171106024319.32584-2-wqu@suse.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171106024319.32584-1-wqu@suse.com> References: <20171106024319.32584-1-wqu@suse.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 0 means no compression at all for zlib. Z_DEFAULT_COMPRESSION is the correct value, which is -1 and will be converted to 6 at runtime. Signed-off-by: Qu Wenruo --- fs/btrfs/compression.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index b35ce16b3df3..29a41e6c9e28 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -35,6 +35,7 @@ #include #include #include +#include #include "ctree.h" #include "disk-io.h" #include "transaction.h" @@ -1528,5 +1529,9 @@ unsigned int btrfs_compress_str2level(const char *str) if (str[4] == ':' && '1' <= str[5] && str[5] <= '9' && str[6] == 0) return str[5] - '0'; - return 0; + /* + * NOTE: Default compression level is not 0!! + * 0 means no compression at all + */ + return Z_DEFAULT_COMPRESSION; }