diff --git a/persistent-data/space-maps/disk.cc b/persistent-data/space-maps/disk.cc index 614a38d..6e6fc71 100644 --- a/persistent-data/space-maps/disk.cc +++ b/persistent-data/space-maps/disk.cc @@ -43,11 +43,19 @@ namespace { bitmap_header const *data = reinterpret_cast(raw); crc32c sum(BITMAP_CSUM_XOR); sum.append(&data->not_used, MD_BLOCK_SIZE - sizeof(uint32_t)); - if (sum.get_sum() != to_cpu(data->csum)) - throw checksum_error("bad checksum in space map bitmap"); + if (sum.get_sum() != to_cpu(data->csum)) { + std::ostringstream out; + out << "bad checksum in space map bitmap (block " + << location << ")"; + throw checksum_error(out.str()); + } - if (to_cpu(data->blocknr) != location) - throw checksum_error("bad block nr in space map bitmap"); + if (to_cpu(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(raw); crc32c sum(INDEX_CSUM_XOR); sum.append(&mi->padding_, MD_BLOCK_SIZE - sizeof(uint32_t)); - if (sum.get_sum() != to_cpu(mi->csum_)) - throw checksum_error("bad checksum in metadata index block"); + if (sum.get_sum() != to_cpu(mi->csum_)) { + std::ostringstream out; + out << "bad checksum in metadata index block (block " + << location << ")"; + throw checksum_error(out.str()); + } - if (to_cpu(mi->blocknr_) != location) - throw checksum_error("bad block nr in metadata index block"); + if (to_cpu(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 {