@@ -2145,22 +2145,14 @@ struct ocf_mngt_cache_unplug_context {
21452145 int cache_write_error ;
21462146};
21472147
2148- static void ocf_mngt_cache_stop_wait_metadata_io_finish (void * priv )
2149- {
2150- struct ocf_mngt_cache_unplug_context * context = priv ;
2151-
2152- ocf_pipeline_next (context -> pipeline );
2153- }
2154-
21552148static void ocf_mngt_cache_stop_wait_metadata_io (ocf_pipeline_t pipeline ,
21562149 void * priv , ocf_pipeline_arg_t arg )
21572150{
21582151 struct ocf_mngt_cache_unplug_context * context = priv ;
2159- ocf_cache_t cache = context -> cache ;
2152+ struct env_refcnt * refcnt = & context -> cache -> refcnt . metadata ;
21602153
2161- env_refcnt_freeze (& cache -> refcnt .metadata );
2162- env_refcnt_register_zero_cb (& cache -> refcnt .metadata ,
2163- ocf_mngt_cache_stop_wait_metadata_io_finish , context );
2154+ env_refcnt_freeze (refcnt );
2155+ ocf_mngt_continue_pipeline_on_zero_refcnt (refcnt , context -> pipeline );
21642156}
21652157
21662158static void ocf_mngt_cache_stop_check_dirty (ocf_pipeline_t pipeline ,
@@ -2566,22 +2558,14 @@ struct ocf_cache_standby_detach_context {
25662558 void * priv ;
25672559};
25682560
2569- static void _ocf_mngt_standby_detach_wait_metadata_io_finish (void * priv )
2570- {
2571- struct ocf_cache_standby_detach_context * context = priv ;
2572-
2573- ocf_pipeline_next (context -> pipeline );
2574- }
2575-
25762561static void _ocf_mngt_standby_detach_wait_metadata_io (ocf_pipeline_t pipeline ,
25772562 void * priv , ocf_pipeline_arg_t arg )
25782563{
25792564 struct ocf_cache_standby_detach_context * context = priv ;
2580- ocf_cache_t cache = context -> cache ;
2565+ struct env_refcnt * refcnt = & context -> cache -> refcnt . metadata ;
25812566
2582- env_refcnt_freeze (& cache -> refcnt .metadata );
2583- env_refcnt_register_zero_cb (& cache -> refcnt .metadata ,
2584- _ocf_mngt_standby_detach_wait_metadata_io_finish , context );
2567+ env_refcnt_freeze (refcnt );
2568+ ocf_mngt_continue_pipeline_on_zero_refcnt (refcnt , context -> pipeline );
25852569}
25862570
25872571static void _ocf_mngt_activate_set_cache_device (ocf_pipeline_t pipeline ,
@@ -3812,21 +3796,14 @@ static void ocf_mngt_cache_detach_flush(ocf_pipeline_t pipeline,
38123796 ocf_mngt_cache_flush (cache , ocf_mngt_cache_detach_flush_cmpl , context );
38133797}
38143798
3815- static void ocf_mngt_cache_detach_stop_cache_io_finish (void * priv )
3816- {
3817- struct ocf_mngt_cache_unplug_context * context = priv ;
3818- ocf_pipeline_next (context -> pipeline );
3819- }
3820-
38213799static void ocf_mngt_cache_detach_stop_cache_io (ocf_pipeline_t pipeline ,
38223800 void * priv , ocf_pipeline_arg_t arg )
38233801{
38243802 struct ocf_mngt_cache_unplug_context * context = priv ;
3825- ocf_cache_t cache = context -> cache ;
3803+ struct env_refcnt * refcnt = & context -> cache -> refcnt . metadata ;
38263804
3827- env_refcnt_freeze (& cache -> refcnt .metadata );
3828- env_refcnt_register_zero_cb (& cache -> refcnt .metadata ,
3829- ocf_mngt_cache_detach_stop_cache_io_finish , context );
3805+ env_refcnt_freeze (refcnt );
3806+ ocf_mngt_continue_pipeline_on_zero_refcnt (refcnt , context -> pipeline );
38303807}
38313808
38323809static void ocf_mngt_cache_detach_stop_cleaner_io_finish (void * priv )
0 commit comments