// mount in read/write to sync expansion changes
r = _mount();
ceph_assert(r == 0);
- dout(5) << __func__ << "::NCB::calling umount()" << dendl;
umount();
} else {
_close_db_and_around();
auto was_per_pool_omap = per_pool_omap;
dout(1) << __func__ << " quick-fix on mount" << dendl;
- dout(5) << __func__ << "::NCB::calling fsck_on_open(FSCK_SHALLOW)" << dendl;
_fsck_on_open(FSCK_SHALLOW, true);
//reread statfs
int BlueStore::umount()
{
- dout(5) << __func__ << "::NCB::entered" << dendl;
ceph_assert(_kv_only || mounted);
_osr_drain_all();
_close_db_and_around();
if (cct->_conf->bluestore_fsck_on_umount) {
- dout(5) << __func__ << "::NCB::calling fsck()" << dendl;
int rc = fsck(cct->_conf->bluestore_fsck_on_umount_deep);
if (rc < 0)
return rc;
*/
int BlueStore::_fsck(BlueStore::FSCKDepth depth, bool repair)
{
- dout(5) << __func__ << "::NCB::depth=" << depth << ", repair="<< repair << dendl;
dout(5) << __func__
<< (repair ? " repair" : " check")
<< (depth == FSCK_DEEP ? " (deep)" :
// in deep mode we need R/W write access to be able to replay deferred ops
const bool read_only = !(repair || depth == FSCK_DEEP);
- dout(5) << __func__ << "::NCB::calling open_db_and_around()" << dendl;
int r = _open_db_and_around(read_only);
if (r < 0) {
return r;
int r = bluefs->get_block_extents(bluefs_layout.shared_bdev, &bluefs_extents);
ceph_assert(r == 0);
for (auto [start, len] : bluefs_extents) {
- //dout(0) << __func__ << "::NCB::BFS extent <"<< start << ", " << len << ">" << dendl;
apply_for_bitset_range(start, len, alloc_size, used_blocks,
[&](uint64_t pos, mempool_dynamic_bitset& bs) {
ceph_assert(pos < bs.size());
need, min_alloc_size, need,
0, &prealloc);
if (prealloc_left < 0 || prealloc_left < (int64_t)need) {
- dout(5) << __func__ << "::NCB::failed allocation of " << need << " bytes!! alloc=" << alloc << dendl;
derr << __func__ << " failed to allocate 0x" << std::hex << need
<< " allocated 0x " << (prealloc_left < 0 ? 0 : prealloc_left)
<< " min_alloc_size 0x" << min_alloc_size
if (prealloc.size()) {
alloc->release(prealloc);
}
- dout(5) << __func__ << "::NCB::(2)alloc=" << alloc << dendl;
return -ENOSPC;
}
_collect_allocation_stats(need, min_alloc_size, prealloc);
{
allocator_image_header header(timestamp, s_format_version, s_serial);
bufferlist header_bl;
- //dout(5) << " header = \n" << header << dendl;
encode(header, header_bl);
crc = header_bl.crc32c(crc);
encode(crc, header_bl);
ret = -1;
return;
}
- //dout(5) << "" << extent_count << "[" << extent_offset << "," << extent_length << "]" << dendl;
p_curr->offset = HTOCEPH_64(extent_offset);
p_curr->length = HTOCEPH_64(extent_length);
extent_count++;
if (p_curr == p_end) {
crc = flush_extent_buffer_with_crc(p_handle, (const char*)buffer, (const char*)p_curr, crc);
- //dout(5) << " extent_count=" << extent_count << ", crc=" << crc << dendl;
p_curr = buffer; // recycle the buffer
}
};
// if we got any leftovers -> add crc and append to file
if (p_curr > buffer) {
crc = flush_extent_buffer_with_crc(p_handle, (const char*)buffer, (const char*)p_curr, crc);
- //dout(5) << " extent_count=" << extent_count << ", crc=" << crc << dendl;
}
{
allocator_image_trailer trailer(timestamp, s_format_version, s_serial, extent_count, allocation_size);
bufferlist trailer_bl;
- //dout(5) << "trailer=\n" << trailer << dendl;
encode(trailer, trailer_bl);
uint32_t crc = -1;
crc = trailer_bl.crc32c(crc);
header_bl.claim_append(temp_bl);
auto p = header_bl.cbegin();
decode(header, p);
- //dout(5) << " header = \n" << header << dendl;
if (header.verify(cct, path) != 0 ) {
derr << "header = \n" << header << dendl;
return -1;
while (extents_bytes_left) {
int req_bytes = std::min(extents_bytes_left, sizeof(buffer));
int read_bytes = bluefs->read(p_handle.get(), offset, req_bytes, nullptr, (char*)buffer);
- //dout(5) << " bluefs->read()::read_bytes=" << read_bytes << ", req_bytes=" << req_bytes << dendl;
if (read_bytes != req_bytes) {
derr << "Failed bluefs->read()::read_bytes=" << read_bytes << ", req_bytes=" << req_bytes << dendl;
return -1;
}
- //dout(5) << "extents_bytes_left=" << extents_bytes_left << ", offset=" << offset << ", extent_count=" << extent_count << dendl;
offset += read_bytes;
extents_bytes_left -= read_bytes;
for (const extent_t *p_ext = buffer; p_ext < p_end; p_ext++) {
uint64_t offset = CEPHTOH_64(p_ext->offset);
uint64_t length = CEPHTOH_64(p_ext->length);
- //dout(5) << "" << extent_count << "::[" << offset << "," << length << "]" << dendl;
read_alloc_size += length;
if (length > 0) {
uint32_t calc_crc = ceph_crc32c(crc, (const uint8_t*)buffer, read_bytes);
read_bytes = bluefs->read(p_handle.get(), offset, sizeof(crc), nullptr, (char*)&crc);
- //dout(5) << "read-crc::read_bytes=" << read_bytes << ", offset=" << offset << dendl;
if (read_bytes == sizeof(crc) ) {
crc = CEPHTOH_32(crc);
if (crc != calc_crc) {
return ret;
}
for (auto itr = bluefs_extents.begin(); itr != bluefs_extents.end(); extent_count++, itr++) {
- //dout(5) << "BlueFS[" << extent_count << "] <" << itr.get_start() << "," << itr.get_len() << ">" << dendl;
allocator->init_rm_free(itr.get_start(), itr.get_len());
stats.extent_count++;
}
dout(5) << "test_store_and_restore=" << test_store_and_restore << dendl;
int ret = 0;
uint64_t memory_target = cct->_conf.get_val<Option::size_t>("osd_memory_target");
- dout(5) << "calling open_db_and_around()" << dendl;
ret = _open_db_and_around(true, false);
if (ret < 0) {
return ret;
}
uint64_t num_entries = 0;
- dout(5) << "calling copy_allocator(alloc -> bitmap_allocator)" << dendl;
copy_allocator(src_allocator, allocator, &num_entries);
// BlueFS stores its internal allocation outside RocksDB (FM) so we should not destage them to the allcoator-file