#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/zlib.h>
#include <linux/zutil.h>
#include <linux/mm.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/sched.h>
#include <linux/pagemap.h>
#include <linux/bio.h>
#include <linux/refcount.h>
#include "btrfs_inode.h"
#include "compression.h"
#include "fs.h"
#include "subpage.h"
#define ZLIB_DFLTCC_BUF_SIZE …
struct workspace { … };
static struct workspace_manager wsm;
struct list_head *zlib_get_workspace(unsigned int level)
{ … }
void zlib_free_workspace(struct list_head *ws)
{ … }
struct list_head *zlib_alloc_workspace(unsigned int level)
{ … }
int zlib_compress_folios(struct list_head *ws, struct address_space *mapping,
u64 start, struct folio **folios, unsigned long *out_folios,
unsigned long *total_in, unsigned long *total_out)
{ … }
int zlib_decompress_bio(struct list_head *ws, struct compressed_bio *cb)
{ … }
int zlib_decompress(struct list_head *ws, const u8 *data_in,
struct folio *dest_folio, unsigned long dest_pgoff, size_t srclen,
size_t destlen)
{ … }
const struct btrfs_compress_op btrfs_zlib_compress = …;