MCPcopy Create free account
hub / github.com/ceph/ceph / decode_data

Method decode_data

src/common/bit_vector.hpp:356–396  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

354
355template <uint8_t _b>
356void BitVector<_b>::decode_data(bufferlist::const_iterator& it,
357 uint64_t data_byte_offset) {
358 ceph_assert(data_byte_offset % BLOCK_SIZE == 0);
359 if (it.end()) {
360 return;
361 }
362
363 uint64_t end_offset = data_byte_offset + it.get_remaining();
364 if (end_offset > m_data.length()) {
365 throw buffer::end_of_buffer();
366 }
367
368 bufferlist data;
369 if (data_byte_offset > 0) {
370 data.substr_of(m_data, 0, data_byte_offset);
371 }
372
373 while (data_byte_offset < end_offset) {
374 uint64_t len = std::min<uint64_t>(BLOCK_SIZE, end_offset - data_byte_offset);
375
376 bufferptr ptr;
377 it.copy_deep(len, ptr);
378
379 bufferlist bit;
380 bit.append(ptr);
381 if (m_crc_enabled &&
382 m_data_crcs[data_byte_offset / BLOCK_SIZE].val != bit.crc32c(0)) {
383 throw buffer::malformed_input("invalid data block CRC");
384 }
385 data.append(bit);
386 data_byte_offset += bit.length();
387 }
388
389 if (m_data.length() > end_offset) {
390 bufferlist tail;
391 tail.substr_of(m_data, end_offset, m_data.length() - end_offset);
392 data.append(tail);
393 }
394 ceph_assert(data.length() == m_data.length());
395 data.swap(m_data);
396}
397
398template <uint8_t _b>
399void BitVector<_b>::get_data_extents(uint64_t offset, uint64_t length,

Callers 2

object_map_updateFunction · 0.80
TYPED_TESTFunction · 0.80

Calls 9

copy_deepMethod · 0.80
crc32cMethod · 0.80
end_of_bufferClass · 0.70
malformed_inputClass · 0.70
endMethod · 0.45
lengthMethod · 0.45
substr_ofMethod · 0.45
appendMethod · 0.45
swapMethod · 0.45

Tested by 1

TYPED_TESTFunction · 0.64