FreeBSD ZFS
The Zettabyte File System
|
LZJB compression of on-disk data. More...
Go to the source code of this file.
Defines | |
#define | MATCH_BITS 6 |
#define | MATCH_MIN 3 |
#define | MATCH_MAX ((1 << MATCH_BITS) + (MATCH_MIN - 1)) |
#define | OFFSET_MASK ((1 << (16 - MATCH_BITS)) - 1) |
#define | LEMPEL_SIZE 1024 |
Functions | |
size_t | lzjb_compress (void *s_start, void *d_start, size_t s_len, size_t d_len, int n) |
int | lzjb_decompress (void *s_start, void *d_start, size_t s_len, size_t d_len, int n) |
LZJB compression of on-disk data.
We keep our own copy of this algorithm for 3 main reasons: 1. If we didn't, anyone modifying common/os/compress.c would directly break our on disk format 2. Our version of lzjb does not have a number of checks that the common/os version needs and uses 3. We initialize the lempel to ensure deterministic results, so that identical blocks can always be deduplicated. In particular, we are adding the "feature" that compress() can take a destination buffer size and returns the compressed length, or the source length if compression would overflow the destination buffer.
Definition in file lzjb.c.
size_t lzjb_compress | ( | void * | s_start, |
void * | d_start, | ||
size_t | s_len, | ||
size_t | d_len, | ||
int | n | ||
) |