diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index fb44899..16d40bd 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8796,7 +8796,7 @@ struct inode *btrfs_alloc_inode(struct super_block *sb)
 		btrfs_init_metadata_block_rsv(fs_info, &ei->block_rsv,
 					      BTRFS_BLOCK_RSV_DELALLOC);
 	ei->runtime_flags = 0;
-	ei->prop_compress = BTRFS_COMPRESS_NONE;
+	ei->prop_compress = btrfs_compress_combine_type_level(BTRFS_COMPRESS_NONE, 0);
 	ei->defrag_compress = BTRFS_COMPRESS_NONE;
 
 	ei->delayed_node = NULL;
diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c
index f07be37..b6d8e6a 100644
--- a/fs/btrfs/props.c
+++ b/fs/btrfs/props.c
@@ -279,7 +279,7 @@ static int prop_compression_apply(struct inode *inode, const char *value,
 	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;
+		BTRFS_I(inode)->prop_compress = btrfs_compress_combine_type_level(BTRFS_COMPRESS_NONE, 0);
 		ret = 0;
         goto out;
 	}
@@ -289,7 +289,7 @@ static int prop_compression_apply(struct inode *inode, const char *value,
 	    (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;
+		BTRFS_I(inode)->prop_compress = btrfs_compress_combine_type_level(BTRFS_COMPRESS_NONE, 0);
         ret = 0;
         goto out;
 	}
@@ -332,15 +332,24 @@ static int prop_compression_apply(struct inode *inode, const char *value,
 
 static const char *prop_compression_extract(struct inode *inode)
 {
-	switch (BTRFS_I(inode)->prop_compress) {
+    char *type_level = NULL;
+    int type_level_buf_len = 50;
+    
+    type_level = (char *)kmalloc(type_level_buf_len, GFP_NOFS);
+    if (!type_level) {
+        return NULL;
+    }
+	switch (btrfs_compress_type(BTRFS_I(inode)->prop_compress)) {
 	case BTRFS_COMPRESS_ZLIB:
 	case BTRFS_COMPRESS_LZO:
 	case BTRFS_COMPRESS_ZSTD:
-		return btrfs_compress_type2str(BTRFS_I(inode)->prop_compress);
+		return btrfs_compress_type_level2str(btrfs_compress_type(BTRFS_I(inode)->prop_compress), btrfs_compress_level(BTRFS_I(inode)->prop_compress), type_level, type_level_buf_len);
 	default:
 		break;
 	}
-
+    if (type_level) {
+        kfree(type_level);
+    }
 	return NULL;
 }
 
@@ -371,22 +380,26 @@ static int inherit_props(struct btrfs_trans_handle *trans,
 	for (i = 0; i < ARRAY_SIZE(prop_handlers); i++) {
 		const struct prop_handler *h = &prop_handlers[i];
 		const char *value;
+        int is_compression_xattr = !strncmp(h->xattr_name, XATTR_BTRFS_PREFIX "compression", strlen(XATTR_BTRFS_PREFIX "compression"));
 		u64 num_bytes = 0;
 
 		if (!h->inheritable)
 			continue;
 
 		value = h->extract(parent);
+        btrfs_info(fs_info, "inherit_props values:%s", value);
 		if (!value)
 			continue;
-
 		/*
 		 * This is not strictly necessary as the property should be
 		 * valid, but in case it isn't, don't propagate it further.
 		 */
 		ret = h->validate(value, strlen(value));
-		if (ret)
+		if (ret) {
+            if (is_compression_xattr)
+                kfree(value);
 			continue;
+        }
 
 		/*
 		 * Currently callers should be reserving 1 item for properties,
@@ -400,8 +413,11 @@ static int inherit_props(struct btrfs_trans_handle *trans,
 			ret = btrfs_block_rsv_add(fs_info, trans->block_rsv,
 						  num_bytes,
 						  BTRFS_RESERVE_NO_FLUSH);
-			if (ret)
+			if (ret) {
+                if (is_compression_xattr)
+                    kfree(value);
 				return ret;
+            }
 		}
 
 		ret = btrfs_setxattr(trans, inode, h->xattr_name, value,
@@ -419,10 +435,15 @@ static int inherit_props(struct btrfs_trans_handle *trans,
 		if (need_reserve) {
 			btrfs_block_rsv_release(fs_info, trans->block_rsv,
 					num_bytes, NULL);
-			if (ret)
+			if (ret) {
+                if (is_compression_xattr)
+                    kfree(value);
 				return ret;
+            }
 		}
 		need_reserve = true;
+        if (is_compression_xattr)
+            kfree(value);
 	}
 
 	return 0;
