mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-01 12:04:08 +00:00
btrfs: compression: pass type to btrfs_put_workspace
We can infer the workspace_manager from type and the type will be used in the following patch to call a common helper for free_workspace. Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
c778df1406
commit
a3bbd2a9ee
2 changed files with 7 additions and 8 deletions
|
@ -1086,14 +1086,16 @@ static struct list_head *get_workspace(int type, int level)
|
||||||
* put a workspace struct back on the list or free it if we have enough
|
* put a workspace struct back on the list or free it if we have enough
|
||||||
* idle ones sitting around
|
* idle ones sitting around
|
||||||
*/
|
*/
|
||||||
void btrfs_put_workspace(struct workspace_manager *wsm, struct list_head *ws)
|
void btrfs_put_workspace(int type, struct list_head *ws)
|
||||||
{
|
{
|
||||||
|
struct workspace_manager *wsm;
|
||||||
struct list_head *idle_ws;
|
struct list_head *idle_ws;
|
||||||
spinlock_t *ws_lock;
|
spinlock_t *ws_lock;
|
||||||
atomic_t *total_ws;
|
atomic_t *total_ws;
|
||||||
wait_queue_head_t *ws_wait;
|
wait_queue_head_t *ws_wait;
|
||||||
int *free_ws;
|
int *free_ws;
|
||||||
|
|
||||||
|
wsm = btrfs_compress_op[type]->workspace_manager;
|
||||||
idle_ws = &wsm->idle_ws;
|
idle_ws = &wsm->idle_ws;
|
||||||
ws_lock = &wsm->ws_lock;
|
ws_lock = &wsm->ws_lock;
|
||||||
total_ws = &wsm->total_ws;
|
total_ws = &wsm->total_ws;
|
||||||
|
@ -1117,13 +1119,10 @@ wake:
|
||||||
|
|
||||||
static void put_workspace(int type, struct list_head *ws)
|
static void put_workspace(int type, struct list_head *ws)
|
||||||
{
|
{
|
||||||
struct workspace_manager *wsm;
|
|
||||||
|
|
||||||
wsm = btrfs_compress_op[type]->workspace_manager;
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case BTRFS_COMPRESS_NONE: return btrfs_put_workspace(wsm, ws);
|
case BTRFS_COMPRESS_NONE: return btrfs_put_workspace(type, ws);
|
||||||
case BTRFS_COMPRESS_ZLIB: return btrfs_put_workspace(wsm, ws);
|
case BTRFS_COMPRESS_ZLIB: return btrfs_put_workspace(type, ws);
|
||||||
case BTRFS_COMPRESS_LZO: return btrfs_put_workspace(wsm, ws);
|
case BTRFS_COMPRESS_LZO: return btrfs_put_workspace(type, ws);
|
||||||
case BTRFS_COMPRESS_ZSTD: return zstd_put_workspace(ws);
|
case BTRFS_COMPRESS_ZSTD: return zstd_put_workspace(ws);
|
||||||
default:
|
default:
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -121,7 +121,7 @@ struct workspace_manager {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct list_head *btrfs_get_workspace(int type, unsigned int level);
|
struct list_head *btrfs_get_workspace(int type, unsigned int level);
|
||||||
void btrfs_put_workspace(struct workspace_manager *wsm, struct list_head *ws);
|
void btrfs_put_workspace(int type, struct list_head *ws);
|
||||||
|
|
||||||
struct btrfs_compress_op {
|
struct btrfs_compress_op {
|
||||||
void (*free_workspace)(struct list_head *workspace);
|
void (*free_workspace)(struct list_head *workspace);
|
||||||
|
|
Loading…
Add table
Reference in a new issue