Skip to content

Commit a3bbd2a

Browse files
committed
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>
1 parent c778df1 commit a3bbd2a

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

‎fs/btrfs/compression.c‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,14 +1086,16 @@ static struct list_head *get_workspace(int type, int level)
10861086
* put a workspace struct back on the list or free it if we have enough
10871087
* idle ones sitting around
10881088
*/
1089-
void btrfs_put_workspace(struct workspace_manager *wsm, struct list_head *ws)
1089+
void btrfs_put_workspace(int type, struct list_head *ws)
10901090
{
1091+
struct workspace_manager *wsm;
10911092
struct list_head *idle_ws;
10921093
spinlock_t *ws_lock;
10931094
atomic_t *total_ws;
10941095
wait_queue_head_t *ws_wait;
10951096
int *free_ws;
10961097

1098+
wsm = btrfs_compress_op[type]->workspace_manager;
10971099
idle_ws = &wsm->idle_ws;
10981100
ws_lock = &wsm->ws_lock;
10991101
total_ws = &wsm->total_ws;
@@ -1117,13 +1119,10 @@ void btrfs_put_workspace(struct workspace_manager *wsm, struct list_head *ws)
11171119

11181120
static void put_workspace(int type, struct list_head *ws)
11191121
{
1120-
struct workspace_manager *wsm;
1121-
1122-
wsm = btrfs_compress_op[type]->workspace_manager;
11231122
switch (type) {
1124-
case BTRFS_COMPRESS_NONE: return btrfs_put_workspace(wsm, ws);
1125-
case BTRFS_COMPRESS_ZLIB: return btrfs_put_workspace(wsm, ws);
1126-
case BTRFS_COMPRESS_LZO: return btrfs_put_workspace(wsm, ws);
1123+
case BTRFS_COMPRESS_NONE: return btrfs_put_workspace(type, ws);
1124+
case BTRFS_COMPRESS_ZLIB: return btrfs_put_workspace(type, ws);
1125+
case BTRFS_COMPRESS_LZO: return btrfs_put_workspace(type, ws);
11271126
case BTRFS_COMPRESS_ZSTD: return zstd_put_workspace(ws);
11281127
default:
11291128
/*

‎fs/btrfs/compression.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ struct workspace_manager {
121121
};
122122

123123
struct list_head *btrfs_get_workspace(int type, unsigned int level);
124-
void btrfs_put_workspace(struct workspace_manager *wsm, struct list_head *ws);
124+
void btrfs_put_workspace(int type, struct list_head *ws);
125125

126126
struct btrfs_compress_op {
127127
void (*free_workspace)(struct list_head *workspace);

0 commit comments

Comments
 (0)