btrfs: Add zstd support
[sfrench/cifs-2.6.git] / fs / btrfs / props.c
index 4b23ae5d0e5c0330260ae96d2574b9422c16978d..20631e9273a098fcf024f29f7074248e25359064 100644 (file)
@@ -390,6 +390,8 @@ static int prop_compression_validate(const char *value, size_t len)
                return 0;
        else if (!strncmp("zlib", value, len))
                return 0;
+       else if (!strncmp("zstd", value, len))
+               return 0;
 
        return -EINVAL;
 }
@@ -412,6 +414,8 @@ static int prop_compression_apply(struct inode *inode,
                type = BTRFS_COMPRESS_LZO;
        else if (!strncmp("zlib", value, len))
                type = BTRFS_COMPRESS_ZLIB;
+       else if (!strncmp("zstd", value, len))
+               type = BTRFS_COMPRESS_ZSTD;
        else
                return -EINVAL;
 
@@ -429,6 +433,8 @@ static const char *prop_compression_extract(struct inode *inode)
                return "zlib";
        case BTRFS_COMPRESS_LZO:
                return "lzo";
+       case BTRFS_COMPRESS_ZSTD:
+               return "zstd";
        }
 
        return NULL;