Skip to content

Commit 1be8da6

Browse files
Merge pull request ceph#63374 from Matan-B/wip-matanb-use-ceph-assert
osd, os, mon: s/assert/ceph_assert/g'
2 parents b6fb6e0 + bf8b23b commit 1be8da6

32 files changed

+97
-97
lines changed

src/mon/ElectionLogic.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void ElectionLogic::bump_epoch(epoch_t e)
8686

8787
void ElectionLogic::declare_standalone_victory()
8888
{
89-
assert(elector->paxos_size() == 1 && elector->get_my_rank() == 0);
89+
ceph_assert(elector->paxos_size() == 1 && elector->get_my_rank() == 0);
9090
init();
9191
bump_epoch(epoch+1);
9292
}

src/mon/LogMonitor.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ void LogMonitor::log_external_backlog()
465465
} else {
466466
// pre-quincy, we assumed that anything through summary.version was
467467
// logged externally.
468-
assert(r == -ENOENT);
468+
ceph_assert(r == -ENOENT);
469469
external_log_to = summary.version;
470470
dout(10) << __func__ << " initialized external_log_to = " << external_log_to
471471
<< " (summary v " << summary.version << ")" << dendl;

src/mon/MgrMonitor.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ void MgrMonitor::on_active()
725725
return;
726726
}
727727
mon.clog->debug() << "mgrmap e" << map.epoch << ": " << map;
728-
assert(HAVE_FEATURE(mon.get_quorum_con_features(), SERVER_NAUTILUS));
728+
ceph_assert(HAVE_FEATURE(mon.get_quorum_con_features(), SERVER_NAUTILUS));
729729
if (pending_map.always_on_modules == always_on_modules()) {
730730
return;
731731
}

