summaryrefslogtreecommitdiff
path: root/fs/btrfs/compression.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2019-10-04 03:50:28 +0300
committerDavid Sterba <dsterba@suse.com>2019-11-18 14:46:58 +0300
commit5907a9bb13cea3bbf0c54d6a9a1ccf5edebedeed (patch)
tree0e3638d8a24e22ddc206233f22b66e86c00e4aca /fs/btrfs/compression.c
parentbd3a5287cc20e37f1e365be1f742b6c574e3f83c (diff)
downloadlinux-5907a9bb13cea3bbf0c54d6a9a1ccf5edebedeed.tar.xz
btrfs: compression: pass type to btrfs_get_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 alloc_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.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 9b9638557e19..ffc94e15d86e 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -972,9 +972,9 @@ static void btrfs_cleanup_workspace_manager(int type)
* Preallocation makes a forward progress guarantees and we do not return
* errors.
*/
-struct list_head *btrfs_get_workspace(struct workspace_manager *wsm,
- unsigned int level)
+struct list_head *btrfs_get_workspace(int type, unsigned int level)
{
+ struct workspace_manager *wsm;
struct list_head *workspace;
int cpus = num_online_cpus();
unsigned nofs_flag;
@@ -984,6 +984,7 @@ struct list_head *btrfs_get_workspace(struct workspace_manager *wsm,
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;
@@ -1052,13 +1053,10 @@ again:
static struct list_head *get_workspace(int type, int level)
{
- struct workspace_manager *wsm;
-
- wsm = btrfs_compress_op[type]->workspace_manager;
switch (type) {
- case BTRFS_COMPRESS_NONE: return btrfs_get_workspace(wsm, level);
+ case BTRFS_COMPRESS_NONE: return btrfs_get_workspace(type, level);
case BTRFS_COMPRESS_ZLIB: return zlib_get_workspace(level);
- case BTRFS_COMPRESS_LZO: return btrfs_get_workspace(wsm, level);
+ case BTRFS_COMPRESS_LZO: return btrfs_get_workspace(type, level);
case BTRFS_COMPRESS_ZSTD: return zstd_get_workspace(level);
default:
/*