From: Sage Weil Date: Tue, 7 Jun 2016 21:38:36 +0000 (-0400) Subject: os/bluestore: use _dump_blob_map helper X-Git-Tag: v11.0.0~151^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b7168d983cefa6eb3cd6f47fb1943cf2c562775e;p=ceph.git os/bluestore: use _dump_blob_map helper Unify bnode and onode dump output. Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 998b3375436e..349fb1aa1d76 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -5490,27 +5490,7 @@ void BlueStore::_dump_onode(OnodeRef o, int log_level) dout(log_level) << __func__ << " overlay_refs " << o->onode.overlay_refs << dendl; } - for (auto& b : o->blob_map.blob_map) { - dout(log_level) << __func__ << " " << b.id << ": " << b.blob - << dendl; - if (b.blob.has_csum_data()) { - vector v; - unsigned n = b.blob.get_csum_count(); - for (unsigned i = 0; i < n; ++i) - v.push_back(b.blob.get_csum_item(i)); - dout(log_level) << __func__ << " csum: " << std::hex << v << std::dec - << dendl; - if (!b.bc.empty()) { - for (auto& i : b.bc.buffer_map) { - dout(log_level) << __func__ << " 0x" << std::hex << i.first - << "~" << i.second->length << std::dec - << " seq " << i.second->seq - << " " << Buffer::get_state_name(i.second->state) - << dendl; - } - } - } - } + _dump_blob_map(o->blob_map, log_level); if (o->bnode) { _dump_bnode(o->bnode, log_level); } @@ -5522,16 +5502,28 @@ void BlueStore::_dump_bnode(BnodeRef b, int log_level) return; dout(log_level) << __func__ << " " << b << " " << std::hex << b->hash << std::dec << dendl; - for (auto &p : b->blob_map.blob_map) { - dout(log_level) << __func__ << " " << p.id << ": " << p.blob << dendl; - if (p.blob.has_csum_data()) { + _dump_blob_map(b->blob_map, log_level); +} + +void BlueStore::_dump_blob_map(BlobMap &bm, int log_level) +{ + for (auto& b : bm.blob_map) { + dout(log_level) << __func__ << " " << b << dendl; + if (b.blob.has_csum_data()) { vector v; - unsigned n = p.blob.get_csum_count(); + unsigned n = b.blob.get_csum_count(); for (unsigned i = 0; i < n; ++i) - v.push_back(p.blob.get_csum_item(i)); + v.push_back(b.blob.get_csum_item(i)); dout(log_level) << __func__ << " csum: " << std::hex << v << std::dec << dendl; } + if (!b.bc.empty()) { + for (auto& i : b.bc.buffer_map) { + dout(log_level) << __func__ << " 0x" << std::hex << i.first + << "~" << i.second->length << std::dec + << " " << *i.second << dendl; + } + } } } diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 385c942dbfd5..01b80e369c1b 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -96,6 +96,11 @@ public: : logical_offset(from.logical_offset), blob_xoffset(from.blob_xoffset), length(from.length) {} + + friend ostream& operator<<(ostream& out, const region_t& r) { + return out << "0x" << std::hex << r.logical_offset << ":" + << r.blob_xoffset << "~" << r.length << std::dec; + } }; typedef list regions2read_t; typedef map blobs2read_t; @@ -1071,6 +1076,8 @@ private: void _dump_onode(OnodeRef o, int log_level=30); void _dump_bnode(BnodeRef b, int log_level=30); + void _dump_blob_map(BlobMap &bm, int log_level); + TransContext *_txc_create(OpSequencer *osr); void _txc_update_store_statfs(TransContext *txc);