From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH v2 1/2] btrfs: define compression levels statically
Date: Tue, 20 Aug 2019 18:17:25 +0200 [thread overview]
Message-ID: <d4972ff57eb3ef57c616f5f7545f92d0cab7e12e.1566313756.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1566313756.git.dsterba@suse.com>
The maximum and default levels do not change and can be defined
directly. The set_level callback was a temporary solution and will be
removed.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/compression.h | 4 ++++
fs/btrfs/lzo.c | 2 ++
fs/btrfs/zlib.c | 2 ++
fs/btrfs/zstd.c | 2 ++
4 files changed, 10 insertions(+)
diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h
index 2035b8eb1290..cffd689adb6e 100644
--- a/fs/btrfs/compression.h
+++ b/fs/btrfs/compression.h
@@ -162,6 +162,10 @@ struct btrfs_compress_op {
* if the level is out of bounds or the default if 0 is passed in.
*/
unsigned int (*set_level)(unsigned int level);
+
+ /* Maximum level supported by the compression algorithm */
+ unsigned int max_level;
+ unsigned int default_level;
};
/* The heuristic workspaces are managed via the 0th workspace manager */
diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c
index 579d53ae256f..adac6cb30d65 100644
--- a/fs/btrfs/lzo.c
+++ b/fs/btrfs/lzo.c
@@ -523,4 +523,6 @@ const struct btrfs_compress_op btrfs_lzo_compress = {
.decompress_bio = lzo_decompress_bio,
.decompress = lzo_decompress,
.set_level = lzo_set_level,
+ .max_level = 1,
+ .default_level = 1,
};
diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c
index b86b7ad6b900..03d6c3683bd9 100644
--- a/fs/btrfs/zlib.c
+++ b/fs/btrfs/zlib.c
@@ -437,4 +437,6 @@ const struct btrfs_compress_op btrfs_zlib_compress = {
.decompress_bio = zlib_decompress_bio,
.decompress = zlib_decompress,
.set_level = zlib_set_level,
+ .max_level = 9,
+ .default_level = BTRFS_ZLIB_DEFAULT_LEVEL,
};
diff --git a/fs/btrfs/zstd.c b/fs/btrfs/zstd.c
index 3837ca180d52..b2b23a6a497d 100644
--- a/fs/btrfs/zstd.c
+++ b/fs/btrfs/zstd.c
@@ -729,4 +729,6 @@ const struct btrfs_compress_op btrfs_zstd_compress = {
.decompress_bio = zstd_decompress_bio,
.decompress = zstd_decompress,
.set_level = zstd_set_level,
+ .max_level = ZSTD_BTRFS_MAX_LEVEL,
+ .default_level = ZSTD_BTRFS_DEFAULT_LEVEL,
};
--
2.22.0
next prev parent reply other threads:[~2019-08-20 16:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-20 16:17 [PATCH v2 0/2] Compression level API cleanups David Sterba
2019-08-20 16:17 ` David Sterba [this message]
2019-08-21 10:55 ` [PATCH v2 1/2] btrfs: define compression levels statically Anand Jain
2019-08-20 16:17 ` [PATCH v2 2/2] btrfs: compression: replace set_level callbacks by a common helper David Sterba
2019-08-21 10:16 ` Anand Jain
2019-08-21 10:53 ` David Sterba
2019-08-21 6:52 ` [PATCH v2 0/2] Compression level API cleanups Nikolay Borisov
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=d4972ff57eb3ef57c616f5f7545f92d0cab7e12e.1566313756.git.dsterba@suse.com \
--to=dsterba@suse.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).