}
}
+std::ostream& operator<<(std::ostream& out, const BlueStore::Onode::printer &p)
+{
+ using P = BlueStore::printer;
+ const BlueStore::Onode& o = p.onode;
+ uint16_t mode = p.mode;
+ out << &o << " " << o.oid
+ << " nid " << o.onode.nid
+ << " size 0x" << std::hex << o.onode.size
+ << " (" << std::dec << o.onode.size << ")"
+ << " expected_object_size " << o.onode.expected_object_size
+ << " expected_write_size " << o.onode.expected_write_size
+ << " in " << o.onode.extent_map_shards.size() << " shards"
+ << ", " << o.extent_map.spanning_blob_map.size()
+ << " spanning blobs" << std::endl;
+ const BlueStore::ExtentMap& map = o.extent_map;
+ std::set<BlueStore::Blob*> visited;
+ for (const auto& e : map.extent_map) {
+ BlueStore::Blob* b = e.blob.get();
+ if (!visited.contains(b)) {
+ out << b->print(mode) << std::endl;
+ visited.insert(b);
+ }
+ }
+ // to make printing extents in-sync with blobs
+ bool mode_extent = mode & (P::ptr | P::nick);
+ for (const auto& e : map.extent_map) {
+ out << e.print(mode_extent) << std::endl;
+ }
+ if (mode & P::attrs) {
+ for (const auto& p : o.onode.attrs) {
+ out << " attr " << p.first
+ << " len " << p.second.length() << std::endl;
+ }
+ }
+ return out;
+}
+
template <int LogLevelV>
void _dump_transaction(CephContext *cct, ObjectStore::Transaction *t)
{
static constexpr uint16_t schk = 128; // only base checksum info
static constexpr uint16_t buf = 256; // print Blob's buffers (takes cache lock)
static constexpr uint16_t sbuf = 512; // short print Blob's buffers (takes cache lock)
+ static constexpr uint16_t attrs = 1024; // print attrs in onode
};
/// cached buffer
void decode_omap_key(const std::string& key, std::string *user_key);
void finish_write(TransContext* txc, uint32_t offset, uint32_t length);
+
+ struct printer : public BlueStore::printer {
+ const Onode& onode;
+ uint16_t mode;
+ printer(const Onode& onode, uint16_t mode)
+ :onode(onode), mode(mode) {}
+ };
+ friend std::ostream& operator<<(std::ostream& out, const printer &p);
+ printer print(uint16_t mode) const {
+ return printer(*this, mode);
+ }
};
/// A generic Cache Shard