[PATCH] btrfs: fix default compression value when set by SETFLAGS ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
Signed-off-by: David Sterba <dsterba@xxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux