Skip to content

Commit a697a18

Browse files
committed
crimson: remove any assert_failure pre assert usages
Signed-off-by: Matan Breizman <[email protected]>
1 parent 9b5d418 commit a697a18

File tree

6 files changed

+43
-104
lines changed

6 files changed

+43
-104
lines changed

src/crimson/os/cyanstore/cyan_store.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,8 @@ class CyanStore final : public FuturizedStore {
194194
return shard_stores.invoke_on_all(
195195
[](auto &local_store) {
196196
return local_store.mount().handle_error(
197-
crimson::stateful_ec::assert_failure([](const auto& ec) {
198-
crimson::get_logger(ceph_subsys_cyanstore).error(
199-
"error mounting cyanstore: ({}) {}",
200-
ec.value(), ec.message());
201-
}));
197+
crimson::stateful_ec::assert_failure(
198+
fmt::format("error mounting cyanstore").c_str()));
202199
});
203200
}
204201

src/crimson/os/seastore/onode_manager/staged-fltree/node.cc

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -428,9 +428,8 @@ eagain_ifuture<Ref<Node>> Node::load_root(context_t c, RootNodeTracker& root_tra
428428
return c.nm.get_super(c.t, root_tracker
429429
).handle_error_interruptible(
430430
eagain_iertr::pass_further{},
431-
crimson::ct_error::input_output_error::assert_failure([FNAME, c] {
432-
ERRORT("EIO during get_super()", c.t);
433-
})
431+
crimson::ct_error::input_output_error::assert_failure(fmt::format(
432+
"{} EIO during get_super()", FNAME).c_str())
434433
).si_then([c, &root_tracker, FNAME](auto&& _super) {
435434
assert(_super);
436435
auto root_addr = _super->get_root_laddr();
@@ -691,26 +690,8 @@ eagain_ifuture<Ref<Node>> Node::load(
691690
return c.nm.read_extent(c.t, addr
692691
).handle_error_interruptible(
693692
eagain_iertr::pass_further{},
694-
crimson::ct_error::input_output_error::assert_failure(
695-
[FNAME, c, addr, expect_is_level_tail] {
696-
ERRORT("EIO -- addr={}, is_level_tail={}",
697-
c.t, addr, expect_is_level_tail);
698-
}),
699-
crimson::ct_error::invarg::assert_failure(
700-
[FNAME, c, addr, expect_is_level_tail] {
701-
ERRORT("EINVAL -- addr={}, is_level_tail={}",
702-
c.t, addr, expect_is_level_tail);
703-
}),
704-
crimson::ct_error::enoent::assert_failure(
705-
[FNAME, c, addr, expect_is_level_tail] {
706-
ERRORT("ENOENT -- addr={}, is_level_tail={}",
707-
c.t, addr, expect_is_level_tail);
708-
}),
709-
crimson::ct_error::erange::assert_failure(
710-
[FNAME, c, addr, expect_is_level_tail] {
711-
ERRORT("ERANGE -- addr={}, is_level_tail={}",
712-
c.t, addr, expect_is_level_tail);
713-
})
693+
crimson::ct_error::assert_all(fmt::format(
694+
"{} -- addr={}, is_level_tail={}", FNAME, addr, expect_is_level_tail).c_str())
714695
).si_then([FNAME, c, addr, expect_is_level_tail](auto extent)
715696
-> eagain_ifuture<Ref<Node>> {
716697
assert(extent);
@@ -2145,9 +2126,8 @@ eagain_ifuture<Ref<LeafNode>> LeafNode::allocate_root(
21452126
return c.nm.get_super(c.t, root_tracker
21462127
).handle_error_interruptible(
21472128
eagain_iertr::pass_further{},
2148-
crimson::ct_error::input_output_error::assert_failure([FNAME, c] {
2149-
ERRORT("EIO during get_super()", c.t);
2150-
})
2129+
crimson::ct_error::input_output_error::assert_failure(fmt::format(
2130+
"{} EIO during get_super()", FNAME).c_str())
21512131
).si_then([c, root](auto&& super) {
21522132
assert(super);
21532133
root->make_root_new(c, std::move(super));

src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_accessor.h

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -523,12 +523,9 @@ class NodeExtentAccessorT {
523523
return c.nm.alloc_extent(c.t, hint, alloc_size
524524
).handle_error_interruptible(
525525
eagain_iertr::pass_further{},
526-
crimson::ct_error::input_output_error::assert_failure(
527-
[FNAME, c, alloc_size, l_to_discard = extent->get_laddr()] {
528-
SUBERRORT(seastore_onode,
529-
"EIO during allocate -- node_size={}, to_discard={}",
530-
c.t, alloc_size, l_to_discard);
531-
})
526+
crimson::ct_error::input_output_error::assert_failure(fmt::format(
527+
"{} during allocate -- node_size={}, to_discard={}",
528+
FNAME, alloc_size, extent->get_laddr()).c_str())
532529
).si_then([this, c, FNAME] (auto fresh_extent) {
533530
SUBDEBUGT(seastore_onode,
534531
"update addr from {} to {} ...",
@@ -551,20 +548,9 @@ class NodeExtentAccessorT {
551548
return c.nm.retire_extent(c.t, to_discard
552549
).handle_error_interruptible(
553550
eagain_iertr::pass_further{},
554-
crimson::ct_error::input_output_error::assert_failure(
555-
[FNAME, c, l_to_discard = to_discard->get_laddr(),
556-
l_fresh = fresh_extent->get_laddr()] {
557-
SUBERRORT(seastore_onode,
558-
"EIO during retire -- to_disgard={}, fresh={}",
559-
c.t, l_to_discard, l_fresh);
560-
}),
561-
crimson::ct_error::enoent::assert_failure(
562-
[FNAME, c, l_to_discard = to_discard->get_laddr(),
563-
l_fresh = fresh_extent->get_laddr()] {
564-
SUBERRORT(seastore_onode,
565-
"ENOENT during retire -- to_disgard={}, fresh={}",
566-
c.t, l_to_discard, l_fresh);
567-
})
551+
crimson::ct_error::assert_all(fmt::format(
552+
"{} during retire -- to_disgard={}, fresh={}",
553+
FNAME, to_discard->get_laddr(), fresh_extent->get_laddr()).c_str())
568554
);
569555
}).si_then([this, c] {
570556
boost::ignore_unused(c); // avoid clang warning;
@@ -580,14 +566,8 @@ class NodeExtentAccessorT {
580566
return c.nm.retire_extent(c.t, std::move(extent)
581567
).handle_error_interruptible(
582568
eagain_iertr::pass_further{},
583-
crimson::ct_error::input_output_error::assert_failure(
584-
[FNAME, c, addr] {
585-
SUBERRORT(seastore_onode, "EIO -- addr={}", c.t, addr);
586-
}),
587-
crimson::ct_error::enoent::assert_failure(
588-
[FNAME, c, addr] {
589-
SUBERRORT(seastore_onode, "ENOENT -- addr={}", c.t, addr);
590-
})
569+
crimson::ct_error::assert_all(fmt::format(
570+
"{} addr={}", FNAME, addr).c_str())
591571
#ifndef NDEBUG
592572
).si_then([c] {
593573
assert(!c.t.is_conflicted());

src/crimson/os/seastore/onode_manager/staged-fltree/node_layout.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,9 @@ class NodeLayoutT final : public InternalNodeImpl, public LeafNodeImpl {
7878
return c.nm.alloc_extent(c.t, hint, extent_size
7979
).handle_error_interruptible(
8080
eagain_iertr::pass_further{},
81-
crimson::ct_error::input_output_error::assert_failure(
82-
[FNAME, c, extent_size, is_level_tail, level] {
83-
SUBERRORT(seastore_onode,
84-
"EIO -- extent_size={}, is_level_tail={}, level={}",
85-
c.t, extent_size, is_level_tail, level);
86-
})
81+
crimson::ct_error::input_output_error::assert_failure(fmt::format(
82+
"{} extent_size={}, is_level_tail={}, level={}",
83+
FNAME, extent_size, is_level_tail, level).c_str())
8784
).si_then([is_level_tail, level](auto extent) {
8885
assert(extent);
8986
assert(extent->is_initial_pending());

src/crimson/osd/osd.cc

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -280,18 +280,16 @@ seastar::future<> OSD::mkfs(
280280
co_await store.start();
281281

282282
co_await store.mkfs(osd_uuid).handle_error(
283-
crimson::stateful_ec::assert_failure([FNAME] (const auto& ec) {
284-
ERROR("error creating empty object store in {}: ({}) {}",
285-
local_conf().get_val<std::string>("osd_data"),
286-
ec.value(), ec.message());
287-
}));
283+
crimson::stateful_ec::assert_failure(fmt::format(
284+
"{} error creating empty object store in {}",
285+
FNAME, local_conf().get_val<std::string>("osd_data")).c_str())
286+
);
288287

289288
co_await store.mount().handle_error(
290-
crimson::stateful_ec::assert_failure([FNAME](const auto& ec) {
291-
ERROR("error mounting object store in {}: ({}) {}",
292-
local_conf().get_val<std::string>("osd_data"),
293-
ec.value(), ec.message());
294-
}));
289+
crimson::stateful_ec::assert_failure(fmt::format(
290+
"{} error mounting object store in {}",
291+
FNAME, local_conf().get_val<std::string>("osd_data")).c_str())
292+
);
295293

296294
{
297295
auto meta_coll = co_await open_or_create_meta_coll(store);
@@ -477,11 +475,10 @@ seastar::future<> OSD::start()
477475
whoami, get_shard_services(),
478476
*monc, *hb_front_msgr, *hb_back_msgr});
479477
return store.mount().handle_error(
480-
crimson::stateful_ec::assert_failure([FNAME] (const auto& ec) {
481-
ERROR("error mounting object store in {}: ({}) {}",
482-
local_conf().get_val<std::string>("osd_data"),
483-
ec.value(), ec.message());
484-
}));
478+
crimson::stateful_ec::assert_failure(fmt::format(
479+
"{} error mounting object store in {}",
480+
FNAME, local_conf().get_val<std::string>("osd_data")).c_str())
481+
);
485482
}).then([this, FNAME] {
486483
auto stats_seconds = local_conf().get_val<int64_t>("crimson_osd_stat_interval");
487484
if (stats_seconds > 0) {

src/crimson/tools/store_nbd/fs_driver.cc

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -185,28 +185,21 @@ seastar::future<> FSDriver::mkfs()
185185
uuid_d uuid;
186186
uuid.generate_random();
187187
return fs->mkfs(uuid).handle_error(
188-
crimson::stateful_ec::assert_failure([] (const auto& ec) {
189-
crimson::get_logger(ceph_subsys_test)
190-
.error("error creating empty object store in {}: ({}) {}",
191-
crimson::common::local_conf().get_val<std::string>("osd_data"),
192-
ec.value(), ec.message());
193-
}));
188+
crimson::stateful_ec::assert_failure(fmt::format(
189+
"error creating empty object store in {}",
190+
crimson::common::local_conf().get_val<std::string>("osd_data")).c_str())
191+
);
194192
}).then([this] {
195193
return fs->stop();
196194
}).then([this] {
197195
return init();
198196
}).then([this] {
199197
return fs->mount(
200198
).handle_error(
201-
crimson::stateful_ec::assert_failure([] (const auto& ec) {
202-
crimson::get_logger(
203-
ceph_subsys_test
204-
).error(
205-
"error mounting object store in {}: ({}) {}",
206-
crimson::common::local_conf().get_val<std::string>("osd_data"),
207-
ec.value(),
208-
ec.message());
209-
}));
199+
crimson::stateful_ec::assert_failure(fmt::format(
200+
"error creating empty object store in {}",
201+
crimson::common::local_conf().get_val<std::string>("osd_data")).c_str())
202+
);
210203
}).then([this] {
211204
return seastar::do_for_each(
212205
boost::counting_iterator<unsigned>(0),
@@ -239,15 +232,10 @@ seastar::future<> FSDriver::mount()
239232
}).then([this] {
240233
return fs->mount(
241234
).handle_error(
242-
crimson::stateful_ec::assert_failure([] (const auto& ec) {
243-
crimson::get_logger(
244-
ceph_subsys_test
245-
).error(
246-
"error mounting object store in {}: ({}) {}",
247-
crimson::common::local_conf().get_val<std::string>("osd_data"),
248-
ec.value(),
249-
ec.message());
250-
}));
235+
crimson::stateful_ec::assert_failure(fmt::format(
236+
"error creating empty object store in {}",
237+
crimson::common::local_conf().get_val<std::string>("osd_data")).c_str())
238+
);
251239
}).then([this] {
252240
return seastar::do_for_each(
253241
boost::counting_iterator<unsigned>(0),

0 commit comments

Comments
 (0)