From 41dddddbf286f7a1a4cb501ea140103f7b0a7c08 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sat, 7 Mar 2020 03:39:28 +0300 Subject: [PATCH] Fix some logging --- blockstore_flush.cpp | 2 +- blockstore_journal.cpp | 4 ++-- blockstore_write.cpp | 5 ++++- dump_journal.cpp | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/blockstore_flush.cpp b/blockstore_flush.cpp index c741aef6..d3bb1462 100644 --- a/blockstore_flush.cpp +++ b/blockstore_flush.cpp @@ -331,7 +331,7 @@ resume_1: else { clean_disk_entry *new_entry = (clean_disk_entry*)(meta_new.buf + meta_new.pos*bs->clean_entry_size); - assert(new_entry->oid.inode == 0); + assert(new_entry->oid.inode == 0 || new_entry->oid == cur.oid); new_entry->oid = cur.oid; new_entry->version = cur.version; if (!bs->inmemory_meta) diff --git a/blockstore_journal.cpp b/blockstore_journal.cpp index 0d095074..d962fd10 100644 --- a/blockstore_journal.cpp +++ b/blockstore_journal.cpp @@ -148,7 +148,7 @@ bool journal_t::trim() auto journal_used_it = used_sectors.lower_bound(used_start); #ifdef BLOCKSTORE_DEBUG printf( - "Trimming journal (used_start=%lu, next_free=%lu, first_used=%lu, usage_count=%lu)\n", + "Trimming journal (used_start=%08lx, next_free=%08lx, first_used=%08lx, usage_count=%08lx)\n", used_start, next_free, journal_used_it == used_sectors.end() ? 0 : journal_used_it->first, journal_used_it == used_sectors.end() ? 0 : journal_used_it->second @@ -180,7 +180,7 @@ bool journal_t::trim() return false; } #ifdef BLOCKSTORE_DEBUG - printf("Journal trimmed to %lu (next_free=%lu)\n", used_start, next_free); + printf("Journal trimmed to %08lx (next_free=%08lx)\n", used_start, next_free); #endif return true; } diff --git a/blockstore_write.cpp b/blockstore_write.cpp index 0270f0b7..0251572c 100644 --- a/blockstore_write.cpp +++ b/blockstore_write.cpp @@ -49,7 +49,10 @@ bool blockstore_impl_t::enqueue_write(blockstore_op_t *op) } // Immediately add the operation into dirty_db, so subsequent reads could see it #ifdef BLOCKSTORE_DEBUG - printf("%s %lu:%lu v%lu\n", is_del ? "Delete" : "Write", op->oid.inode, op->oid.stripe, op->version); + if (is_del) + printf("Delete %lu:%lu v%lu\n", op->oid.inode, op->oid.stripe, op->version); + else + printf("Write %lu:%lu v%lu offset=%u len=%u\n", op->oid.inode, op->oid.stripe, op->version, op->offset, op->len); #endif dirty_db.emplace((obj_ver_id){ .oid = op->oid, diff --git a/dump_journal.cpp b/dump_journal.cpp index 230a282f..bb266094 100644 --- a/dump_journal.cpp +++ b/dump_journal.cpp @@ -76,7 +76,7 @@ int main(int argc, char *argv[]) } else { - printf("offset %08lx: no magic in the beginning, looks like random data\n", self.journal_pos); + printf("offset %08lx: no magic in the beginning, looks like random data (pattern=%lx)\n", self.journal_pos, *((uint64_t*)data)); self.journal_pos += self.journal_block; } }