#include "bcachefs.h"
#include "checksum.h"
#include "compress.h"
#include "extents.h"
#include "super-io.h"
#include <linux/lz4.h>
#include <linux/zlib.h>
#include <linux/zstd.h>
struct bbuf { … };
static struct bbuf __bounce_alloc(struct bch_fs *c, unsigned size, int rw)
{ … }
static bool bio_phys_contig(struct bio *bio, struct bvec_iter start)
{ … }
static struct bbuf __bio_map_or_bounce(struct bch_fs *c, struct bio *bio,
struct bvec_iter start, int rw)
{ … }
static struct bbuf bio_map_or_bounce(struct bch_fs *c, struct bio *bio, int rw)
{ … }
static void bio_unmap_or_unbounce(struct bch_fs *c, struct bbuf buf)
{ … }
static inline void zlib_set_workspace(z_stream *strm, void *workspace)
{ … }
static int __bio_uncompress(struct bch_fs *c, struct bio *src,
void *dst_data, struct bch_extent_crc_unpacked crc)
{ … }
int bch2_bio_uncompress_inplace(struct bch_fs *c, struct bio *bio,
struct bch_extent_crc_unpacked *crc)
{ … }
int bch2_bio_uncompress(struct bch_fs *c, struct bio *src,
struct bio *dst, struct bvec_iter dst_iter,
struct bch_extent_crc_unpacked crc)
{ … }
static int attempt_compress(struct bch_fs *c,
void *workspace,
void *dst, size_t dst_len,
void *src, size_t src_len,
struct bch_compression_opt compression)
{ … }
static unsigned __bio_compress(struct bch_fs *c,
struct bio *dst, size_t *dst_len,
struct bio *src, size_t *src_len,
struct bch_compression_opt compression)
{ … }
unsigned bch2_bio_compress(struct bch_fs *c,
struct bio *dst, size_t *dst_len,
struct bio *src, size_t *src_len,
unsigned compression_opt)
{ … }
static int __bch2_fs_compress_init(struct bch_fs *, u64);
#define BCH_FEATURE_none …
static const unsigned bch2_compression_opt_to_feature[] = …;
#undef BCH_FEATURE_none
static int __bch2_check_set_has_compressed_data(struct bch_fs *c, u64 f)
{ … }
int bch2_check_set_has_compressed_data(struct bch_fs *c,
unsigned compression_opt)
{ … }
void bch2_fs_compress_exit(struct bch_fs *c)
{ … }
static int __bch2_fs_compress_init(struct bch_fs *c, u64 features)
{ … }
static u64 compression_opt_to_feature(unsigned v)
{ … }
int bch2_fs_compress_init(struct bch_fs *c)
{ … }
int bch2_opt_compression_parse(struct bch_fs *c, const char *_val, u64 *res,
struct printbuf *err)
{ … }
void bch2_compression_opt_to_text(struct printbuf *out, u64 v)
{ … }
void bch2_opt_compression_to_text(struct printbuf *out,
struct bch_fs *c,
struct bch_sb *sb,
u64 v)
{ … }
int bch2_opt_compression_validate(u64 v, struct printbuf *err)
{ … }