Commit be951045 authored by David Sterba's avatar David Sterba
Browse files

btrfs: compression: attach workspace manager to the ops



There's a lot of indirection when the generic code calls into
algo-specific callbacks to reach the private workspace manager structure
and back to the generic code.

To simplify that, export the workspace manager for heuristic, LZO and
ZLIB, while ZSTD is going to use it's own manager.

Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 1e4eb746
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -920,6 +920,7 @@ fail:
}

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,
+1 −0
Original line number Diff line number Diff line
@@ -140,6 +140,7 @@ struct btrfs_compress_op {

	void (*free_workspace)(struct list_head *workspace);

	struct workspace_manager *workspace_manager;
	/* Maximum level supported by the compression algorithm */
	unsigned int max_level;
	unsigned int default_level;
+1 −0
Original line number Diff line number Diff line
@@ -503,6 +503,7 @@ out:
}

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,
+1 −0
Original line number Diff line number Diff line
@@ -414,6 +414,7 @@ next:
}

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,
+2 −0
Original line number Diff line number Diff line
@@ -707,6 +707,8 @@ finish:
}

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,