virtual int fiemap(CollectionHandle& c, const ghobject_t& oid,
uint64_t offset, size_t len, std::map<uint64_t, uint64_t>& destmap) = 0;
+ /**
+ * dump_onode -- dumps onode metadata in human readable form,
+ intended primiarily for debugging
+ *
+ * @param cid collection for object
+ * @param oid oid of object
+ * @param section_name section name to create and print under
+ * @param f Formatter class instance to print to
+ * @returns 0 on success, negative error code on failure.
+ */
+ virtual int dump_onode(
+ CollectionHandle &c,
+ const ghobject_t& oid,
+ const string& section_name,
+ Formatter *f) {
+ return -ENOTSUP;
+ }
+
/**
* getattr -- get an xattr of an object
*
#undef dout_prefix
#define dout_prefix *_dout << "bluestore.sharedblob(" << this << ") "
+void BlueStore::SharedBlob::dump(Formatter* f) const
+{
+ f->dump_bool("loaded", loaded);
+ if (loaded) {
+ persistent->dump(f);
+ } else {
+ f->dump_unsigned("sbid_unloaded", sbid_unloaded);
+ }
+}
+
ostream& operator<<(ostream& out, const BlueStore::SharedBlob& sb)
{
out << "SharedBlob(" << &sb;
#undef dout_prefix
#define dout_prefix *_dout << "bluestore.blob(" << this << ") "
+void BlueStore::Blob::dump(Formatter* f) const
+{
+ if (is_spanning()) {
+ f->dump_unsigned("spanning_id ", id);
+ }
+ blob.dump(f);
+ if (shared_blob) {
+ f->dump_object("shared", *shared_blob);
+ }
+}
+
ostream& operator<<(ostream& out, const BlueStore::Blob& b)
{
out << "Blob(" << &b;
// Extent
+void BlueStore::Extent::dump(Formatter* f) const
+{
+ f->dump_unsigned("logical_offset", logical_offset);
+ f->dump_unsigned("length", length);
+ f->dump_unsigned("blob_offset", blob_offset);
+ f->dump_object("blob", *blob);
+}
+
ostream& operator<<(ostream& out, const BlueStore::Extent& e)
{
return out << std::hex << "0x" << e.logical_offset << "~" << e.length
o->c->store->cct->_conf->bluestore_extent_map_inline_shard_prealloc_size) {
}
+void BlueStore::ExtentMap::dump(Formatter* f) const
+{
+ f->open_array_section("extents");
+
+ for (auto& e : extent_map) {
+ f->dump_object("extent", e);
+ }
+ f->close_section();
+}
+
void BlueStore::ExtentMap::dup(BlueStore* b, TransContext* txc,
CollectionRef& c, OnodeRef& oldo, OnodeRef& newo, uint64_t& srcoff,
uint64_t& length, uint64_t& dstoff) {
ldout(c->store->cct, 20) << __func__ << " done" << dendl;
}
+void BlueStore::Onode::dump(Formatter* f) const
+{
+ onode.dump(f);
+ extent_map.dump(f);
+}
+
// =======================================================
// WriteContext
return r;
}
+int BlueStore::dump_onode(CollectionHandle &c_,
+ const ghobject_t& oid,
+ const string& section_name,
+ Formatter *f)
+{
+ Collection *c = static_cast<Collection *>(c_.get());
+ dout(15) << __func__ << " " << c->cid << " " << oid << dendl;
+ if (!c->exists)
+ return -ENOENT;
+
+ int r;
+ {
+ RWLock::RLocker l(c->lock);
+
+ OnodeRef o = c->get_onode(oid, false);
+ if (!o || !o->exists) {
+ r = -ENOENT;
+ goto out;
+ }
+ // FIXME minor: actually the next line isn't enough to
+ // load shared blobs. Leaving as is for now..
+ //
+ o->extent_map.fault_range(db, 0, OBJECT_MAX_SIZE);
+
+ _dump_onode<0>(o);
+ f->open_object_section(section_name.c_str());
+ o->dump(f);
+ f->close_section();
+ r = 0;
+ }
+ out:
+ dout(10) << __func__ << " " << c->cid << " " << oid
+ << " = " << r << dendl;
+ return r;
+}
+
int BlueStore::getattr(
CollectionHandle &c_,
const ghobject_t& oid,
friend void intrusive_ptr_add_ref(SharedBlob *b) { b->get(); }
friend void intrusive_ptr_release(SharedBlob *b) { b->put(); }
+ void dump(Formatter* f) const;
friend ostream& operator<<(ostream& out, const SharedBlob& sb);
void get() {
friend void intrusive_ptr_add_ref(Blob *b) { b->get(); }
friend void intrusive_ptr_release(Blob *b) { b->put(); }
+ void dump(Formatter* f) const;
friend ostream& operator<<(ostream& out, const Blob &b);
const bluestore_blob_use_tracker_t& get_blob_use_tracker() const {
}
}
+ void dump(Formatter* f) const;
+
void assign_blob(const BlobRef& b) {
ceph_assert(!blob);
blob = b;
clear_needs_reshard();
}
+ void dump(Formatter* f) const;
+
bool encode_some(uint32_t offset, uint32_t length, bufferlist& bl,
unsigned *pn);
unsigned decode_some(bufferlist& bl);
extent_map(this) {
}
+ void dump(Formatter* f) const;
+
void flush();
void get() {
++nref;
int fiemap(CollectionHandle &c, const ghobject_t& oid,
uint64_t offset, size_t len, map<uint64_t, uint64_t>& destmap) override;
+ int dump_onode(CollectionHandle &c, const ghobject_t& oid,
+ const string& section_name, Formatter *f) override;
int getattr(CollectionHandle &c, const ghobject_t& oid, const char *name,
bufferptr& value) override;