Skip to content

Commit 22025a6

Browse files
committed
os: s/assert/ceph_assert/g'
Now that we fallback to RelDebWithInfo [1], C asserts are not compiled in. Replace some of the existing asserts with ceph_assserts instead. [1] ceph#61637 Fixes: https://tracker.ceph.com/issues/71360 Signed-off-by: Matan Breizman <[email protected]>
1 parent f0028be commit 22025a6

File tree

8 files changed

+17
-17
lines changed

8 files changed

+17
-17
lines changed

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

src/os/bluestore/BlueRocksEnv.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ std::pair<std::string_view, std::string_view>
3636
split(const std::string &fn)
3737
{
3838
size_t slash = fn.rfind('/');
39-
assert(slash != fn.npos);
39+
ceph_assert(slash != fn.npos);
4040
size_t file_begin = slash + 1;
4141
while (slash && fn[slash - 1] == '/')
4242
--slash;

src/os/bluestore/BlueStore.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,7 @@ struct LruBufferCacheShard : public BlueStore::BufferCacheShard {
12501250
void _rm(BlueStore::Buffer *b) override {
12511251
ceph_assert(buffer_bytes >= b->length);
12521252
buffer_bytes -= b->length;
1253-
assert(*(b->cache_age_bin) >= b->length);
1253+
ceph_assert(*(b->cache_age_bin) >= b->length);
12541254
*(b->cache_age_bin) -= b->length;
12551255
auto q = lru.iterator_to(*b);
12561256
lru.erase(q);
@@ -1263,7 +1263,7 @@ struct LruBufferCacheShard : public BlueStore::BufferCacheShard {
12631263
void _adjust_size(BlueStore::Buffer *b, int64_t delta) override {
12641264
ceph_assert((int64_t)buffer_bytes + delta >= 0);
12651265
buffer_bytes += delta;
1266-
assert(*(b->cache_age_bin) + delta >= 0);
1266+
ceph_assert(*(b->cache_age_bin) + delta >= 0);
12671267
*(b->cache_age_bin) += delta;
12681268
}
12691269
void _touch(BlueStore::Buffer *b) override {
@@ -1289,7 +1289,7 @@ struct LruBufferCacheShard : public BlueStore::BufferCacheShard {
12891289
BlueStore::Buffer *b = &*i;
12901290
ceph_assert(b->is_clean());
12911291
dout(20) << __func__ << " rm " << *b << dendl;
1292-
assert(*(b->cache_age_bin) >= b->length);
1292+
ceph_assert(*(b->cache_age_bin) >= b->length);
12931293
*(b->cache_age_bin) -= b->length;
12941294
b->space->_rm_buffer(this, b);
12951295
}
@@ -1424,7 +1424,7 @@ struct TwoQBufferCacheShard : public BlueStore::BufferCacheShard {
14241424
buffer_bytes -= b->length;
14251425
ceph_assert(list_bytes[b->cache_private] >= b->length);
14261426
list_bytes[b->cache_private] -= b->length;
1427-
assert(*(b->cache_age_bin) >= b->length);
1427+
ceph_assert(*(b->cache_age_bin) >= b->length);
14281428
*(b->cache_age_bin) -= b->length;
14291429
}
14301430
switch (b->cache_private) {
@@ -1481,7 +1481,7 @@ struct TwoQBufferCacheShard : public BlueStore::BufferCacheShard {
14811481
buffer_bytes += delta;
14821482
ceph_assert((int64_t)list_bytes[b->cache_private] + delta >= 0);
14831483
list_bytes[b->cache_private] += delta;
1484-
assert(*(b->cache_age_bin) + delta >= 0);
1484+
ceph_assert(*(b->cache_age_bin) + delta >= 0);
14851485
*(b->cache_age_bin) += delta;
14861486
}
14871487
}
@@ -1551,7 +1551,7 @@ struct TwoQBufferCacheShard : public BlueStore::BufferCacheShard {
15511551
buffer_bytes -= b->length;
15521552
ceph_assert(list_bytes[BUFFER_WARM_IN] >= b->length);
15531553
list_bytes[BUFFER_WARM_IN] -= b->length;
1554-
assert(*(b->cache_age_bin) >= b->length);
1554+
ceph_assert(*(b->cache_age_bin) >= b->length);
15551555
*(b->cache_age_bin) -= b->length;
15561556
to_evict_bytes -= b->length;
15571557
evicted += b->length;

src/os/bluestore/BtreeAllocator.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ int64_t BtreeAllocator::_allocate(
241241
extents->emplace_back(offset, length);
242242
allocated += length;
243243
}
244-
assert(range_size_tree.size() == range_tree.size());
244+
ceph_assert(range_size_tree.size() == range_tree.size());
245245
return allocated ? allocated : -ENOSPC;
246246
}
247247

src/os/bluestore/bluefs_types.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ mempool::bluefs::vector<bluefs_extent_t>::iterator bluefs_fnode_t::seek(
251251
if (extents_index.size() > 4) {
252252
auto it = std::upper_bound(extents_index.begin(), extents_index.end(),
253253
offset);
254-
assert(it != extents_index.begin());
254+
ceph_assert(it != extents_index.begin());
255255
--it;
256-
assert(offset >= *it);
256+
ceph_assert(offset >= *it);
257257
uint32_t skip = it - extents_index.begin();
258258
ceph_assert(skip <= extents.size());
259259
p += skip;

src/os/bluestore/bluestore_types.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,7 @@ bool bluestore_blob_t::release_extents(bool all,
10921092
++pext_it;
10931093
}
10941094
else {
1095-
//assert(pext_loffs == pext_loffs_start);
1095+
//ceph_assert(pext_loffs == pext_loffs_start);
10961096
int delta0 = pext_loffs - pext_loffs_start;
10971097
ceph_assert(delta0 >= 0);
10981098

src/os/bluestore/fastbmap_allocator_impl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ void AllocatorLevel01Loose::foreach_internal(
593593
if (p < bits_per_slot) {
594594
//now @p are 1s
595595
ssize_t free_count = count_1s(allocation_pattern, p);
596-
assert(free_count > 0);
596+
ceph_assert(free_count > 0);
597597
len = free_count;
598598
off = (pos + t) * bits_per_slot + p;
599599
p += free_count;

0 commit comments

Comments
 (0)