int (*validate)(const struct btrfs_inode *inode, const char *value,
size_t len);
int (*apply)(struct btrfs_inode *inode, const char *value, size_t len);
- const char *(*extract)(const struct btrfs_inode *inode);
+ const char *(*extract)(const struct btrfs_inode *inode, char *buf, size_t len);
bool (*ignore)(const struct btrfs_inode *inode);
int inheritable;
};
return false;
}
-static const char *prop_compression_extract(const struct btrfs_inode *inode)
+static const char *prop_compression_extract(const struct btrfs_inode *inode,
+ char *buf, size_t len)
{
switch (inode->prop_compress) {
case BTRFS_COMPRESS_ZLIB:
case BTRFS_COMPRESS_LZO:
case BTRFS_COMPRESS_ZSTD:
+ if (inode->prop_compress_level) {
+ snprintf(buf, len, "%s:%d",
+ btrfs_compress_type2str(inode->prop_compress),
+ inode->prop_compress_level);
+ return buf;
+ }
return btrfs_compress_type2str(inode->prop_compress);
default:
break;
const struct prop_handler *h = &prop_handlers[i];
const char *value;
u64 num_bytes = 0;
+ char buf[BTRFS_COMPRESS_PROP_MAX_LEN];
if (!h->inheritable)
continue;
if (h->ignore(inode))
continue;
- value = h->extract(parent);
+ value = h->extract(parent, buf, sizeof(buf));
if (!value)
continue;