src/mon/MonClient.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1861,7 +1861,7 @@ int MonConnection::handle_auth_bad_method(
18611861
auth_registry->get_supported_methods(con->get_peer_type(), &auth_supported);
18621862
auto p = std::find(auth_supported.begin(), auth_supported.end(),
18631863
old_auth_method);
1864-
assert(p != auth_supported.end());
1864+
ceph_assert(p != auth_supported.end());
18651865
p = std::find_first_of(std::next(p), auth_supported.end(),
18661866
allowed_methods.begin(), allowed_methods.end());
18671867
if (p == auth_supported.end()) {

src/mon/Monitor.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6507,7 +6507,7 @@ int Monitor::handle_auth_request(
65076507
dout(1) << __func__ << " invalid mode " << (int)mode << dendl;
65086508
return -EACCES;
65096509
}
6510-
assert(mode >= AUTH_MODE_MON && mode <= AUTH_MODE_MON_MAX);
6510+
ceph_assert(mode >= AUTH_MODE_MON && mode <= AUTH_MODE_MON_MAX);
65116511
decode(entity_name, p);
65126512
decode(con->peer_global_id, p);
65136513
} catch (ceph::buffer::error& e) {
@@ -6639,7 +6639,7 @@ bool Monitor::ms_handle_fast_authentication(Connection *con)
66396639
entity_name_t(con->get_peer_type(), -1), // we don't know yet
66406640
con->get_peer_addrs(),
66416641
con);
6642-
assert(s);
6642+
ceph_assert(s);
66436643
dout(10) << __func__ << " adding session " << s << " to con " << con
66446644
<< dendl;
66456645
con->set_priv(s);

src/mon/OSDMonitor.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7796,8 +7796,8 @@ int OSDMonitor::prepare_pool_size(const unsigned pool_type,
77967796
*min_size =
77977797
erasure_code->get_data_chunk_count() +
77987798
std::min<int>(1, erasure_code->get_coding_chunk_count() - 1);
7799-
assert(*min_size <= *size);
7800-
assert(*min_size >= erasure_code->get_data_chunk_count());
7799+
ceph_assert(*min_size <= *size);
7800+
ceph_assert(*min_size >= erasure_code->get_data_chunk_count());
78017801
}
78027802
}
78037803
break;
@@ -8679,7 +8679,7 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap,
86798679
}
86808680
if (osdmap.require_osd_release < ceph_release_t::nautilus) {
86818681
// pre-nautilus osdmap format; increase pg_num directly
8682-
assert(n > (int)p.get_pg_num());
8682+
ceph_assert(n > (int)p.get_pg_num());
86838683
// force pre-nautilus clients to resend their ops, since they
86848684
// don't understand pg_num_target changes form a new interval
86858685
p.last_force_op_resend_prenautilus = pending_inc.epoch;

src/mon/PGMap.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void PGMapDigest::encode(bufferlist& bl, uint64_t features) const
5757
{
5858
// NOTE: see PGMap::encode_digest
5959
uint8_t v = 5;
60-
assert(HAVE_FEATURE(features, SERVER_NAUTILUS));
60+
ceph_assert(HAVE_FEATURE(features, SERVER_NAUTILUS));
6161
ENCODE_START(v, 1, bl);
6262
encode(num_pg, bl);
6363
encode(num_pg_active, bl);
@@ -84,7 +84,7 @@ void PGMapDigest::encode(bufferlist& bl, uint64_t features) const
8484
void PGMapDigest::decode(bufferlist::const_iterator& p)
8585
{
8686
DECODE_START(5, p);
87-
assert(struct_v >= 4);
87+
ceph_assert(struct_v >= 4);
8888
decode(num_pg, p);
8989
decode(num_pg_active, p);
9090
decode(num_pg_unknown, p);

src/mon/Paxos.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ void Paxos::handle_commit(MonOpRequestRef op)
979979
void Paxos::extend_lease()
980980
{
981981
ceph_assert(mon.is_leader());
982-
//assert(is_active());
982+
//ceph_assert(is_active());
983983

984984
lease_expire = ceph::real_clock::now();
985985
lease_expire += ceph::make_timespan(g_conf()->mon_lease);

src/os/bluestore/BitmapFreelistManager.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ int BitmapFreelistManager::create(uint64_t new_size, uint64_t granularity,
116116

117117
int BitmapFreelistManager::_expand(uint64_t old_size, KeyValueDB* db)
118118
{
119-
assert(old_size < size);
119+
ceph_assert(old_size < size);
120120
ceph_assert(std::has_single_bit(bytes_per_block));
121121

122122
KeyValueDB::Transaction txn;

src/os/bluestore/BlueFS.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@ int BlueFS::prepare_new_device(int id, const bluefs_layout_t& layout)
12081208
REMOVE_WAL,
12091209
layout);
12101210
} else {
1211-
assert(false);
1211+
ceph_assert(false);
12121212
}
12131213
return 0;
12141214
}
@@ -1411,7 +1411,7 @@ int BlueFS::_replay(bool noop, bool to_stdout)
14111411
if (r != (int)super.block_size && cct->_conf->bluefs_replay_recovery) {
14121412
r += _do_replay_recovery_read(log_reader, pos, read_pos + r, super.block_size - r, &bl);
14131413
}
1414-
assert(r == (int)super.block_size);
1414+
ceph_assert(r == (int)super.block_size);
14151415
read_pos += r;
14161416
}
14171417
uint64_t more = 0;
@@ -1948,7 +1948,7 @@ int BlueFS::device_migrate_to_existing(
19481948

19491949
dout(10) << __func__ << " devs_source " << devs_source
19501950
<< " dev_target " << dev_target << dendl;
1951-
assert(dev_target < (int)MAX_BDEV);
1951+
ceph_assert(dev_target < (int)MAX_BDEV);
19521952

19531953
int flags = 0;
19541954
flags |= devs_source.count(BDEV_DB) ?
@@ -2093,7 +2093,7 @@ int BlueFS::device_migrate_to_new(
20932093

20942094
dout(10) << __func__ << " devs_source " << devs_source
20952095
<< " dev_target " << dev_target << dendl;
2096-
assert(dev_target == (int)BDEV_NEWDB || dev_target == (int)BDEV_NEWWAL);
2096+
ceph_assert(dev_target == (int)BDEV_NEWDB || dev_target == (int)BDEV_NEWWAL);
20972097

20982098
int flags = 0;
20992099

0 commit comments

Comments
 (0)