Commit 975db483 authored by David Sterba's avatar David Sterba
Browse files

btrfs: compression: let workspace manager init take only the type



With the access to the workspace structures, we can look it up together
with the compression ops inside the workspace manager init helper.

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 be951045
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -862,7 +862,7 @@ static struct workspace_manager heuristic_wsm;

static void heuristic_init_workspace_manager(void)
{
	btrfs_init_workspace_manager(&heuristic_wsm, &btrfs_heuristic_compress);
	btrfs_init_workspace_manager(BTRFS_COMPRESS_NONE);
}

static void heuristic_cleanup_workspace_manager(void)
@@ -937,9 +937,10 @@ static const struct btrfs_compress_op * const btrfs_compress_op[] = {
	&btrfs_zstd_compress,
};

void btrfs_init_workspace_manager(struct workspace_manager *wsm,
				  const struct btrfs_compress_op *ops)
void btrfs_init_workspace_manager(int type)
{
	const struct btrfs_compress_op *ops = btrfs_compress_op[type];
	struct workspace_manager *wsm = ops->workspace_manager;
	struct list_head *workspace;

	wsm->ops = ops;
+1 −2
Original line number Diff line number Diff line
@@ -120,8 +120,7 @@ struct workspace_manager {
	wait_queue_head_t ws_wait;
};

void btrfs_init_workspace_manager(struct workspace_manager *wsm,
				  const struct btrfs_compress_op *ops);
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);
+1 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ static struct workspace_manager wsm;

static void lzo_init_workspace_manager(void)
{
	btrfs_init_workspace_manager(&wsm, &btrfs_lzo_compress);
	btrfs_init_workspace_manager(BTRFS_COMPRESS_LZO);
}

static void lzo_cleanup_workspace_manager(void)
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ static struct workspace_manager wsm;

static void zlib_init_workspace_manager(void)
{
	btrfs_init_workspace_manager(&wsm, &btrfs_zlib_compress);
	btrfs_init_workspace_manager(BTRFS_COMPRESS_ZLIB);
}

static void zlib_cleanup_workspace_manager(void)