Re: [PATCH v11 05/10] btrfs-progs: receive: process encoded_write commands

Nikolay Borisov
2021-10-21T13:33:06Z

On 1.09.21 г. 20:01, Omar Sandoval wrote:
> From: Boris Burkov <borisb@fb.com>
>
<snip>

> +/* Data is not compressed. */
> +#define BTRFS_ENCODED_IO_COMPRESSION_NONE 0
> +/* Data is compressed as a single zlib stream. */
> +#define BTRFS_ENCODED_IO_COMPRESSION_ZLIB 1
> +/*
> + * Data is compressed as a single zstd frame with the windowLog compression
> + * parameter set to no more than 17.
> + */
> +#define BTRFS_ENCODED_IO_COMPRESSION_ZSTD 2
> +/*
> + * Data is compressed page by page (using the page size indicated by the name of
> + * the constant) with LZO1X and wrapped in the format documented in
> + * fs/btrfs/lzo.c. For writes, the compression page size must match the
> + * filesystem page size.
> + */
> +#define BTRFS_ENCODED_IO_COMPRESSION_LZO_4K 3
> +#define BTRFS_ENCODED_IO_COMPRESSION_LZO_8K 4
> +#define BTRFS_ENCODED_IO_COMPRESSION_LZO_16K 5
> +#define BTRFS_ENCODED_IO_COMPRESSION_LZO_32K 6
> +#define BTRFS_ENCODED_IO_COMPRESSION_LZO_64K 7
> +#define BTRFS_ENCODED_IO_COMPRESSION_TYPES 8

nit: Make those an enum ? Same applies for the kernel counterpart patch.

> +
> +/* Data is not encrypted. */
> +#define BTRFS_ENCODED_IO_ENCRYPTION_NONE 0
> +#define BTRFS_ENCODED_IO_ENCRYPTION_TYPES 1
> +
> /* Error codes as returned by the kernel */
> enum btrfs_err_code {
> notused,
> @@ -949,6 +1077,10 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code)
> struct btrfs_ioctl_ino_lookup_user_args)
> #define BTRFS_IOC_SNAP_DESTROY_V2 _IOW(BTRFS_IOCTL_MAGIC, 63, \
> struct btrfs_ioctl_vol_args_v2)
> +#define BTRFS_IOC_ENCODED_READ _IOR(BTRFS_IOCTL_MAGIC, 64, \
> + struct btrfs_ioctl_encoded_io_args)
> +#define BTRFS_IOC_ENCODED_WRITE _IOW(BTRFS_IOCTL_MAGIC, 64, \
> + struct btrfs_ioctl_encoded_io_args)
>
> #ifdef __cplusplus
> }
>