[btree] bad checksum exceptions now mention the block location
This commit is contained in:
parent
7134a58134
commit
b67cc29609
@ -38,11 +38,17 @@ namespace {
|
|||||||
node_header const *n = &data->header;
|
node_header const *n = &data->header;
|
||||||
crc32c sum(BTREE_CSUM_XOR);
|
crc32c sum(BTREE_CSUM_XOR);
|
||||||
sum.append(&n->flags, MD_BLOCK_SIZE - sizeof(uint32_t));
|
sum.append(&n->flags, MD_BLOCK_SIZE - sizeof(uint32_t));
|
||||||
if (sum.get_sum() != to_cpu<uint32_t>(n->csum))
|
if (sum.get_sum() != to_cpu<uint32_t>(n->csum)) {
|
||||||
throw checksum_error("bad checksum in btree node");
|
std::ostringstream out;
|
||||||
|
out << "bad checksum in btree node (block " << location << ")";
|
||||||
|
throw checksum_error(out.str());
|
||||||
|
}
|
||||||
|
|
||||||
if (to_cpu<uint64_t>(n->blocknr) != location)
|
if (to_cpu<uint64_t>(n->blocknr) != location) {
|
||||||
throw checksum_error("bad block nr in btree node");
|
std::ostringstream out;
|
||||||
|
out << "bad block nr in btree node (block = " << location << ")";
|
||||||
|
throw checksum_error(out.str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void prepare(void *raw, block_address location) const {
|
virtual void prepare(void *raw, block_address location) const {
|
||||||
|
Loading…
Reference in New Issue
Block a user