diff options
author | David Sterba <dsterba@suse.com> | 2019-10-04 02:50:28 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-11-18 12:46:59 +0100 |
commit | a3bbd2a9ee3c08b60b3127843866bdc76757c24f (patch) | |
tree | 2d04c48c2f8906dda7ff552d873f81b51b250233 /fs/btrfs/compression.c | |
parent | btrfs: compression: inline alloc_workspace (diff) | |
download | linux-a3bbd2a9ee3c08b60b3127843866bdc76757c24f.tar.xz linux-a3bbd2a9ee3c08b60b3127843866bdc76757c24f.zip |
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>
Diffstat (limited to 'fs/btrfs/compression.c')
-rw-r--r-- | fs/btrfs/compression.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 4a8dab961f88..2a77c91c194b 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -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 * 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; spinlock_t *ws_lock; atomic_t *total_ws; wait_queue_head_t *ws_wait; int *free_ws; + wsm = btrfs_compress_op[type]->workspace_manager; idle_ws = &wsm->idle_ws; ws_lock = &wsm->ws_lock; total_ws = &wsm->total_ws; @@ -1117,13 +1119,10 @@ wake: static void put_workspace(int type, struct list_head *ws) { - struct workspace_manager *wsm; - - wsm = btrfs_compress_op[type]->workspace_manager; switch (type) { - case BTRFS_COMPRESS_NONE: return btrfs_put_workspace(wsm, ws); - case BTRFS_COMPRESS_ZLIB: return btrfs_put_workspace(wsm, ws); - case BTRFS_COMPRESS_LZO: return btrfs_put_workspace(wsm, ws); + case BTRFS_COMPRESS_NONE: return btrfs_put_workspace(type, ws); + case BTRFS_COMPRESS_ZLIB: return btrfs_put_workspace(type, ws); + case BTRFS_COMPRESS_LZO: return btrfs_put_workspace(type, ws); case BTRFS_COMPRESS_ZSTD: return zstd_put_workspace(ws); default: /* |