@@ -688,8 +688,6 @@ struct heuristic_ws {
688
688
struct list_head list ;
689
689
};
690
690
691
- static struct workspace_manager heuristic_wsm ;
692
-
693
691
static void free_heuristic_ws (struct list_head * ws )
694
692
{
695
693
struct heuristic_ws * workspace ;
@@ -729,9 +727,7 @@ static struct list_head *alloc_heuristic_ws(struct btrfs_fs_info *fs_info)
729
727
return ERR_PTR (- ENOMEM );
730
728
}
731
729
732
- const struct btrfs_compress_op btrfs_heuristic_compress = {
733
- .workspace_manager = & heuristic_wsm ,
734
- };
730
+ const struct btrfs_compress_op btrfs_heuristic_compress = { 0 };
735
731
736
732
static const struct btrfs_compress_op * const btrfs_compress_op [] = {
737
733
/* The heuristic is represented as compression type 0 */
@@ -807,32 +803,6 @@ static int alloc_workspace_manager(struct btrfs_fs_info *fs_info,
807
803
return 0 ;
808
804
}
809
805
810
- static void btrfs_init_workspace_manager (struct btrfs_fs_info * fs_info , int type )
811
- {
812
- struct workspace_manager * wsm ;
813
- struct list_head * workspace ;
814
-
815
- wsm = btrfs_compress_op [type ]-> workspace_manager ;
816
- INIT_LIST_HEAD (& wsm -> idle_ws );
817
- spin_lock_init (& wsm -> ws_lock );
818
- atomic_set (& wsm -> total_ws , 0 );
819
- init_waitqueue_head (& wsm -> ws_wait );
820
-
821
- /*
822
- * Preallocate one workspace for each compression type so we can
823
- * guarantee forward progress in the worst case
824
- */
825
- workspace = alloc_workspace (fs_info , type , 0 );
826
- if (IS_ERR (workspace )) {
827
- btrfs_warn (fs_info ,
828
- "cannot preallocate compression workspace, will try later" );
829
- } else {
830
- atomic_set (& wsm -> total_ws , 1 );
831
- wsm -> free_ws = 1 ;
832
- list_add (workspace , & wsm -> idle_ws );
833
- }
834
- }
835
-
836
806
static void free_workspace_manager (struct btrfs_fs_info * fs_info ,
837
807
enum btrfs_compression_type type )
838
808
{
@@ -853,20 +823,6 @@ static void free_workspace_manager(struct btrfs_fs_info *fs_info,
853
823
kfree (gwsm );
854
824
}
855
825
856
- static void btrfs_cleanup_workspace_manager (int type )
857
- {
858
- struct workspace_manager * wsman ;
859
- struct list_head * ws ;
860
-
861
- wsman = btrfs_compress_op [type ]-> workspace_manager ;
862
- while (!list_empty (& wsman -> idle_ws )) {
863
- ws = wsman -> idle_ws .next ;
864
- list_del (ws );
865
- free_workspace (type , ws );
866
- atomic_dec (& wsman -> total_ws );
867
- }
868
- }
869
-
870
826
/*
871
827
* This finds an available workspace or allocates a new one.
872
828
* If it's not possible to allocate a new one, waits until there's one.
@@ -1192,11 +1148,6 @@ int __init btrfs_init_compress(void)
1192
1148
if (!compr_pool .shrinker )
1193
1149
return - ENOMEM ;
1194
1150
1195
- btrfs_init_workspace_manager (NULL , BTRFS_COMPRESS_NONE );
1196
- btrfs_init_workspace_manager (NULL , BTRFS_COMPRESS_ZLIB );
1197
- btrfs_init_workspace_manager (NULL , BTRFS_COMPRESS_LZO );
1198
- zstd_init_workspace_manager (NULL );
1199
-
1200
1151
spin_lock_init (& compr_pool .lock );
1201
1152
INIT_LIST_HEAD (& compr_pool .list );
1202
1153
compr_pool .count = 0 ;
@@ -1217,10 +1168,6 @@ void __cold btrfs_exit_compress(void)
1217
1168
btrfs_compr_pool_scan (NULL , NULL );
1218
1169
shrinker_free (compr_pool .shrinker );
1219
1170
1220
- btrfs_cleanup_workspace_manager (BTRFS_COMPRESS_NONE );
1221
- btrfs_cleanup_workspace_manager (BTRFS_COMPRESS_ZLIB );
1222
- btrfs_cleanup_workspace_manager (BTRFS_COMPRESS_LZO );
1223
- zstd_cleanup_workspace_manager ();
1224
1171
bioset_exit (& btrfs_compressed_bioset );
1225
1172
}
1226
1173
0 commit comments