using ceph::bufferlist;
using ceph::Formatter;
+void mds_role_t::print(std::ostream& out) const {
+ out << fscid << ":" << rank;
+}
+
+std::ostream& operator<<(std::ostream &out, const vinodeno_t &vino) {
+ out << vino.ino;
+ if (vino.snapid == CEPH_NOSNAP)
+ out << ".head";
+ else if (vino.snapid)
+ out << '.' << vino.snapid;
+ return out;
+}
+
/*
* frag_info_t
*/
ls.back()->accounted_rstat = *nls.front();
}
+void old_rstat_t::print(std::ostream& out) const {
+ out << "old_rstat(first " << first << " " << rstat << " " << accounted_rstat << ")";
+}
+
/*
* feature_bitset_t
*/
// we can't add used inos; they're cleared on decode
}
+/*
+ * dentry_key_t
+ */
+void dentry_key_t::print(std::ostream& out) const {
+ out << "(" << name << "," << snapid << ")";
+}
+
+void dentry_key_t::encode(std::string& key) const {
+ char b[20];
+ if (snapid != CEPH_NOSNAP) {
+ uint64_t val(snapid);
+ snprintf(b, sizeof(b), "%" PRIx64, val);
+ } else {
+ snprintf(b, sizeof(b), "%s", "head");
+ }
+ CachedStackStringStream css;
+ *css << name << "_" << b;
+ key = css->strv();
+}
/*
* string_snap_t
*/
+void string_snap_t::print(std::ostream& out) const {
+ out << "(" << name << "," << snapid << ")";
+}
+
void string_snap_t::encode(bufferlist& bl) const
{
ENCODE_START(2, 2, bl);
f->dump_unsigned("snapid", snapid);
}
+void MDSCacheObjectInfo::print(std::ostream& out) const {
+ if (ino) {
+ out << ino << "." << snapid;
+ } else if (dname.length()) {
+ out << dirfrag << "/" << dname
+ << " snap " << snapid;
+ } else {
+ out << dirfrag;
+ }
+}
+
void MDSCacheObjectInfo::generate_test_instances(std::list<MDSCacheObjectInfo*>& ls)
{
ls.push_back(new MDSCacheObjectInfo);
f->dump_unsigned("tid", tid);
}
+void metareqid_t::print(std::ostream& out) const {
+ out << name << ":" << tid;
+}
+
+void metareqid_t::generate_test_instances(std::list<metareqid_t*>& ls) {
+ ls.push_back(new metareqid_t);
+ ls.push_back(new metareqid_t(entity_name_t::CLIENT(123), 456));
+}
+
+/*
+ * dirfrag_t
+ */
+void dirfrag_t::print(std::ostream& out) const {
+ out << ino;
+ if (!frag.is_root()) {
+ out << "." << frag;
+ }
+}
+
+void dirfrag_t::dump(ceph::Formatter *f) const {
+ f->dump_unsigned("ino", ino);
+ f->dump_unsigned("frag", frag);
+}
+
+void dirfrag_t::generate_test_instances(std::list<dirfrag_t*>& ls) {
+ ls.push_back(new dirfrag_t);
+ ls.push_back(new dirfrag_t(1, frag_t()));
+ ls.push_back(new dirfrag_t(2, frag_t(3)));
+}
+
/*
* inode_load_vec_t
*/
f->dump_float("STORE", get(META_POP_STORE).get());
}
+void dirfrag_load_vec_t::print(std::ostream& out) const {
+ CachedStackStringStream css;
+ *css << std::setprecision(1) << std::fixed
+ << "[pop"
+ " IRD:" << vec[0]
+ << " IWR:" << vec[1]
+ << " RDR:" << vec[2]
+ << " FET:" << vec[3]
+ << " STR:" << vec[4]
+ << " *LOAD:" << meta_load() << "]";
+ out << css->strv();
+}
+
void dirfrag_load_vec_t::generate_test_instances(std::list<dirfrag_load_vec_t*>& ls)
{
ls.push_back(new dirfrag_load_vec_t(DecayRate()));
/*
* mds_load_t
*/
+void mds_load_t::print(std::ostream& out) const {
+ out << "mdsload<" << auth << "/" << all
+ << ", req " << req_rate
+ << ", hr " << cache_hit_rate
+ << ", qlen " << queue_len
+ << ", cpu " << cpu_load_avg
+ << ">";
+}
+
void mds_load_t::encode(bufferlist &bl) const {
ENCODE_START(2, 2, bl);
encode(auth, bl);
#include "include/int_types.h"
-#include <ostream>
+#include <iosfwd>
#include <set>
#include <map>
#include <string>
#include <string_view>
#include "common/DecayCounter.h"
-#include "common/StackStringStream.h"
#include "common/entity_name.h"
#include "include/frag.h"
return (rank == MDS_RANK_NONE);
}
- void print(std::ostream& out) const {
- out << fscid << ":" << rank;
- }
+ void print(std::ostream& out) const;
fs_cluster_id_t fscid = FS_CLUSTER_ID_NONE;
mds_rank_t rank = MDS_RANK_NONE;
};
}
-inline std::ostream& operator<<(std::ostream &out, const vinodeno_t &vino) {
- out << vino.ino;
- if (vino.snapid == CEPH_NOSNAP)
- out << ".head";
- else if (vino.snapid)
- out << '.' << vino.snapid;
- return out;
-}
+std::ostream& operator<<(std::ostream &out, const vinodeno_t &vino);
typedef uint32_t damage_flags_t;
void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<old_rstat_t*>& ls);
- void print(std::ostream& out) const {
- out << "old_rstat(first " << first << " " << rstat << " " << accounted_rstat << ")";
- }
+ void print(std::ostream& out) const;
snapid_t first;
nest_info_t rstat, accounted_rstat;
dentry_key_t(snapid_t s, std::string_view n, __u32 h=0) :
snapid(s), name(n), hash(h) {}
- void print(std::ostream& out) const {
- out << "(" << name << "," << snapid << ")";
- }
+ void print(std::ostream& out) const;
bool is_valid() { return name.length() || snapid; }
using ceph::encode;
encode(key, bl);
}
- void encode(std::string& key) const {
- char b[20];
- if (snapid != CEPH_NOSNAP) {
- uint64_t val(snapid);
- snprintf(b, sizeof(b), "%" PRIx64, val);
- } else {
- snprintf(b, sizeof(b), "%s", "head");
- }
- CachedStackStringStream css;
- *css << name << "_" << b;
- key = css->strv();
- }
+ void encode(std::string& key) const;
static void decode_helper(ceph::buffer::list::const_iterator& bl, std::string& nm,
snapid_t& sn) {
std::string key;
string_snap_t() {}
string_snap_t(std::string_view n, snapid_t s) : name(n), snapid(s) {}
- void print(std::ostream& out) const {
- out << "(" << name << "," << snapid << ")";
- }
+ void print(std::ostream& out) const;
int compare(const string_snap_t& r) const {
int ret = name.compare(r.name);
decode(tid, p);
}
void dump(ceph::Formatter *f) const;
- void print(std::ostream& out) const {
- out << name << ":" << tid;
- }
- static void generate_test_instances(std::list<metareqid_t*>& ls) {
- ls.push_back(new metareqid_t);
- ls.push_back(new metareqid_t(entity_name_t::CLIENT(123), 456));
- }
+ void print(std::ostream& out) const;
+ static void generate_test_instances(std::list<metareqid_t*>& ls);
entity_name_t name;
uint64_t tid = 0;
};
dirfrag_t() {}
dirfrag_t(inodeno_t i, frag_t f) : ino(i), frag(f) { }
- void print(std::ostream& out) const {
- out << ino;
- if (!frag.is_root()) {
- out << "." << frag;
- }
- }
+ void print(std::ostream& out) const;
void encode(ceph::buffer::list& bl) const {
using ceph::encode;
decode(ino, bl);
decode(frag, bl);
}
- void dump(ceph::Formatter *f) const {
- f->dump_unsigned("ino", ino);
- f->dump_unsigned("frag", frag);
- }
- static void generate_test_instances(std::list<dirfrag_t*>& ls) {
- ls.push_back(new dirfrag_t);
- ls.push_back(new dirfrag_t(1, frag_t()));
- ls.push_back(new dirfrag_t(2, frag_t(3)));
- }
+ void dump(ceph::Formatter *f) const;
+ static void generate_test_instances(std::list<dirfrag_t*>& ls);
inodeno_t ino = 0;
frag_t frag;
}
void dump(ceph::Formatter *f) const;
void dump(ceph::Formatter *f, const DecayRate& rate) const;
- void print(std::ostream& out) const {
- CachedStackStringStream css;
- *css << std::setprecision(1) << std::fixed
- << "[pop"
- " IRD:" << vec[0]
- << " IWR:" << vec[1]
- << " RDR:" << vec[2]
- << " FET:" << vec[3]
- << " STR:" << vec[4]
- << " *LOAD:" << meta_load() << "]";
- out << css->strv();
- }
+ void print(std::ostream& out) const;
static void generate_test_instances(std::list<dirfrag_load_vec_t*>& ls);
const DecayCounter &get(int t) const {
mds_load_t() : auth(DecayRate()), all(DecayRate()) {}
mds_load_t(const DecayRate &rate) : auth(rate), all(rate) {}
- void print(std::ostream& out) const {
- out << "mdsload<" << auth << "/" << all
- << ", req " << req_rate
- << ", hr " << cache_hit_rate
- << ", qlen " << queue_len
- << ", cpu " << cpu_load_avg
- << ">";
- }
+ void print(std::ostream& out) const;
double req_rate = 0.0;
double cache_hit_rate = 0.0;
void encode(ceph::buffer::list& bl) const;
void decode(ceph::buffer::list::const_iterator& bl);
void dump(ceph::Formatter *f) const;
- void print(std::ostream& out) const {
- if (ino) {
- out << ino << "." << snapid;
- } else if (dname.length()) {
- out << dirfrag << "/" << dname
- << " snap " << snapid;
- } else {
- out << dirfrag;
- }
- }
+ void print(std::ostream& out) const;
static void generate_test_instances(std::list<MDSCacheObjectInfo*>& ls);
inodeno_t ino = 0;