[thin_journal_check] Checks journal of block manager activity.

You need to apply doc/bm-journal.patch to create the journal.

thin_journal_check confirms that if the machine had crashed at any time
during the test run no metadata corruption would have occured.
This commit is contained in:
Joe Thornber
2018-09-24 14:51:46 +01:00
parent 70cdfe12a2
commit de7c9a5781
6 changed files with 1761 additions and 94 deletions

View File

@@ -27,8 +27,8 @@
namespace thin_provisioning {
uint32_t const JOURNAL_BLOCK_SIZE = 256 * 1024;
uint32_t const JOURNAL_NR_CHUNKS = 32;
uint32_t const JOURNAL_CHUNK_SIZE = 4096 / JOURNAL_NR_CHUNKS;
uint32_t const JOURNAL_CHUNK_SIZE = 32;
uint32_t const JOURNAL_NR_CHUNKS = (4096 / JOURNAL_CHUNK_SIZE);
class byte_stream {
public:
@@ -59,6 +59,17 @@ namespace thin_provisioning {
bool success_;
};
struct open_journal_msg : public journal_msg {
open_journal_msg(uint64_t nr_metadata_blocks);
virtual void visit(journal_visitor &v) const;
uint64_t nr_metadata_blocks_;
};
struct close_journal_msg : public journal_msg {
close_journal_msg();
virtual void visit(journal_visitor &v) const;
};
struct block_msg : public journal_msg {
block_msg(bool success, uint64_t index);
uint64_t index_;
@@ -148,6 +159,8 @@ namespace thin_provisioning {
msg.visit(*this);
}
virtual void visit(open_journal_msg const &msg) = 0;
virtual void visit(close_journal_msg const &msg) = 0;
virtual void visit(read_lock_msg const &msg) = 0;
virtual void visit(write_lock_msg const &msg) = 0;
virtual void visit(zero_lock_msg const &msg) = 0;
@@ -163,7 +176,10 @@ namespace thin_provisioning {
};
enum msg_type {
MT_READ_LOCK = 0,
MT_OPEN_JOURNAL,
MT_CLOSE_JOURNAL,
MT_READ_LOCK,
MT_WRITE_LOCK,
MT_ZERO_LOCK,
MT_TRY_READ_LOCK,
@@ -175,7 +191,6 @@ namespace thin_provisioning {
MT_PREFETCH,
MT_SET_READ_ONLY,
MT_SET_READ_WRITE,
MT_END_OF_JOURNAL,
};
class journal {