[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);
|
bitmap_header const *data = reinterpret_cast<bitmap_header const *>(raw);
|
||||||
crc32c sum(BITMAP_CSUM_XOR);
|
crc32c sum(BITMAP_CSUM_XOR);
|
||||||
sum.append(&data->not_used, MD_BLOCK_SIZE - sizeof(uint32_t));
|
sum.append(&data->not_used, MD_BLOCK_SIZE - sizeof(uint32_t));
|
||||||
if (sum.get_sum() != to_cpu<uint32_t>(data->csum))
|
if (sum.get_sum() != to_cpu<uint32_t>(data->csum)) {
|
||||||
throw checksum_error("bad checksum in space map bitmap");
|
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)
|
if (to_cpu<uint64_t>(data->blocknr) != location) {
|
||||||
throw checksum_error("bad block nr in space map bitmap");
|
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 {
|
virtual bool check_raw(void const *raw) const {
|
||||||
@ -77,11 +85,19 @@ namespace {
|
|||||||
metadata_index const *mi = reinterpret_cast<metadata_index const *>(raw);
|
metadata_index const *mi = reinterpret_cast<metadata_index const *>(raw);
|
||||||
crc32c sum(INDEX_CSUM_XOR);
|
crc32c sum(INDEX_CSUM_XOR);
|
||||||
sum.append(&mi->padding_, MD_BLOCK_SIZE - sizeof(uint32_t));
|
sum.append(&mi->padding_, MD_BLOCK_SIZE - sizeof(uint32_t));
|
||||||
if (sum.get_sum() != to_cpu<uint32_t>(mi->csum_))
|
if (sum.get_sum() != to_cpu<uint32_t>(mi->csum_)) {
|
||||||
throw checksum_error("bad checksum in metadata index block");
|
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)
|
if (to_cpu<uint64_t>(mi->blocknr_) != location) {
|
||||||
throw checksum_error("bad block nr in metadata index block");
|
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 {
|
virtual bool check_raw(void const *raw) const {
|
||||||
|
Loading…
Reference in New Issue
Block a user