Skip to main content

encoded_write

Function encoded_write 

Source
pub fn encoded_write(
    fd: BorrowedFd<'_>,
    data: &[u8],
    offset: u64,
    unencoded_file_len: u64,
    unencoded_len: u64,
    unencoded_offset: u64,
    compression: u32,
    encryption: u32,
) -> Result<()>
Expand description

Write pre-compressed data to a file using BTRFS_IOC_ENCODED_WRITE.

This passes compressed data directly to the filesystem without decompression, which is more efficient than decompressing and writing.

Errors: ENOTTY on kernels that do not support encoded writes (pre-5.18). EINVAL if the compression type, alignment, or lengths are not accepted. ENOSPC if the filesystem has no room for the encoded extent. Callers should fall back to manual decompression + pwrite for any of these.