* [PATCH] btrfs: super.c: Set compress_level=0 when using compress=lzo
@ 2020-08-03 19:55 Marcos Paulo de Souza
2020-08-11 14:12 ` David Sterba
2020-08-11 14:22 ` David Sterba
0 siblings, 2 replies; 3+ messages in thread
From: Marcos Paulo de Souza @ 2020-08-03 19:55 UTC (permalink / raw)
To: dsterba, linux-btrfs; +Cc: Marcos Paulo de Souza
From: Marcos Paulo de Souza <mpdesouza@suse.com>
Currently a user can set mount "-o compress" which will set the
compression algorithm to zlib, and use the default compress level for
zlib (3):
relatime,compress=zlib:3,space_cache
If the user remounts the fs using "-o compress=lzo", then the old
compress_level is used:
relatime,compress=lzo:3,space_cache
But lzo does not exposes any tunable compress level. The same happens if we set
any compress argument with different level, even with zstd.
Fix this issue by resetting the compress_level when compress=lzo is specified.
With the fix applied, lzo is shown without compress level, even after remounting
from zlib or zstd:
relatime,compress=lzo,space_cache
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
---
I found this issue while testing mount options. Should we tag this fix for
stable since the introduction of the compress_level, or is it no worthy?
fs/btrfs/super.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index a034ed52b5f6..dd2f05f9d6c6 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -614,6 +614,8 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
} else if (strncmp(args[0].from, "lzo", 3) == 0) {
compress_type = "lzo";
info->compress_type = BTRFS_COMPRESS_LZO;
+ /* lzo does not expose compression levels */
+ info->compress_level = 0;
btrfs_set_opt(info->mount_opt, COMPRESS);
btrfs_clear_opt(info->mount_opt, NODATACOW);
btrfs_clear_opt(info->mount_opt, NODATASUM);
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] btrfs: super.c: Set compress_level=0 when using compress=lzo
2020-08-03 19:55 [PATCH] btrfs: super.c: Set compress_level=0 when using compress=lzo Marcos Paulo de Souza
@ 2020-08-11 14:12 ` David Sterba
2020-08-11 14:22 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2020-08-11 14:12 UTC (permalink / raw)
To: Marcos Paulo de Souza; +Cc: dsterba, linux-btrfs, Marcos Paulo de Souza
On Mon, Aug 03, 2020 at 04:55:01PM -0300, Marcos Paulo de Souza wrote:
> From: Marcos Paulo de Souza <mpdesouza@suse.com>
>
> Currently a user can set mount "-o compress" which will set the
> compression algorithm to zlib, and use the default compress level for
> zlib (3):
>
> relatime,compress=zlib:3,space_cache
>
> If the user remounts the fs using "-o compress=lzo", then the old
> compress_level is used:
>
> relatime,compress=lzo:3,space_cache
>
> But lzo does not exposes any tunable compress level. The same happens if we set
> any compress argument with different level, even with zstd.
>
> Fix this issue by resetting the compress_level when compress=lzo is specified.
> With the fix applied, lzo is shown without compress level, even after remounting
> from zlib or zstd:
>
> relatime,compress=lzo,space_cache
>
> Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
> ---
>
> I found this issue while testing mount options. Should we tag this fix for
> stable since the introduction of the compress_level, or is it no worthy?
I'll tag it for stable, it's user-visible and confusing. Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: super.c: Set compress_level=0 when using compress=lzo
2020-08-03 19:55 [PATCH] btrfs: super.c: Set compress_level=0 when using compress=lzo Marcos Paulo de Souza
2020-08-11 14:12 ` David Sterba
@ 2020-08-11 14:22 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2020-08-11 14:22 UTC (permalink / raw)
To: Marcos Paulo de Souza; +Cc: dsterba, linux-btrfs, Marcos Paulo de Souza
On Mon, Aug 03, 2020 at 04:55:01PM -0300, Marcos Paulo de Souza wrote:
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -614,6 +614,8 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
> } else if (strncmp(args[0].from, "lzo", 3) == 0) {
> compress_type = "lzo";
> info->compress_type = BTRFS_COMPRESS_LZO;
> + /* lzo does not expose compression levels */
> + info->compress_level = 0;
I had that as a fixup in patches fixing the other message errors, with
info->compress_level = 1.
With level 0 it'll print
btrfs_info(info, "%s %s compression, level %d",
(compress_force) ? "force" : "use",
compress_type, info->compress_level);
"use lzo compression, level 0"
Which might be confusing as well, but super.c:btrfs_show_options will
not print the level in that case so I think it's fine with 0.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-11 14:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-03 19:55 [PATCH] btrfs: super.c: Set compress_level=0 when using compress=lzo Marcos Paulo de Souza
2020-08-11 14:12 ` David Sterba
2020-08-11 14:22 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox