Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH] btrfs: fix default compression value when set by SETFLAGS ioctl
@ 2017-10-31 16:45 David Sterba
  2017-10-31 19:21 ` Nick Terrell
  0 siblings, 1 reply; 3+ messages in thread
From: David Sterba @ 2017-10-31 16:45 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba, Nick Terrell

The current default for the compression file flag is 'zlib', the zstd
patch silently changed that to zstd. Though the choice of zlib might not
be the best one, we should keep the backward compatibility.

The incompat bit for zstd is not set, so this could lead to a filesystem
with a zstd compression in the extents but no flag for the filesystem.

Fixes: 5c1aab1dd5445ed8bd ("btrfs: Add zstd support")
CC: Nick Terrell <terrelln@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/ioctl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index fd172a93d11a..0ce9a895931a 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -309,10 +309,10 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
 
 		if (fs_info->compress_type == BTRFS_COMPRESS_LZO)
 			comp = "lzo";
-		else if (fs_info->compress_type == BTRFS_COMPRESS_ZLIB)
-			comp = "zlib";
-		else
+		else if (fs_info->compress_type == BTRFS_COMPRESS_ZSTD)
 			comp = "zstd";
+		else
+			comp = "zlib";
 		ret = btrfs_set_prop(inode, "btrfs.compression",
 				     comp, strlen(comp), 0);
 		if (ret)
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-01 14:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-31 16:45 [PATCH] btrfs: fix default compression value when set by SETFLAGS ioctl David Sterba
2017-10-31 19:21 ` Nick Terrell
2017-11-01 14:07   ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox