@@ -44,7 +44,7 @@ HomeBlocksStats HomeBlocksImpl::get_stats() const {
4444}
4545
4646HomeBlocksImpl::~HomeBlocksImpl () {
47- homestore::HomeStore::instance ()->shutdown ();
47+ homestore::hs ()->shutdown ();
4848 homestore::HomeStore::reset_instance ();
4949 iomanager.stop ();
5050}
@@ -161,7 +161,7 @@ void HomeBlocksImpl::init_homestore() {
161161 // Note: timeline_consistency doesn't matter as we are using solo repl dev;
162162 auto repl_app =
163163 std::make_shared< HBReplApp >(repl_impl_type::solo, false /* timeline_consistency*/ , this , _application);
164- bool need_format = HomeStore::instance ()
164+ bool need_format = homestore::hs ()
165165 ->with_index_service (std::make_unique< HBIndexSvcCB >(this ))
166166 .with_repl_data_service (repl_app) // chunk selector defaulted to round_robine
167167 .start (hs_input_params{.devices = device_info, .app_mem_size = app_mem_size},
@@ -170,7 +170,7 @@ void HomeBlocksImpl::init_homestore() {
170170 LOGI (" We are starting for the first time. Formatting HomeStore. " );
171171 if (has_data_dev && has_fast_dev) {
172172 // NOTE: chunk_size, num_chunks only has to specify one, can be deduced from each other.
173- HomeStore::instance ()->format_and_start ({
173+ homestore::hs ()->format_and_start ({
174174 {HS_SERVICE::META, hs_format_params{.dev_type = HSDevType::Fast, .size_pct = 9.0 }},
175175 {HS_SERVICE::LOG,
176176 hs_format_params{
@@ -186,7 +186,7 @@ void HomeBlocksImpl::init_homestore() {
186186 } else {
187187 auto run_on_type = has_fast_dev ? homestore::HSDevType::Fast : homestore::HSDevType::Data;
188188 LOGD (" Running with Single mode, all service on {}" , run_on_type);
189- HomeStore::instance ()->format_and_start ({
189+ homestore::hs ()->format_and_start ({
190190 {HS_SERVICE::META, hs_format_params{.dev_type = run_on_type, .size_pct = 5.0 }},
191191 {HS_SERVICE::LOG,
192192 hs_format_params{.dev_type = run_on_type, .size_pct = 10.0 , .num_chunks = 0 , .chunk_size = 32 * Mi}},
@@ -199,7 +199,7 @@ void HomeBlocksImpl::init_homestore() {
199199 .block_size = DATA_BLK_SIZE}},
200200 });
201201 }
202- repl_app->on_repl_devs_init_completed ();
202+ // repl_app->on_repl_devs_init_completed();
203203 superblk_init ();
204204 }
205205
@@ -241,25 +241,29 @@ void HomeBlocksImpl::register_metablk_cb() {
241241 using namespace homestore ;
242242
243243 // HomeBlks SB
244- HomeStore::instance ()->meta_service ().register_handler (
244+ homestore::hs ()->meta_service ().register_handler (
245245 HB_META_NAME,
246246 [this ](homestore::meta_blk* mblk, sisl::byte_view buf, size_t size) {
247247 on_hb_meta_blk_found (std::move (buf), voidptr_cast (mblk));
248248 },
249249 nullptr /* recovery_comp_cb*/ , true /* do_crc */ );
250+ }
251+
252+ void HomeBlocksImpl::on_init_complete () {
253+ // this is called after HomeStore all recovery completed.
254+ // Add anything that needs to be done here.
255+ using namespace homestore ;
250256
251257 // Volume SB
252- HomeStore::instance ()->meta_service ().register_handler (
258+ homestore::hs ()->meta_service ().register_handler (
253259 Volume::VOL_META_NAME,
254260 [this ](homestore::meta_blk* mblk, sisl::byte_view buf, size_t size) {
255261 on_vol_meta_blk_found (std::move (buf), voidptr_cast (mblk));
256262 },
257- nullptr /* recovery_comp_cb*/ , true /* do_crc */ );
258- }
263+ nullptr /* recovery_comp_cb*/ , true /* do_crc */ ,
264+ std::optional< meta_subtype_vec_t >({ homestore::hs ()-> repl_service (). get_meta_blk_name ()}));
259265
260- void HomeBlocksImpl::on_init_complete () {
261- // this is called after HomeStore all recovery completed.
262- // Add anything that needs to be done here.
266+ homestore::hs ()->meta_service ().read_sub_sb (Volume::VOL_META_NAME);
263267}
264268
265269void HomeBlocksImpl::init_cp () {}
0 commit comments