From 18ca806c2be7fcae9fbff1fa9f2990cb2b769d0b Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 12 Aug 2016 16:05:12 -0400 Subject: [PATCH] os/bluestore/BlueFS: use hex Signed-off-by: Sage Weil --- src/os/bluestore/BlueFS.cc | 31 +++++++++++++++++-------------- src/os/bluestore/bluefs_types.cc | 17 +++++++++-------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 835b76063fd..5fab4550efe 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -979,8 +979,8 @@ bool BlueFS::_should_compact_log() uint64_t current = log_writer->file->fnode.size; uint64_t expected = _estimate_log_size(); float ratio = (float)current / (float)expected; - dout(10) << __func__ << " current " << current - << " expected " << expected + dout(10) << __func__ << " current 0x" << std::hex << current + << " expected " << expected << std::dec << " ratio " << ratio << dendl; if (current < g_conf->bluefs_log_compact_min_size || ratio < g_conf->bluefs_log_compact_min_ratio) @@ -1082,8 +1082,8 @@ void BlueFS::_pad_bl(bufferlist& bl) { uint64_t partial = bl.length() % super.block_size; if (partial) { - dout(10) << __func__ << " padding with " << super.block_size - partial - << " zeros" << dendl; + dout(10) << __func__ << " padding with 0x" << std::hex + << super.block_size - partial << " zeros" << std::dec << dendl; bl.append_zero(super.block_size - partial); } } @@ -1116,8 +1116,8 @@ int BlueFS::_flush_and_sync_log(std::unique_lock& l, // allocate some more space (before we run out)? uint64_t runway = log_writer->file->fnode.get_allocated() - log_writer->pos; if (runway < g_conf->bluefs_min_log_runway) { - dout(10) << __func__ << " allocating more log runway (" - << runway << " remaining" << dendl; + dout(10) << __func__ << " allocating more log runway (0x" + << std::hex << runway << std::dec << " remaining)" << dendl; int r = _allocate(log_writer->file->fnode.prefer_bdev, g_conf->bluefs_max_log_runway, &log_writer->file->fnode.extents); @@ -1432,7 +1432,7 @@ void BlueFS::flush_bdev() int BlueFS::_allocate(uint8_t id, uint64_t len, vector *ev) { dout(10) << __func__ << " len 0x" << std::hex << len << std::dec - << " from " << id << dendl; + << " from " << (int)id << dendl; assert(id < alloc.size()); uint64_t min_alloc_size = g_conf->bluefs_alloc_size; @@ -1444,17 +1444,20 @@ int BlueFS::_allocate(uint8_t id, uint64_t len, vector *ev) if (r < 0) { if (id != BDEV_SLOW) { if (bdev[id]) - derr << __func__ << " failed to allocate " << left << " on bdev " << id - << ", free " << alloc[id]->get_free() - << "; fallback to bdev " << id + 1 << dendl; + derr << __func__ << " failed to allocate 0x" << std::hex << left + << " on bdev " << (int)id + << ", free 0x" << alloc[id]->get_free() + << "; fallback to bdev " << (int)id + 1 + << std::dec << dendl; return _allocate(id + 1, len, ev); } if (bdev[id]) - derr << __func__ << " failed to allocate " << left << " on bdev " << id - << ", free " << alloc[id]->get_free() << dendl; + derr << __func__ << " failed to allocate 0x" << std::hex << left + << " on bdev " << (int)id + << ", free 0x" << alloc[id]->get_free() << std::dec << dendl; else - derr << __func__ << " failed to allocate " << left << " on bdev " << id - << ", dne" << dendl; + derr << __func__ << " failed to allocate 0x" << std::hex << left + << " on bdev " << (int)id << ", dne" << std::dec << dendl; return r; } diff --git a/src/os/bluestore/bluefs_types.cc b/src/os/bluestore/bluefs_types.cc index 5540a79ed51..bba6506ce95 100644 --- a/src/os/bluestore/bluefs_types.cc +++ b/src/os/bluestore/bluefs_types.cc @@ -45,7 +45,8 @@ void bluefs_extent_t::generate_test_instances(list& ls) ostream& operator<<(ostream& out, bluefs_extent_t e) { - return out << (int)e.bdev << ":" << e.offset << "+" << e.length; + return out << (int)e.bdev << ":0x" << std::hex << e.offset << "+" << e.length + << std::dec; } // bluefs_super_t @@ -94,9 +95,9 @@ ostream& operator<<(ostream& out, const bluefs_super_t& s) return out << "super(uuid " << s.uuid << " osd " << s.osd_uuid << " v " << s.version - << " block_size " << s.block_size - << " log_fnode " << s.log_fnode - << ")"; + << " block_size 0x" << std::hex << s.block_size + << " log_fnode 0x" << s.log_fnode + << std::dec << ")"; } // bluefs_fnode_t @@ -165,7 +166,7 @@ void bluefs_fnode_t::generate_test_instances(list& ls) ostream& operator<<(ostream& out, const bluefs_fnode_t& file) { return out << "file(ino " << file.ino - << " size " << file.size + << " size 0x" << std::hex << file.size << std::dec << " mtime " << file.mtime << " bdev " << (int)file.prefer_bdev << " extents " << file.extents @@ -231,7 +232,7 @@ void bluefs_transaction_t::generate_test_instance( ostream& operator<<(ostream& out, const bluefs_transaction_t& t) { return out << "txn(seq " << t.seq - << " len " << t.op_bl.length() - << " crc " << t.op_bl.crc32c(-1) - << ")"; + << " len 0x" << std::hex << t.op_bl.length() + << " crc 0x" << t.op_bl.crc32c(-1) + << std::dec << ")"; } -- 2.39.5