[space-maps/disk] Show the block address in exception string
This commit is contained in:
parent
1cfdcd58c5
commit
0349e9c9e2
@ -43,11 +43,19 @@ namespace {
|
||||
bitmap_header const *data = reinterpret_cast<bitmap_header const *>(raw);
|
||||
crc32c sum(BITMAP_CSUM_XOR);
|
||||
sum.append(&data->not_used, MD_BLOCK_SIZE - sizeof(uint32_t));
|
||||
if (sum.get_sum() != to_cpu<uint32_t>(data->csum))
|
||||
throw checksum_error("bad checksum in space map bitmap");
|
||||
if (sum.get_sum() != to_cpu<uint32_t>(data->csum)) {
|
||||
std::ostringstream out;
|
||||
out << "bad checksum in space map bitmap (block "
|
||||
<< location << ")";
|
||||
throw checksum_error(out.str());
|
||||
}
|
||||
|
||||
if (to_cpu<uint64_t>(data->blocknr) != location)
|
||||
throw checksum_error("bad block nr in space map bitmap");
|
||||
if (to_cpu<uint64_t>(data->blocknr) != location) {
|
||||
std::ostringstream out;
|
||||
out << "bad block nr in space map bitmap (block "
|
||||
<< location << ")";
|
||||
throw checksum_error(out.str());
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool check_raw(void const *raw) const {
|
||||
@ -77,11 +85,19 @@ namespace {
|
||||
metadata_index const *mi = reinterpret_cast<metadata_index const *>(raw);
|
||||
crc32c sum(INDEX_CSUM_XOR);
|
||||
sum.append(&mi->padding_, MD_BLOCK_SIZE - sizeof(uint32_t));
|
||||
if (sum.get_sum() != to_cpu<uint32_t>(mi->csum_))
|
||||
throw checksum_error("bad checksum in metadata index block");
|
||||
if (sum.get_sum() != to_cpu<uint32_t>(mi->csum_)) {
|
||||
std::ostringstream out;
|
||||
out << "bad checksum in metadata index block (block "
|
||||
<< location << ")";
|
||||
throw checksum_error(out.str());
|
||||
}
|
||||
|
||||
if (to_cpu<uint64_t>(mi->blocknr_) != location)
|
||||
throw checksum_error("bad block nr in metadata index block");
|
||||
if (to_cpu<uint64_t>(mi->blocknr_) != location) {
|
||||
std::ostringstream out;
|
||||
out << "bad block nr in metadata index block (block "
|
||||
<< location << ")";
|
||||
throw checksum_error(out.str());
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool check_raw(void const *raw) const {
|
||||
|
Loading…
Reference in New Issue
Block a user