Commit 2dba7143 authored by David Sterba's avatar David Sterba

btrfs: compression: let workspace manager cleanup 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 cleanup 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 d5517033
......@@ -863,7 +863,7 @@ static struct workspace_manager heuristic_wsm;
static void heuristic_cleanup_workspace_manager(void)
{
btrfs_cleanup_workspace_manager(&heuristic_wsm);
btrfs_cleanup_workspace_manager(BTRFS_COMPRESS_NONE);
}
static struct list_head *heuristic_get_workspace(unsigned int level)
......@@ -960,10 +960,12 @@ static void btrfs_init_workspace_manager(int type)
}
}
void btrfs_cleanup_workspace_manager(struct workspace_manager *wsman)
void btrfs_cleanup_workspace_manager(int type)
{
struct workspace_manager *wsman;
struct list_head *ws;
wsman = btrfs_compress_op[type]->workspace_manager;
while (!list_empty(&wsman->idle_ws)) {
ws = wsman->idle_ws.next;
list_del(ws);
......
......@@ -123,7 +123,7 @@ struct workspace_manager {
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);
void btrfs_cleanup_workspace_manager(int type);
struct btrfs_compress_op {
void (*cleanup_workspace_manager)(void);
......
......@@ -65,7 +65,7 @@ static struct workspace_manager wsm;
static void lzo_cleanup_workspace_manager(void)
{
btrfs_cleanup_workspace_manager(&wsm);
btrfs_cleanup_workspace_manager(BTRFS_COMPRESS_LZO);
}
static struct list_head *lzo_get_workspace(unsigned int level)
......
......@@ -31,7 +31,7 @@ static struct workspace_manager wsm;
static void zlib_cleanup_workspace_manager(void)
{
btrfs_cleanup_workspace_manager(&wsm);
btrfs_cleanup_workspace_manager(BTRFS_COMPRESS_ZLIB);
}
static struct list_head *zlib_get_workspace(unsigned int level)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment