From: Qu Wenruo <wqu@suse.com>
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 [thread overview]
Message-ID: <20171106024319.32584-2-wqu@suse.com> (raw)
In-Reply-To: <20171106024319.32584-1-wqu@suse.com>
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 <wqu@suse.com>
---
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 <linux/sched/mm.h>
#include <linux/sort.h>
#include <linux/log2.h>
+#include <linux/zlib.h>
#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;
}
--
2.14.3
next prev parent reply other threads:[~2017-11-06 2:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-06 2:43 [PATCH 1/2] btrfs: Fix wild memory access in compression level parser Qu Wenruo
2017-11-06 2:43 ` Qu Wenruo [this message]
2017-11-06 9:52 ` Lu Fengqi
2017-11-15 15:11 ` David Sterba
2017-11-16 0:49 ` Qu Wenruo
2017-11-21 15:25 ` David Sterba
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=20171106024319.32584-2-wqu@suse.com \
--to=wqu@suse.com \
--cc=dsterba@suse.cz \
--cc=lakshmipathi.g@gmail.com \
--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 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).