#define MDS_INO_STRAY_OWNER(i) (signed (((unsigned (i)) - MDS_INO_STRAY_OFFSET) / NUM_STRAY))
#define MDS_INO_STRAY_INDEX(i) (((unsigned (i)) - MDS_INO_STRAY_OFFSET) % NUM_STRAY)
-#define MDS_TRAVERSE_FORWARD 1
-#define MDS_TRAVERSE_DISCOVER 2 // skips permissions checks etc.
-#define MDS_TRAVERSE_DISCOVERXLOCK 3 // succeeds on (foreign?) null, xlocked dentries.
-
-
typedef int32_t mds_rank_t;
constexpr mds_rank_t MDS_RANK_NONE = -1;
// The namespace ID of the anonymous default filesystem from legacy systems
constexpr fs_cluster_id_t FS_CLUSTER_ID_ANONYMOUS = 0;
-class mds_role_t
-{
- public:
- fs_cluster_id_t fscid;
- mds_rank_t rank;
-
+class mds_role_t {
+public:
mds_role_t(fs_cluster_id_t fscid_, mds_rank_t rank_)
: fscid(fscid_), rank(rank_)
{}
- mds_role_t()
- : fscid(FS_CLUSTER_ID_NONE), rank(MDS_RANK_NONE)
- {}
- bool operator<(mds_role_t const &rhs) const
- {
+ mds_role_t() {}
+
+ bool operator<(mds_role_t const &rhs) const {
if (fscid < rhs.fscid) {
return true;
} else if (fscid == rhs.fscid) {
}
}
- bool is_none() const
- {
+ bool is_none() const {
return (rank == MDS_RANK_NONE);
}
-};
-std::ostream& operator<<(std::ostream &out, const mds_role_t &role);
+ fs_cluster_id_t fscid = FS_CLUSTER_ID_NONE;
+ mds_rank_t rank = MDS_RANK_NONE;
+};
+inline std::ostream& operator<<(std::ostream& out, const mds_role_t& role) {
+ return out << role.fscid << ":" << role.rank;
+}
// CAPS
-
inline string gcap_string(int cap)
{
string s;
return s;
}
-
struct scatter_info_t {
version_t version = 0;
-
- scatter_info_t() {}
};
struct frag_info_t : public scatter_info_t {
- // this frag
- utime_t mtime;
- uint64_t change_attr = 0;
- int64_t nfiles = 0; // files
- int64_t nsubdirs = 0; // subdirs
-
- frag_info_t() {}
-
int64_t size() const { return nfiles + nsubdirs; }
void zero() {
void encode(bufferlist &bl) const;
void decode(bufferlist::const_iterator& bl);
void dump(Formatter *f) const;
- static void generate_test_instances(list<frag_info_t*>& ls);
+ static void generate_test_instances(std::list<frag_info_t*>& ls);
+
+ // this frag
+ utime_t mtime;
+ uint64_t change_attr = 0;
+ int64_t nfiles = 0; // files
+ int64_t nsubdirs = 0; // subdirs
};
WRITE_CLASS_ENCODER(frag_info_t)
struct nest_info_t : public scatter_info_t {
- // this frag + children
- utime_t rctime;
- int64_t rbytes = 0;
- int64_t rfiles = 0;
- int64_t rsubdirs = 0;
int64_t rsize() const { return rfiles + rsubdirs; }
- int64_t rsnaps = 0;
-
- nest_info_t() {}
-
void zero() {
*this = nest_info_t();
}
void encode(bufferlist &bl) const;
void decode(bufferlist::const_iterator& bl);
void dump(Formatter *f) const;
- static void generate_test_instances(list<nest_info_t*>& ls);
+ static void generate_test_instances(std::list<nest_info_t*>& ls);
+
+ // this frag + children
+ utime_t rctime;
+ int64_t rbytes = 0;
+ int64_t rfiles = 0;
+ int64_t rsubdirs = 0;
+ int64_t rsnaps = 0;
};
WRITE_CLASS_ENCODER(nest_info_t)
std::ostream& operator<<(std::ostream &out, const nest_info_t &n);
-
struct vinodeno_t {
- inodeno_t ino;
- snapid_t snapid;
vinodeno_t() {}
vinodeno_t(inodeno_t i, snapid_t s) : ino(i), snapid(s) {}
decode(ino, p);
decode(snapid, p);
}
+
+ inodeno_t ino;
+ snapid_t snapid;
};
WRITE_CLASS_ENCODER(vinodeno_t)
struct quota_info_t
{
- int64_t max_bytes = 0;
- int64_t max_files = 0;
-
- quota_info_t() {}
-
void encode(bufferlist& bl) const {
ENCODE_START(1, 1, bl);
encode(max_bytes, bl);
}
void dump(Formatter *f) const;
- static void generate_test_instances(list<quota_info_t *>& ls);
+ static void generate_test_instances(std::list<quota_info_t *>& ls);
bool is_valid() const {
return max_bytes >=0 && max_files >=0;
bool is_enable() const {
return max_bytes || max_files;
}
+
+ int64_t max_bytes = 0;
+ int64_t max_files = 0;
};
WRITE_CLASS_ENCODER(quota_info_t)
return H(vino.ino) ^ I(vino.snapid);
}
};
-} // namespace std
-
-
-
+}
inline std::ostream& operator<<(std::ostream &out, const vinodeno_t &vino) {
out << vino.ino;
return out;
}
-
-/*
- * client_writeable_range_t
- */
struct client_writeable_range_t {
struct byte_range_t {
uint64_t first = 0, last = 0; // interval client can write to
- byte_range_t() {}
};
- byte_range_t range;
- snapid_t follows = 0; // aka "data+metadata flushed thru"
-
- client_writeable_range_t() {}
-
void encode(bufferlist &bl) const;
void decode(bufferlist::const_iterator& bl);
void dump(Formatter *f) const;
static void generate_test_instances(std::list<client_writeable_range_t*>& ls);
+
+ byte_range_t range;
+ snapid_t follows = 0; // aka "data+metadata flushed thru"
};
inline void decode(client_writeable_range_t::byte_range_t& range, bufferlist::const_iterator& bl) {
}
struct inline_data_t {
-private:
- std::unique_ptr<bufferlist> blp;
public:
- version_t version = 1;
-
- void free_data() {
- blp.reset();
- }
- bufferlist& get_data() {
- if (!blp)
- blp.reset(new bufferlist);
- return *blp;
- }
- size_t length() const { return blp ? blp->length() : 0; }
-
inline_data_t() {}
inline_data_t(const inline_data_t& o) : version(o.version) {
if (o.blp)
free_data();
return *this;
}
+
+ void free_data() {
+ blp.reset();
+ }
+ bufferlist& get_data() {
+ if (!blp)
+ blp.reset(new bufferlist);
+ return *blp;
+ }
+ size_t length() const { return blp ? blp->length() : 0; }
+
bool operator==(const inline_data_t& o) const {
return length() == o.length() &&
(length() == 0 ||
}
void encode(bufferlist &bl) const;
void decode(bufferlist::const_iterator& bl);
+
+ version_t version = 1;
+
+private:
+ std::unique_ptr<bufferlist> blp;
};
WRITE_CLASS_ENCODER(inline_data_t)
};
typedef uint32_t damage_flags_t;
-/*
- * inode_t
- */
template<template<typename> class Allocator = std::allocator>
struct inode_t {
/**
* Do not forget to add any new fields to the compare() function.
* ***************
*/
- // base (immutable)
- inodeno_t ino = 0;
- uint32_t rdev = 0; // if special file
-
- // affected by any inode change...
- utime_t ctime; // inode change time
- utime_t btime; // birth time
-
- // perm (namespace permissions)
- uint32_t mode = 0;
- uid_t uid = 0;
- gid_t gid = 0;
-
- // nlink
- int32_t nlink = 0;
-
- // file (data access)
- ceph_dir_layout dir_layout; // [dir only]
- file_layout_t layout;
- compact_set<int64_t, std::less<int64_t>, Allocator<int64_t>> old_pools;
- uint64_t size = 0; // on directory, # dentries
- uint64_t max_size_ever = 0; // max size the file has ever been
- uint32_t truncate_seq = 0;
- uint64_t truncate_size = 0, truncate_from = 0;
- uint32_t truncate_pending = 0;
- utime_t mtime; // file data modify time.
- utime_t atime; // file data access time.
- uint32_t time_warp_seq = 0; // count of (potential) mtime/atime timewarps (i.e., utimes())
- inline_data_t inline_data; // FIXME check
-
- // change attribute
- uint64_t change_attr = 0;
-
using client_range_map = std::map<client_t,client_writeable_range_t,std::less<client_t>,Allocator<std::pair<const client_t,client_writeable_range_t>>>;
- client_range_map client_ranges; // client(s) can write to these ranges
-
- // dirfrag, recursive accountin
- frag_info_t dirstat; // protected by my filelock
- nest_info_t rstat; // protected by my nestlock
- nest_info_t accounted_rstat; // protected by parent's nestlock
-
- quota_info_t quota;
-
- mds_rank_t export_pin = MDS_RANK_NONE;
-
- // special stuff
- version_t version = 0; // auth only
- version_t file_data_version = 0; // auth only
- version_t xattr_version = 0;
-
- utime_t last_scrub_stamp; // start time of last complete scrub
- version_t last_scrub_version = 0;// (parent) start version of last complete scrub
-
- version_t backtrace_version = 0;
-
- snapid_t oldest_snap;
-
- std::basic_string<char,std::char_traits<char>,Allocator<char>> stray_prior_path; //stores path before unlink
inode_t()
{
clear_layout();
- // FIPS zeroization audit 20191117: this memset is not security related.
- memset(&dir_layout, 0, sizeof(dir_layout));
}
// file type
* @returns 1 if we are newer than the other, 0 if equal, -1 if older.
*/
int compare(const inode_t &other, bool *divergent) const;
+
+ // base (immutable)
+ inodeno_t ino = 0;
+ uint32_t rdev = 0; // if special file
+
+ // affected by any inode change...
+ utime_t ctime; // inode change time
+ utime_t btime; // birth time
+
+ // perm (namespace permissions)
+ uint32_t mode = 0;
+ uid_t uid = 0;
+ gid_t gid = 0;
+
+ // nlink
+ int32_t nlink = 0;
+
+ // file (data access)
+ ceph_dir_layout dir_layout = {}; // [dir only]
+ file_layout_t layout;
+ compact_set<int64_t, std::less<int64_t>, Allocator<int64_t>> old_pools;
+ uint64_t size = 0; // on directory, # dentries
+ uint64_t max_size_ever = 0; // max size the file has ever been
+ uint32_t truncate_seq = 0;
+ uint64_t truncate_size = 0, truncate_from = 0;
+ uint32_t truncate_pending = 0;
+ utime_t mtime; // file data modify time.
+ utime_t atime; // file data access time.
+ uint32_t time_warp_seq = 0; // count of (potential) mtime/atime timewarps (i.e., utimes())
+ inline_data_t inline_data; // FIXME check
+
+ // change attribute
+ uint64_t change_attr = 0;
+
+ client_range_map client_ranges; // client(s) can write to these ranges
+
+ // dirfrag, recursive accountin
+ frag_info_t dirstat; // protected by my filelock
+ nest_info_t rstat; // protected by my nestlock
+ nest_info_t accounted_rstat; // protected by parent's nestlock
+
+ quota_info_t quota;
+
+ mds_rank_t export_pin = MDS_RANK_NONE;
+
+ // special stuff
+ version_t version = 0; // auth only
+ version_t file_data_version = 0; // auth only
+ version_t xattr_version = 0;
+
+ utime_t last_scrub_stamp; // start time of last complete scrub
+ version_t last_scrub_version = 0;// (parent) start version of last complete scrub
+
+ version_t backtrace_version = 0;
+
+ snapid_t oldest_snap;
+
+ std::basic_string<char,std::char_traits<char>,Allocator<char>> stray_prior_path; //stores path before unlink
+
private:
bool older_is_consistent(const inode_t &other) const;
};
f->dump_unsigned("backtrace_version", backtrace_version);
f->dump_string("stray_prior_path", stray_prior_path);
+ f->dump_unsigned("max_size_ever", max_size_ever);
+
+ f->open_object_section("quota");
+ quota.dump(f);
+ f->close_section();
+
+ f->dump_stream("last_scrub_stamp") << last_scrub_stamp;
+ f->dump_unsigned("last_scrub_version", last_scrub_version);
}
template<template<typename> class Allocator>
-void inode_t<Allocator>::generate_test_instances(list<inode_t*>& ls)
+void inode_t<Allocator>::generate_test_instances(std::list<inode_t*>& ls)
{
ls.push_back(new inode_t<Allocator>);
ls.push_back(new inode_t<Allocator>);
template<template<typename> class Allocator>
using xattr_map = compact_map<alloc_string<Allocator>, bufferptr, std::less<alloc_string<Allocator>>, Allocator<std::pair<const alloc_string<Allocator>, bufferptr>>>; // FIXME bufferptr not in mempool
-/*
- * old_inode_t
- */
template<template<typename> class Allocator = std::allocator>
struct old_inode_t {
snapid_t first;
c.decode(p);
}
-
/*
* like an inode, but for a dir frag
*/
struct fnode_t {
+ void encode(bufferlist &bl) const;
+ void decode(bufferlist::const_iterator& bl);
+ void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<fnode_t*>& ls);
+
version_t version = 0;
snapid_t snap_purged_thru; // the max_last_destroy snapid we've been purged thru
frag_info_t fragstat, accounted_fragstat;
// version at which we last scrubbed our personal data structures
version_t localized_scrub_version = 0;
utime_t localized_scrub_stamp;
-
- void encode(bufferlist &bl) const;
- void decode(bufferlist::const_iterator& bl);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<fnode_t*>& ls);
- fnode_t() {}
};
WRITE_CLASS_ENCODER(fnode_t)
struct old_rstat_t {
- snapid_t first;
- nest_info_t rstat, accounted_rstat;
-
void encode(bufferlist& bl) const;
void decode(bufferlist::const_iterator& p);
void dump(Formatter *f) const;
- static void generate_test_instances(list<old_rstat_t*>& ls);
+ static void generate_test_instances(std::list<old_rstat_t*>& ls);
+
+ snapid_t first;
+ nest_info_t rstat, accounted_rstat;
};
WRITE_CLASS_ENCODER(old_rstat_t)
return out << "old_rstat(first " << o.first << " " << o.rstat << " " << o.accounted_rstat << ")";
}
-/*
- * feature_bitset_t
- */
class feature_bitset_t {
public:
typedef uint64_t block_type;
_vec = std::move(other._vec);
return *this;
}
+ feature_bitset_t& operator-=(const feature_bitset_t& other);
bool empty() const {
+ //block_type is a uint64_t. If the vector is only composed of 0s, then it's still "empty"
for (auto& v : _vec) {
if (v)
return false;
void clear() {
_vec.clear();
}
- feature_bitset_t& operator-=(const feature_bitset_t& other);
void encode(bufferlist& bl) const;
void decode(bufferlist::const_iterator &p);
+ void dump(Formatter *f) const;
void print(ostream& out) const;
private:
vector<block_type> _vec;
return out;
}
+struct metric_spec_t {
+ metric_spec_t() {}
+ metric_spec_t(const metric_spec_t& other) :
+ metric_flags(other.metric_flags) {}
+ metric_spec_t(metric_spec_t&& other) :
+ metric_flags(std::move(other.metric_flags)) {}
+ metric_spec_t(const feature_bitset_t& mf) :
+ metric_flags(mf) {}
+ metric_spec_t(feature_bitset_t&& mf) :
+ metric_flags(std::move(mf)) {}
+
+ metric_spec_t& operator=(const metric_spec_t& other) {
+ metric_flags = other.metric_flags;
+ return *this;
+ }
+ metric_spec_t& operator=(metric_spec_t&& other) {
+ metric_flags = std::move(other.metric_flags);
+ return *this;
+ }
+
+ bool empty() const {
+ return metric_flags.empty();
+ }
+
+ void clear() {
+ metric_flags.clear();
+ }
+
+ void encode(bufferlist& bl) const;
+ void decode(bufferlist::const_iterator& p);
+ void dump(Formatter *f) const;
+ void print(ostream& out) const;
+
+ // set of metrics that a client is capable of forwarding
+ feature_bitset_t metric_flags;
+};
+WRITE_CLASS_ENCODER(metric_spec_t)
+
+inline std::ostream& operator<<(std::ostream& out, const metric_spec_t& mst) {
+ mst.print(out);
+ return out;
+}
+
/*
* client_metadata_t
*/
using kv_map_t = std::map<std::string,std::string>;
using iterator = kv_map_t::const_iterator;
- kv_map_t kv_map;
- feature_bitset_t features;
-
client_metadata_t() {}
- client_metadata_t(const client_metadata_t& other) :
- kv_map(other.kv_map), features(other.features) {}
- client_metadata_t(client_metadata_t&& other) :
- kv_map(std::move(other.kv_map)), features(std::move(other.features)) {}
- client_metadata_t(kv_map_t&& kv, feature_bitset_t &&f) :
- kv_map(std::move(kv)), features(std::move(f)) {}
- client_metadata_t(const kv_map_t& kv, const feature_bitset_t &f) :
- kv_map(kv), features(f) {}
+ client_metadata_t(const kv_map_t& kv, const feature_bitset_t &f, const metric_spec_t &mst) :
+ kv_map(kv),
+ features(f),
+ metric_spec(mst) {}
client_metadata_t& operator=(const client_metadata_t& other) {
kv_map = other.kv_map;
features = other.features;
+ metric_spec = other.metric_spec;
return *this;
}
- bool empty() const { return kv_map.empty() && features.empty(); }
+ bool empty() const { return kv_map.empty() && features.empty() && metric_spec.empty(); }
iterator find(const std::string& key) const { return kv_map.find(key); }
iterator begin() const { return kv_map.begin(); }
iterator end() const { return kv_map.end(); }
void merge(const client_metadata_t& other) {
kv_map.insert(other.kv_map.begin(), other.kv_map.end());
features = other.features;
+ metric_spec = other.metric_spec;
}
void clear() {
kv_map.clear();
features.clear();
+ metric_spec.clear();
}
void encode(bufferlist& bl) const;
void decode(bufferlist::const_iterator& p);
void dump(Formatter *f) const;
+
+ kv_map_t kv_map;
+ feature_bitset_t features;
+ metric_spec_t metric_spec;
};
WRITE_CLASS_ENCODER(client_metadata_t)
/*
- * session_info_t
+ * session_info_t - durable part of a Session
*/
struct session_info_t {
- entity_inst_t inst;
- std::map<ceph_tid_t,inodeno_t> completed_requests;
- interval_set<inodeno_t> prealloc_inos; // preallocated, ready to use.
- interval_set<inodeno_t> used_inos; // journaling use
- client_metadata_t client_metadata;
- std::set<ceph_tid_t> completed_flushes;
- EntityName auth_name;
-
client_t get_client() const { return client_t(inst.name.num()); }
bool has_feature(size_t bit) const { return client_metadata.features.test(bit); }
const entity_name_t& get_source() const { return inst.name; }
void encode(bufferlist& bl, uint64_t features) const;
void decode(bufferlist::const_iterator& p);
void dump(Formatter *f) const;
- static void generate_test_instances(list<session_info_t*>& ls);
+ static void generate_test_instances(std::list<session_info_t*>& ls);
+
+ entity_inst_t inst;
+ std::map<ceph_tid_t,inodeno_t> completed_requests;
+ interval_set<inodeno_t> prealloc_inos; // preallocated, ready to use.
+ interval_set<inodeno_t> used_inos; // journaling use
+ client_metadata_t client_metadata;
+ std::set<ceph_tid_t> completed_flushes;
+ EntityName auth_name;
};
WRITE_CLASS_ENCODER_FEATURES(session_info_t)
-
-// =======
// dentries
-
struct dentry_key_t {
- snapid_t snapid = 0;
- std::string_view name;
- __u32 hash = 0;
dentry_key_t() {}
dentry_key_t(snapid_t s, std::string_view n, __u32 h=0) :
snapid(s), name(n), hash(h) {}
std::string x_str(key.substr(i+1));
sscanf(x_str.c_str(), "%llx", &x);
sn = x;
- }
+ }
nm = key.substr(0, i);
}
+
+ snapid_t snapid = 0;
+ std::string_view name;
+ __u32 hash = 0;
};
inline std::ostream& operator<<(std::ostream& out, const dentry_key_t &k)
return k1.snapid < k2.snapid;
}
-
/*
* string_snap_t is a simple (string, snapid_t) pair
*/
struct string_snap_t {
- string name;
- snapid_t snapid;
string_snap_t() {}
string_snap_t(std::string_view n, snapid_t s) : name(n), snapid(s) {}
void encode(bufferlist& bl) const;
void decode(bufferlist::const_iterator& p);
void dump(Formatter *f) const;
- static void generate_test_instances(list<string_snap_t*>& ls);
+ static void generate_test_instances(std::list<string_snap_t*>& ls);
+
+ string name;
+ snapid_t snapid;
};
WRITE_CLASS_ENCODER(string_snap_t)
/*
* mds_table_pending_t
*
- * mds's requesting any pending ops. child needs to encode the corresponding
+ * For mds's requesting any pending ops, child needs to encode the corresponding
* pending mutation state in the table.
*/
struct mds_table_pending_t {
- uint64_t reqid = 0;
- __s32 mds = 0;
- version_t tid = 0;
- mds_table_pending_t() {}
void encode(bufferlist& bl) const;
void decode(bufferlist::const_iterator& bl);
void dump(Formatter *f) const;
- static void generate_test_instances(list<mds_table_pending_t*>& ls);
+ static void generate_test_instances(std::list<mds_table_pending_t*>& ls);
+
+ uint64_t reqid = 0;
+ __s32 mds = 0;
+ version_t tid = 0;
};
WRITE_CLASS_ENCODER(mds_table_pending_t)
-
-// =========
// requests
-
struct metareqid_t {
- entity_name_t name;
- uint64_t tid = 0;
metareqid_t() {}
metareqid_t(entity_name_t n, ceph_tid_t t) : name(n), tid(t) {}
void encode(bufferlist& bl) const {
decode(name, p);
decode(tid, p);
}
+
+ entity_name_t name;
+ uint64_t tid = 0;
};
WRITE_CLASS_ENCODER(metareqid_t)
};
} // namespace std
-
// cap info for client reconnect
struct cap_reconnect_t {
- string path;
- mutable ceph_mds_cap_reconnect capinfo;
- snapid_t snap_follows;
- bufferlist flockbl;
-
- cap_reconnect_t() {
- // FIPS zeroization audit 20191117: this memset is not security related.
- memset(&capinfo, 0, sizeof(capinfo));
- snap_follows = 0;
- }
+ cap_reconnect_t() {}
cap_reconnect_t(uint64_t cap_id, inodeno_t pino, std::string_view p, int w, int i,
inodeno_t sr, snapid_t sf, bufferlist& lb) :
path(p) {
void decode_old(bufferlist::const_iterator& bl);
void dump(Formatter *f) const;
- static void generate_test_instances(list<cap_reconnect_t*>& ls);
+ static void generate_test_instances(std::list<cap_reconnect_t*>& ls);
+
+ string path;
+ mutable ceph_mds_cap_reconnect capinfo = {};
+ snapid_t snap_follows = 0;
+ bufferlist flockbl;
};
WRITE_CLASS_ENCODER(cap_reconnect_t)
struct snaprealm_reconnect_t {
- mutable ceph_mds_snaprealm_reconnect realm;
-
- snaprealm_reconnect_t() {
- // FIPS zeroization audit 20191117: this memset is not security related.
- memset(&realm, 0, sizeof(realm));
- }
+ snaprealm_reconnect_t() {}
snaprealm_reconnect_t(inodeno_t ino, snapid_t seq, inodeno_t parent) {
realm.ino = ino;
realm.seq = seq;
void decode_old(bufferlist::const_iterator& bl);
void dump(Formatter *f) const;
- static void generate_test_instances(list<snaprealm_reconnect_t*>& ls);
+ static void generate_test_instances(std::list<snaprealm_reconnect_t*>& ls);
+
+ mutable ceph_mds_snaprealm_reconnect realm = {};
};
WRITE_CLASS_ENCODER(snaprealm_reconnect_t)
WRITE_RAW_ENCODER(old_ceph_mds_cap_reconnect)
struct old_cap_reconnect_t {
- string path;
- old_ceph_mds_cap_reconnect capinfo;
-
const old_cap_reconnect_t& operator=(const cap_reconnect_t& n) {
path = n.path;
capinfo.cap_id = n.capinfo.cap_id;
decode(path, bl);
decode(capinfo, bl);
}
+
+ string path;
+ old_ceph_mds_cap_reconnect capinfo;
};
WRITE_CLASS_ENCODER(old_cap_reconnect_t)
-
-// ================================================================
// dir frag
-
struct dirfrag_t {
- inodeno_t ino = 0;
- frag_t frag;
-
dirfrag_t() {}
dirfrag_t(inodeno_t i, frag_t f) : ino(i), frag(f) { }
decode(ino, bl);
decode(frag, bl);
}
+
+ inodeno_t ino = 0;
+ frag_t frag;
};
WRITE_CLASS_ENCODER(dirfrag_t)
-
inline std::ostream& operator<<(std::ostream& out, const dirfrag_t &df) {
out << df.ino;
if (!df.frag.is_root()) out << "." << df.frag;
};
} // namespace std
-
-
// ================================================================
-
#define META_POP_IRD 0
#define META_POP_IWR 1
#define META_POP_READDIR 2
void encode(bufferlist &bl) const;
void decode(bufferlist::const_iterator& p);
void dump(Formatter *f) const;
- static void generate_test_instances(list<inode_load_vec_t*>& ls);
+ static void generate_test_instances(std::list<inode_load_vec_t*>& ls);
private:
std::array<DecayCounter, NUM> vec;
return out << ss.str() << std::endl;
}
-
-/* mds_load_t
- * mds load
- */
-
struct mds_load_t {
using clock = dirfrag_load_vec_t::clock;
using time = dirfrag_load_vec_t::time;
using time = DecayCounter::time;
using clock = DecayCounter::clock;
static const int MAX = 4;
- int last[MAX];
- int p = 0, n = 0;
- DecayCounter count;
-public:
- load_spread_t() = delete;
load_spread_t(const DecayRate &rate) : count(rate)
- {
- for (int i=0; i<MAX; i++)
- last[i] = -1;
- }
+ {}
+
+ load_spread_t() = delete;
double hit(int who) {
for (int i=0; i<n; i++)
double get() const {
return count.get();
}
-};
-
+ std::array<int, MAX> last = {-1, -1, -1, -1};
+ int p = 0, n = 0;
+ DecayCounter count;
+};
// ================================================================
typedef std::pair<mds_rank_t, mds_rank_t> mds_authority_t;
class MDSCacheObjectInfo {
public:
+ void encode(bufferlist& bl) const;
+ void decode(bufferlist::const_iterator& bl);
+ void dump(Formatter *f) const;
+ static void generate_test_instances(std::list<MDSCacheObjectInfo*>& ls);
+
inodeno_t ino = 0;
dirfrag_t dirfrag;
string dname;
snapid_t snapid;
-
- MDSCacheObjectInfo() {}
-
- void encode(bufferlist& bl) const;
- void decode(bufferlist::const_iterator& bl);
- void dump(Formatter *f) const;
- static void generate_test_instances(list<MDSCacheObjectInfo*>& ls);
};
inline std::ostream& operator<<(std::ostream& out, const MDSCacheObjectInfo &info) {
}
WRITE_CLASS_ENCODER(MDSCacheObjectInfo)
-
// parse a map of keys/values.
namespace qi = boost::spirit::qi;