int zstd_decompress(struct list_head *ws, unsigned char *data_in,
struct page *dest_page, unsigned long start_byte, size_t srclen,
size_t destlen);
+void zstd_init_workspace_manager(void);
static const char* const btrfs_compress_types[] = { "", "zlib", "lzo", "zstd" };
static struct workspace_manager heuristic_wsm;
-static void heuristic_init_workspace_manager(void)
-{
- btrfs_init_workspace_manager(BTRFS_COMPRESS_NONE);
-}
-
static void heuristic_cleanup_workspace_manager(void)
{
btrfs_cleanup_workspace_manager(&heuristic_wsm);
const struct btrfs_compress_op btrfs_heuristic_compress = {
.workspace_manager = &heuristic_wsm,
- .init_workspace_manager = heuristic_init_workspace_manager,
.cleanup_workspace_manager = heuristic_cleanup_workspace_manager,
.get_workspace = heuristic_get_workspace,
.put_workspace = heuristic_put_workspace,
&btrfs_zstd_compress,
};
-void btrfs_init_workspace_manager(int type)
+static void btrfs_init_workspace_manager(int type)
{
const struct btrfs_compress_op *ops = btrfs_compress_op[type];
struct workspace_manager *wsm = ops->workspace_manager;
void __init btrfs_init_compress(void)
{
- int i;
-
- for (i = 0; i < BTRFS_NR_WORKSPACE_MANAGERS; i++)
- btrfs_compress_op[i]->init_workspace_manager();
+ btrfs_init_workspace_manager(BTRFS_COMPRESS_NONE);
+ btrfs_init_workspace_manager(BTRFS_COMPRESS_ZLIB);
+ btrfs_init_workspace_manager(BTRFS_COMPRESS_LZO);
+ zstd_init_workspace_manager();
}
void __cold btrfs_exit_compress(void)
wait_queue_head_t ws_wait;
};
-void btrfs_init_workspace_manager(int type);
struct list_head *btrfs_get_workspace(struct workspace_manager *wsm,
unsigned int level);
void btrfs_put_workspace(struct workspace_manager *wsm, struct list_head *ws);
void btrfs_cleanup_workspace_manager(struct workspace_manager *wsm);
struct btrfs_compress_op {
- void (*init_workspace_manager)(void);
-
void (*cleanup_workspace_manager)(void);
struct list_head *(*get_workspace)(unsigned int level);
static struct workspace_manager wsm;
-static void lzo_init_workspace_manager(void)
-{
- btrfs_init_workspace_manager(BTRFS_COMPRESS_LZO);
-}
-
static void lzo_cleanup_workspace_manager(void)
{
btrfs_cleanup_workspace_manager(&wsm);
const struct btrfs_compress_op btrfs_lzo_compress = {
.workspace_manager = &wsm,
- .init_workspace_manager = lzo_init_workspace_manager,
.cleanup_workspace_manager = lzo_cleanup_workspace_manager,
.get_workspace = lzo_get_workspace,
.put_workspace = lzo_put_workspace,
static struct workspace_manager wsm;
-static void zlib_init_workspace_manager(void)
-{
- btrfs_init_workspace_manager(BTRFS_COMPRESS_ZLIB);
-}
-
static void zlib_cleanup_workspace_manager(void)
{
btrfs_cleanup_workspace_manager(&wsm);
const struct btrfs_compress_op btrfs_zlib_compress = {
.workspace_manager = &wsm,
- .init_workspace_manager = zlib_init_workspace_manager,
.cleanup_workspace_manager = zlib_cleanup_workspace_manager,
.get_workspace = zlib_get_workspace,
.put_workspace = zlib_put_workspace,
}
}
-static void zstd_init_workspace_manager(void)
+void zstd_init_workspace_manager(void)
{
struct list_head *ws;
int i;
const struct btrfs_compress_op btrfs_zstd_compress = {
/* ZSTD uses own workspace manager */
.workspace_manager = NULL,
- .init_workspace_manager = zstd_init_workspace_manager,
.cleanup_workspace_manager = zstd_cleanup_workspace_manager,
.get_workspace = zstd_get_workspace,
.put_workspace = zstd_put_workspace,