Blob Blame History Raw
From: Libor Pechacek <lpechacek@suse.com>
Date: Mon, 9 May 2022 14:08:44 +0200
Subject: [PATCH] Revert "btrfs: props: change how empty value is interpreted"
Patch-mainline: never, the patch maintains compatibility in SLE
References: bsc#1195224

The change in compression parameter interpretation is an incompatible change
that was not requested in SLE. In the limited time left before release, revert
is the most straightforward resolution of the incompatibility. We may want to
adopt the change, along with btrfs-progs changes and proper documentation, in
SLE 15 SP5 or with the next kernel upgrade.

This reverts commit 5548c8c6f55bf0097075b3720e14857e3272429f.

Signed-off: Libor Pechacek <lpechacek@suse.com>
Acked-by: Qu Wenruo <wqu@suse.com>

---
 fs/btrfs/props.c |   14 --------------
 1 file changed, 14 deletions(-)

--- a/fs/btrfs/props.c
+++ b/fs/btrfs/props.c
@@ -260,10 +260,6 @@ static int prop_compression_validate(con
 	if (btrfs_compress_is_valid_type(value, len))
 		return 0;
 
-	if ((len == 2 && strncmp("no", value, 2) == 0) ||
-	    (len == 4 && strncmp("none", value, 4) == 0))
-		return 0;
-
 	return -EINVAL;
 }
 
@@ -273,17 +269,7 @@ static int prop_compression_apply(struct
 	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
 	int type;
 
-	/* Reset to defaults */
 	if (len == 0) {
-		BTRFS_I(inode)->flags &= ~BTRFS_INODE_COMPRESS;
-		BTRFS_I(inode)->flags &= ~BTRFS_INODE_NOCOMPRESS;
-		BTRFS_I(inode)->prop_compress = BTRFS_COMPRESS_NONE;
-		return 0;
-	}
-
-	/* Set NOCOMPRESS flag */
-	if ((len == 2 && strncmp("no", value, 2) == 0) ||
-	    (len == 4 && strncmp("none", value, 4) == 0)) {
 		BTRFS_I(inode)->flags |= BTRFS_INODE_NOCOMPRESS;
 		BTRFS_I(inode)->flags &= ~BTRFS_INODE_COMPRESS;
 		BTRFS_I(inode)->prop_compress = BTRFS_COMPRESS_NONE;