#define dout_context g_ceph_context
#define dout_subsys ceph_subsys_mds
+using std::cerr;
+using std::cout;
+using std::vector;
+
static void usage()
{
cout << "usage: ceph-mds -i <ID> [flags]\n"
ls.back()->d_type = DT_DIR;
}
-ostream& operator<<(ostream& out, const Anchor &a)
+std::ostream& operator<<(std::ostream& out, const Anchor &a)
{
return out << "a(" << a.ino << " " << a.dirino << "/'" << a.d_name << "' " << a.d_type << ")";
}
mutable int nref = 0; // how many children
};
-ostream& operator<<(ostream& out, const Anchor &a);
+std::ostream& operator<<(std::ostream& out, const Anchor &a);
#endif
#undef dout_prefix
#define dout_prefix *_dout << "mds.beacon." << name << ' '
+using std::map;
+using std::string;
+
using namespace std::chrono_literals;
Beacon::Beacon(CephContext *cct, MonClient *monc, std::string_view name)
//
// Detect clients failing to advance their old_client_tid
{
- set<Session*> sessions;
+ std::set<Session*> sessions;
mds->sessionmap.get_client_session_set(sessions);
const auto min_caps_working_set = g_conf().get_val<uint64_t>("mds_min_caps_working_set");
#undef dout_prefix
#define dout_prefix *_dout << "mds." << dir->mdcache->mds->get_nodeid() << ".cache.den(" << dir->dirfrag() << " " << name << ") "
+using namespace std;
ostream& CDentry::print_db_line_prefix(ostream& out)
{
#undef dout_prefix
#define dout_prefix *_dout << "mds." << mdcache->mds->get_nodeid() << ".cache.dir(" << this->dirfrag() << ") "
+using namespace std;
+
int CDir::num_frozen_trees = 0;
int CDir::num_freezing_trees = 0;
}
struct dentry_commit_item {
- string key;
+ std::string key;
snapid_t first;
bool is_remote = false;
void _omap_fetch(MDSContext *fin, const std::set<dentry_key_t>& keys);
void _omap_fetch_more(version_t omap_version, bufferlist& hdrbl,
- map<string, bufferlist>& omap, MDSContext *fin);
+ std::map<std::string, bufferlist>& omap, MDSContext *fin);
CDentry *_load_dentry(
std::string_view key,
std::string_view dname,
// -- commit --
void _commit(version_t want, int op_prio);
void _omap_commit_ops(int r, int op_prio, int64_t metapool, version_t version, bool _new,
- vector<dentry_commit_item> &to_set, bufferlist &dfts,
- vector<string> &to_remove,
+ std::vector<dentry_commit_item> &to_set, bufferlist &dfts,
+ std::vector<std::string> &to_remove,
mempool::mds_co::compact_set<mempool::mds_co::string> &_stale);
void _encode_primary_inode_base(dentry_commit_item &item, bufferlist &dfts,
bufferlist &bl);
void _omap_commit(int op_prio);
void _parse_dentry(CDentry *dn, dentry_commit_item &item,
- const set<snapid_t> *snaps, bufferlist &bl);
+ const std::set<snapid_t> *snaps, bufferlist &bl);
void _committed(int r, version_t v);
static fnode_const_ptr empty_fnode;
#undef dout_prefix
#define dout_prefix *_dout << "mds." << mdcache->mds->get_nodeid() << ".cache.ino(" << ino() << ") "
+using namespace std;
+
void CInodeCommitOperation::update(ObjectOperation &op, inode_backtrace_t &bt) {
using ceph::encode;
using std::pair;
using std::ostream;
using std::string;
+using std::string_view;
using ceph::bufferlist;
using ceph::Formatter;
const CompatSet &get_default_compat() const {return default_compat;}
- void filter(const std::vector<string>& allowed)
+ void filter(const std::vector<std::string>& allowed)
{
if (allowed.empty()) {
return;
}
for (auto &f : filesystems) {
- string_view fs_name = f.second->mds_map.get_fs_name();
+ std::string_view fs_name = f.second->mds_map.get_fs_name();
if (std::find(allowed.begin(), allowed.end(), fs_name) == allowed.end()) {
filesystems.erase(f.first);
}
}
for (auto r : mds_roles) {
- string_view fs_name = fs_name_from_gid(r.first);
+ std::string_view fs_name = fs_name_from_gid(r.first);
if (std::find(allowed.begin(), allowed.end(), fs_name) == allowed.end()) {
mds_roles.erase(r.first);
}
* Does a daemon exist with this GID?
*/
bool gid_exists(mds_gid_t gid,
- const std::vector<string>& in = {}) const
+ const std::vector<std::string>& in = {}) const
{
try {
- string_view m = fs_name_from_gid(gid);
+ std::string_view m = fs_name_from_gid(gid);
return in.empty() || std::find(in.begin(), in.end(), m) != in.end();
} catch (const std::out_of_range&) {
return false;
std::string_view role_str,
mds_role_t *role,
std::ostream &ss,
- const std::vector<string> &filter) const;
+ const std::vector<std::string> &filter) const;
int parse_role(
std::string_view role_str,
#undef dout_prefix
#define dout_context g_ceph_context
#define dout_prefix _prefix(_dout, mds)
+
+using namespace std;
+
static ostream& _prefix(std::ostream *_dout, MDSRank *mds) {
return *_dout << "mds." << mds->get_nodeid() << ".locker ";
}
ENCODE_FINISH(bl);
}
- virtual void print(ostream& out) const {
+ virtual void print(std::ostream& out) const {
out << "event(" << _type << ")";
}
LogSegment *_segment = nullptr;
};
-inline ostream& operator<<(ostream& out, const LogEvent &le) {
+inline std::ostream& operator<<(std::ostream& out, const LogEvent &le) {
le.print(out);
return out;
}
elist<CInode*> dirty_dirfrag_nest;
elist<CInode*> dirty_dirfrag_dirfragtree;
- set<CInode*> truncating_inodes;
+ std::set<CInode*> truncating_inodes;
interval_set<inodeno_t> purging_inodes;
MDSContext* purged_cb = nullptr;
- map<int, ceph::unordered_set<version_t> > pending_commit_tids; // mdstable
- set<metareqid_t> uncommitted_leaders;
- set<metareqid_t> uncommitted_peers;
- set<dirfrag_t> uncommitted_fragments;
+ std::map<int, ceph::unordered_set<version_t> > pending_commit_tids; // mdstable
+ std::set<metareqid_t> uncommitted_leaders;
+ std::set<metareqid_t> uncommitted_peers;
+ std::set<dirfrag_t> uncommitted_fragments;
// client request ids
- map<int, ceph_tid_t> last_client_tids;
+ std::map<int, ceph_tid_t> last_client_tids;
// potentially dirty sessions
std::set<entity_name_t> touched_sessions;
// table version
version_t inotablev = 0;
version_t sessionmapv = 0;
- map<int,version_t> tablev;
+ std::map<int,version_t> tablev;
MDSContext::vec expiry_waiters;
};
#include <fstream>
#include <vector>
#include <map>
-using std::map;
-using std::vector;
-using std::chrono::duration_cast;
+
+using namespace std;
#include "common/config.h"
#include "common/errno.h"
if (mds->get_nodeid() == 0
&& mds->is_active()
&& bal_interval > 0
- && duration_cast<chrono::seconds>(now - last_heartbeat).count() >= bal_interval
+ && chrono::duration_cast<chrono::seconds>(now - last_heartbeat).count() >= bal_interval
&& (num_bal_times || (bal_max_until >= 0 && mds->get_uptime().count() > bal_max_until))) {
last_heartbeat = now;
send_heartbeat();
double amount,
std::vector<CDir*>* exports,
double& have,
- set<CDir*>& already_exporting);
+ std::set<CDir*>& already_exporting);
double try_match(balance_state_t &state,
mds_rank_t ex, double& maxex,
MonClient *mon_client;
int beat_epoch = 0;
- string bal_code;
- string bal_version;
+ std::string bal_code;
+ std::string bal_version;
time last_heartbeat = clock::zero();
time last_sample = clock::zero();
// just as soon as a delayed context comes back and triggers it.
// These sets just prevent us from spawning extra timer contexts for
// dirfrags that already have one in flight.
- set<dirfrag_t> split_pending, merge_pending;
+ std::set<dirfrag_t> split_pending, merge_pending;
// per-epoch scatter/gathered info
std::map<mds_rank_t, mds_load_t> mds_load;
std::map<mds_rank_t, double> mds_meta_load;
- std::map<mds_rank_t, map<mds_rank_t, float> > mds_import_map;
+ std::map<mds_rank_t, std::map<mds_rank_t, float> > mds_import_map;
std::map<mds_rank_t, int> mds_last_epoch_under_map;
// per-epoch state
#define dout_subsys ceph_subsys_mds
#undef dout_prefix
#define dout_prefix _prefix(_dout, mds)
+
+using namespace std;
+
static ostream& _prefix(std::ostream *_dout, MDSRank *mds) {
return *_dout << "mds." << mds->get_nodeid() << ".cache ";
}
bool path_locked = false;
mds_rank_t hint = MDS_RANK_NONE;
mds_rank_t checking = MDS_RANK_NONE;
- set<mds_rank_t> checked;
+ std::set<mds_rank_t> checked;
};
friend class C_MDC_RejoinOpenInoFinish;
void adjust_subtree_auth(CDir *root, mds_rank_t a, mds_rank_t b=CDIR_AUTH_UNKNOWN) {
adjust_subtree_auth(root, mds_authority_t(a,b));
}
- void adjust_bounded_subtree_auth(CDir *dir, const set<CDir*>& bounds, mds_authority_t auth);
- void adjust_bounded_subtree_auth(CDir *dir, const set<CDir*>& bounds, mds_rank_t a) {
+ void adjust_bounded_subtree_auth(CDir *dir, const std::set<CDir*>& bounds, mds_authority_t auth);
+ void adjust_bounded_subtree_auth(CDir *dir, const std::set<CDir*>& bounds, mds_rank_t a) {
adjust_bounded_subtree_auth(dir, bounds, mds_authority_t(a, CDIR_AUTH_UNKNOWN));
}
- void adjust_bounded_subtree_auth(CDir *dir, const vector<dirfrag_t>& bounds, const mds_authority_t &auth);
- void adjust_bounded_subtree_auth(CDir *dir, const vector<dirfrag_t>& bounds, mds_rank_t a) {
+ void adjust_bounded_subtree_auth(CDir *dir, const std::vector<dirfrag_t>& bounds, const mds_authority_t &auth);
+ void adjust_bounded_subtree_auth(CDir *dir, const std::vector<dirfrag_t>& bounds, mds_rank_t a) {
adjust_bounded_subtree_auth(dir, bounds, mds_authority_t(a, CDIR_AUTH_UNKNOWN));
}
- void map_dirfrag_set(const list<dirfrag_t>& dfs, set<CDir*>& result);
+ void map_dirfrag_set(const std::list<dirfrag_t>& dfs, std::set<CDir*>& result);
void try_subtree_merge(CDir *root);
- void try_subtree_merge_at(CDir *root, set<CInode*> *to_eval, bool adjust_pop=true);
+ void try_subtree_merge_at(CDir *root, std::set<CInode*> *to_eval, bool adjust_pop=true);
void eval_subtree_root(CInode *diri);
CDir *get_subtree_root(CDir *dir);
CDir *get_projected_subtree_root(CDir *dir);
bool is_subtree(CDir *root) {
return subtrees.count(root);
}
- void get_subtree_bounds(CDir *root, set<CDir*>& bounds);
- void get_wouldbe_subtree_bounds(CDir *root, set<CDir*>& bounds);
- void verify_subtree_bounds(CDir *root, const set<CDir*>& bounds);
- void verify_subtree_bounds(CDir *root, const list<dirfrag_t>& bounds);
+ void get_subtree_bounds(CDir *root, std::set<CDir*>& bounds);
+ void get_wouldbe_subtree_bounds(CDir *root, std::set<CDir*>& bounds);
+ void verify_subtree_bounds(CDir *root, const std::set<CDir*>& bounds);
+ void verify_subtree_bounds(CDir *root, const std::list<dirfrag_t>& bounds);
void project_subtree_rename(CInode *diri, CDir *olddir, CDir *newdir);
void adjust_subtree_after_rename(CInode *diri, CDir *olddir, bool pop);
return active_requests.count(rid);
}
MDRequestRef request_get(metareqid_t rid);
- void request_pin_ref(MDRequestRef& r, CInode *ref, vector<CDentry*>& trace);
+ void request_pin_ref(MDRequestRef& r, CInode *ref, std::vector<CDentry*>& trace);
void request_finish(MDRequestRef& mdr);
void request_forward(MDRequestRef& mdr, mds_rank_t mds, int port=0);
void dispatch_request(MDRequestRef& mdr);
snapid_t follows=CEPH_NOSNAP);
// peers
- void add_uncommitted_leader(metareqid_t reqid, LogSegment *ls, set<mds_rank_t> &peers, bool safe=false) {
+ void add_uncommitted_leader(metareqid_t reqid, LogSegment *ls, std::set<mds_rank_t> &peers, bool safe=false) {
uncommitted_leaders[reqid].ls = ls;
uncommitted_leaders[reqid].peers = peers;
uncommitted_leaders[reqid].safe = safe;
MDPeerUpdate* get_uncommitted_peer(metareqid_t reqid, mds_rank_t leader);
void _logged_peer_commit(mds_rank_t from, metareqid_t reqid);
- void set_recovery_set(set<mds_rank_t>& s);
+ void set_recovery_set(std::set<mds_rank_t>& s);
void handle_mds_failure(mds_rank_t who);
void handle_mds_recovery(mds_rank_t who);
void finish_rollback(metareqid_t reqid, MDRequestRef& mdr);
// ambiguous imports
- void add_ambiguous_import(dirfrag_t base, const vector<dirfrag_t>& bounds);
- void add_ambiguous_import(CDir *base, const set<CDir*>& bounds);
+ void add_ambiguous_import(dirfrag_t base, const std::vector<dirfrag_t>& bounds);
+ void add_ambiguous_import(CDir *base, const std::set<CDir*>& bounds);
bool have_ambiguous_import(dirfrag_t base) {
return my_ambiguous_imports.count(base);
}
- void get_ambiguous_import_bounds(dirfrag_t base, vector<dirfrag_t>& bounds) {
+ void get_ambiguous_import_bounds(dirfrag_t base, std::vector<dirfrag_t>& bounds) {
ceph_assert(my_ambiguous_imports.count(base));
bounds = my_ambiguous_imports[base];
}
}
void _move_subtree_map_bound(dirfrag_t df, dirfrag_t oldparent, dirfrag_t newparent,
- map<dirfrag_t,vector<dirfrag_t> >& subtrees);
+ std::map<dirfrag_t,std::vector<dirfrag_t> >& subtrees);
ESubtreeMap *create_subtree_map();
void clean_open_file_lists();
void rejoin_open_ino_finish(inodeno_t ino, int ret);
void rejoin_prefetch_ino_finish(inodeno_t ino, int ret);
- void rejoin_open_sessions_finish(map<client_t,pair<Session*,uint64_t> >& session_map);
+ void rejoin_open_sessions_finish(std::map<client_t,std::pair<Session*,uint64_t> >& session_map);
bool process_imported_caps();
void choose_lock_states_and_reconnect_caps();
void prepare_realm_split(SnapRealm *realm, client_t client, inodeno_t ino,
- map<client_t,ref_t<MClientSnap>>& splits);
- void prepare_realm_merge(SnapRealm *realm, SnapRealm *parent_realm, map<client_t,ref_t<MClientSnap>>& splits);
- void send_snaps(map<client_t,ref_t<MClientSnap>>& splits);
+ std::map<client_t,ref_t<MClientSnap>>& splits);
+ void prepare_realm_merge(SnapRealm *realm, SnapRealm *parent_realm, std::map<client_t,ref_t<MClientSnap>>& splits);
+ void send_snaps(std::map<client_t,ref_t<MClientSnap>>& splits);
Capability* rejoin_import_cap(CInode *in, client_t client, const cap_reconnect_t& icr, mds_rank_t frommds);
void finish_snaprealm_reconnect(client_t client, SnapRealm *realm, snapid_t seq,
- map<client_t,ref_t<MClientSnap>>& updates);
+ std::map<client_t,ref_t<MClientSnap>>& updates);
Capability* try_reconnect_cap(CInode *in, Session *session);
void export_remaining_imported_caps();
CDir *get_auth_container(CDir *in);
CDir *get_export_container(CDir *dir);
- void find_nested_exports(CDir *dir, set<CDir*>& s);
- void find_nested_exports_under(CDir *import, CDir *dir, set<CDir*>& s);
+ void find_nested_exports(CDir *dir, std::set<CDir*>& s);
+ void find_nested_exports_under(CDir *import, CDir *dir, std::set<CDir*>& s);
void init_layouts();
void create_unlinked_system_inode(CInode *in, inodeno_t ino,
*/
int path_traverse(MDRequestRef& mdr, MDSContextFactory& cf,
const filepath& path, int flags,
- vector<CDentry*> *pdnvec, CInode **pin=nullptr);
+ std::vector<CDentry*> *pdnvec, CInode **pin=nullptr);
CInode *cache_traverse(const filepath& path);
void open_remote_dirfrag(CInode *diri, frag_t fg, MDSContext *fin);
CInode *get_dentry_inode(CDentry *dn, MDRequestRef& mdr, bool projected=false);
- bool parallel_fetch(map<inodeno_t,filepath>& pathmap, set<inodeno_t>& missing);
+ bool parallel_fetch(std::map<inodeno_t,filepath>& pathmap, std::set<inodeno_t>& missing);
bool parallel_fetch_traverse_dir(inodeno_t ino, filepath& path,
- set<CDir*>& fetch_queue, set<inodeno_t>& missing,
+ std::set<CDir*>& fetch_queue, std::set<inodeno_t>& missing,
C_GatherBuilder &gather_bld);
void open_remote_dentry(CDentry *dn, bool projected, MDSContext *fin,
void _open_remote_dentry_finish(CDentry *dn, inodeno_t ino, MDSContext *fin,
bool want_xlocked, int r);
- void make_trace(vector<CDentry*>& trace, CInode *in);
+ void make_trace(std::vector<CDentry*>& trace, CInode *in);
void kick_open_ino_peers(mds_rank_t who);
void open_ino(inodeno_t ino, int64_t pool, MDSContext *fin,
bool want_replica=true, bool want_xlocked=false,
- vector<inode_backpointer_t> *ancestors_hint=nullptr,
+ std::vector<inode_backpointer_t> *ancestors_hint=nullptr,
mds_rank_t auth_hint=MDS_RANK_NONE);
void find_ino_peers(inodeno_t ino, MDSContext *c,
// -- client caps --
uint64_t last_cap_id = 0;
- map<ceph_tid_t, discover_info_t> discovers;
+ std::map<ceph_tid_t, discover_info_t> discovers;
ceph_tid_t discover_last_tid = 0;
// waiters
- map<int, map<inodeno_t, MDSContext::vec > > waiting_for_base_ino;
+ std::map<int, std::map<inodeno_t, MDSContext::vec > > waiting_for_base_ino;
- map<inodeno_t,map<client_t, reconnected_cap_info_t> > reconnected_caps; // inode -> client -> snap_follows,realmino
- map<inodeno_t,map<client_t, snapid_t> > reconnected_snaprealms; // realmino -> client -> realmseq
+ std::map<inodeno_t,std::map<client_t, reconnected_cap_info_t> > reconnected_caps; // inode -> client -> snap_follows,realmino
+ std::map<inodeno_t,std::map<client_t, snapid_t> > reconnected_snaprealms; // realmino -> client -> realmseq
// realm inodes
- set<CInode*> rejoin_pending_snaprealms;
+ std::set<CInode*> rejoin_pending_snaprealms;
// cap imports. delayed snap parent opens.
- map<client_t,set<CInode*> > delayed_imported_caps;
+ std::map<client_t,std::set<CInode*> > delayed_imported_caps;
// subsystems
std::unique_ptr<Migrator> migrator;
bool did_shutdown_log_cap = false;
- map<ceph_tid_t, find_ino_peer_info_t> find_ino_peer;
+ std::map<ceph_tid_t, find_ino_peer_info_t> find_ino_peer;
ceph_tid_t find_ino_peer_last_tid = 0;
// delayed cache expire
- map<CDir*, expiremap> delayed_expire; // subtree root -> expire msg
+ std::map<CDir*, expiremap> delayed_expire; // subtree root -> expire msg
/* Because exports may fail, this set lets us keep track of inodes that need exporting. */
std::set<CInode *> export_pin_queue;
// track leader requests whose peers haven't acknowledged commit
struct uleader {
uleader() {}
- set<mds_rank_t> peers;
+ std::set<mds_rank_t> peers;
LogSegment *ls = nullptr;
MDSContext::vec waiters;
bool safe = false;
struct open_ino_info_t {
open_ino_info_t() {}
- vector<inode_backpointer_t> ancestors;
- set<mds_rank_t> checked;
+ std::vector<inode_backpointer_t> ancestors;
+ std::set<mds_rank_t> checked;
mds_rank_t checking = MDS_RANK_NONE;
mds_rank_t auth_hint = MDS_RANK_NONE;
bool check_peers = true;
CDir* rejoin_invent_dirfrag(dirfrag_t df);
void handle_cache_rejoin_strong(const cref_t<MMDSCacheRejoin> &m);
void rejoin_scour_survivor_replicas(mds_rank_t from, const cref_t<MMDSCacheRejoin> &ack,
- set<vinodeno_t>& acked_inodes,
- set<SimpleLock *>& gather_locks);
+ std::set<vinodeno_t>& acked_inodes,
+ std::set<SimpleLock *>& gather_locks);
void handle_cache_rejoin_ack(const cref_t<MMDSCacheRejoin> &m);
void rejoin_send_acks();
void rejoin_trim_undef_inodes();
}
void inode_remove_replica(CInode *in, mds_rank_t rep, bool rejoin,
- set<SimpleLock *>& gather_locks);
- void dentry_remove_replica(CDentry *dn, mds_rank_t rep, set<SimpleLock *>& gather_locks);
+ std::set<SimpleLock *>& gather_locks);
+ void dentry_remove_replica(CDentry *dn, mds_rank_t rep, std::set<SimpleLock *>& gather_locks);
void rename_file(CDentry *srcdn, CDentry *destdn);
void _open_ino_traverse_dir(inodeno_t ino, open_ino_info_t& info, int err);
void _open_ino_fetch_dir(inodeno_t ino, const cref_t<MMDSOpenIno> &m, CDir *dir, bool parent);
int open_ino_traverse_dir(inodeno_t ino, const cref_t<MMDSOpenIno> &m,
- const vector<inode_backpointer_t>& ancestors,
+ const std::vector<inode_backpointer_t>& ancestors,
bool discover, bool want_xlocked, mds_rank_t *hint);
void open_ino_finish(inodeno_t ino, open_ino_info_t& info, int err);
void do_open_ino(inodeno_t ino, open_ino_info_t& info, int err);
void rdlock_dirfrags_stats_work(MDRequestRef& mdr);
ceph::unordered_map<inodeno_t,CInode*> inode_map; // map of head inodes by ino
- map<vinodeno_t, CInode*> snap_inode_map; // map of snap inodes by ino
+ std::map<vinodeno_t, CInode*> snap_inode_map; // map of snap inodes by ino
CInode *root = nullptr; // root inode
CInode *myin = nullptr; // .ceph/mds%d dir
int stray_index = 0;
int stray_fragmenting_index = -1;
- set<CInode*> base_inodes;
+ std::set<CInode*> base_inodes;
std::unique_ptr<PerfCounters> logger;
std::array<xlist<ClientLease*>, client_lease_pools> client_leases{};
/* subtree keys and each tree's non-recursive nested subtrees (the "bounds") */
- map<CDir*,set<CDir*> > subtrees;
- map<CInode*,list<pair<CDir*,CDir*> > > projected_subtree_renames; // renamed ino -> target dir
+ std::map<CDir*,std::set<CDir*> > subtrees;
+ std::map<CInode*,std::list<std::pair<CDir*,CDir*> > > projected_subtree_renames; // renamed ino -> target dir
// -- requests --
ceph::unordered_map<metareqid_t, MDRequestRef> active_requests;
// -- recovery --
- set<mds_rank_t> recovery_set;
+ std::set<mds_rank_t> recovery_set;
// [resolve]
// from EImportStart w/o EImportFinish during journal replay
- map<dirfrag_t, vector<dirfrag_t> > my_ambiguous_imports;
+ std::map<dirfrag_t, std::vector<dirfrag_t> > my_ambiguous_imports;
// from MMDSResolves
- map<mds_rank_t, map<dirfrag_t, vector<dirfrag_t> > > other_ambiguous_imports;
+ std::map<mds_rank_t, std::map<dirfrag_t, std::vector<dirfrag_t> > > other_ambiguous_imports;
- map<CInode*, int> uncommitted_peer_rename_olddir; // peer: preserve the non-auth dir until seeing commit.
- map<CInode*, int> uncommitted_peer_unlink; // peer: preserve the unlinked inode until seeing commit.
+ std::map<CInode*, int> uncommitted_peer_rename_olddir; // peer: preserve the non-auth dir until seeing commit.
+ std::map<CInode*, int> uncommitted_peer_unlink; // peer: preserve the unlinked inode until seeing commit.
- map<metareqid_t, uleader> uncommitted_leaders; // leader: req -> peer set
- map<metareqid_t, upeer> uncommitted_peers; // peer: preserve the peer req until seeing commit.
+ std::map<metareqid_t, uleader> uncommitted_leaders; // leader: req -> peer set
+ std::map<metareqid_t, upeer> uncommitted_peers; // peer: preserve the peer req until seeing commit.
- set<metareqid_t> pending_leaders;
- map<int, set<metareqid_t> > ambiguous_peer_updates;
+ std::set<metareqid_t> pending_leaders;
+ std::map<int, std::set<metareqid_t> > ambiguous_peer_updates;
bool resolves_pending = false;
- set<mds_rank_t> resolve_gather; // nodes i need resolves from
- set<mds_rank_t> resolve_ack_gather; // nodes i need a resolve_ack from
- set<version_t> resolve_snapclient_commits;
- map<metareqid_t, mds_rank_t> resolve_need_rollback; // rollbacks i'm writing to the journal
- map<mds_rank_t, cref_t<MMDSResolve>> delayed_resolve;
+ std::set<mds_rank_t> resolve_gather; // nodes i need resolves from
+ std::set<mds_rank_t> resolve_ack_gather; // nodes i need a resolve_ack from
+ std::set<version_t> resolve_snapclient_commits;
+ std::map<metareqid_t, mds_rank_t> resolve_need_rollback; // rollbacks i'm writing to the journal
+ std::map<mds_rank_t, cref_t<MMDSResolve>> delayed_resolve;
// [rejoin]
bool rejoins_pending = false;
- set<mds_rank_t> rejoin_gather; // nodes from whom i need a rejoin
- set<mds_rank_t> rejoin_sent; // nodes i sent a rejoin to
- set<mds_rank_t> rejoin_ack_sent; // nodes i sent a rejoin to
- set<mds_rank_t> rejoin_ack_gather; // nodes from whom i need a rejoin ack
- map<mds_rank_t,map<inodeno_t,map<client_t,Capability::Import> > > rejoin_imported_caps;
- map<inodeno_t,pair<mds_rank_t,map<client_t,Capability::Export> > > rejoin_peer_exports;
-
- map<client_t,entity_inst_t> rejoin_client_map;
- map<client_t,client_metadata_t> rejoin_client_metadata_map;
- map<client_t,pair<Session*,uint64_t> > rejoin_session_map;
-
- map<inodeno_t,pair<mds_rank_t,map<client_t,cap_reconnect_t> > > cap_exports; // ino -> target, client -> capex
-
- map<inodeno_t,map<client_t,map<mds_rank_t,cap_reconnect_t> > > cap_imports; // ino -> client -> frommds -> capex
- set<inodeno_t> cap_imports_missing;
- map<inodeno_t, MDSContext::vec > cap_reconnect_waiters;
+ std::set<mds_rank_t> rejoin_gather; // nodes from whom i need a rejoin
+ std::set<mds_rank_t> rejoin_sent; // nodes i sent a rejoin to
+ std::set<mds_rank_t> rejoin_ack_sent; // nodes i sent a rejoin to
+ std::set<mds_rank_t> rejoin_ack_gather; // nodes from whom i need a rejoin ack
+ std::map<mds_rank_t,std::map<inodeno_t,std::map<client_t,Capability::Import> > > rejoin_imported_caps;
+ std::map<inodeno_t,std::pair<mds_rank_t,std::map<client_t,Capability::Export> > > rejoin_peer_exports;
+
+ std::map<client_t,entity_inst_t> rejoin_client_map;
+ std::map<client_t,client_metadata_t> rejoin_client_metadata_map;
+ std::map<client_t,std::pair<Session*,uint64_t> > rejoin_session_map;
+
+ std::map<inodeno_t,std::pair<mds_rank_t,std::map<client_t,cap_reconnect_t> > > cap_exports; // ino -> target, client -> capex
+
+ std::map<inodeno_t,std::map<client_t,std::map<mds_rank_t,cap_reconnect_t> > > cap_imports; // ino -> client -> frommds -> capex
+ std::set<inodeno_t> cap_imports_missing;
+ std::map<inodeno_t, MDSContext::vec > cap_reconnect_waiters;
int cap_imports_num_opening = 0;
- set<CInode*> rejoin_undef_inodes;
- set<CInode*> rejoin_potential_updated_scatterlocks;
- set<CDir*> rejoin_undef_dirfrags;
- map<mds_rank_t, set<CInode*> > rejoin_unlinked_inodes;
+ std::set<CInode*> rejoin_undef_inodes;
+ std::set<CInode*> rejoin_potential_updated_scatterlocks;
+ std::set<CDir*> rejoin_undef_dirfrags;
+ std::map<mds_rank_t, std::set<CInode*> > rejoin_unlinked_inodes;
- vector<CInode*> rejoin_recover_q, rejoin_check_q;
- list<SimpleLock*> rejoin_eval_locks;
+ std::vector<CInode*> rejoin_recover_q, rejoin_check_q;
+ std::list<SimpleLock*> rejoin_eval_locks;
MDSContext::vec rejoin_waiters;
std::unique_ptr<MDSContext> rejoin_done;
std::unique_ptr<MDSContext> resolve_done;
ceph_tid_t open_ino_last_tid = 0;
- map<inodeno_t,open_ino_info_t> opening_inodes;
+ std::map<inodeno_t,open_ino_info_t> opening_inodes;
StrayManager stray_manager;
std::vector<CDir*> dirs;
std::vector<CDir*> resultfrags;
MDRequestRef mdr;
- set<mds_rank_t> notify_ack_waiting;
+ std::set<mds_rank_t> notify_ack_waiting;
bool finishing = false;
// for deadlock detection
int num_remote_waiters = 0; // number of remote authpin waiters
};
- typedef map<dirfrag_t,fragment_info_t>::iterator fragment_info_iterator;
+ typedef std::map<dirfrag_t,fragment_info_t>::iterator fragment_info_iterator;
friend class EFragment;
friend class C_MDC_FragmentFrozen;
MDSContext::vec& waiters,
bool replay);
CDir *force_dir_fragment(CInode *diri, frag_t fg, bool replay=true);
- void get_force_dirfrag_bound_set(const vector<dirfrag_t>& dfs, set<CDir*>& bounds);
+ void get_force_dirfrag_bound_set(const std::vector<dirfrag_t>& dfs, std::set<CDir*>& bounds);
bool can_fragment(CInode *diri, const std::vector<CDir*>& dirs);
void fragment_freeze_dirs(const std::vector<CDir*>& dirs);
RecoveryQueue recovery_queue;
// shutdown
- set<inodeno_t> shutdown_exporting_strays;
- pair<dirfrag_t, string> shutdown_export_next;
+ std::set<inodeno_t> shutdown_exporting_strays;
+ std::pair<dirfrag_t, std::string> shutdown_export_next;
bool opening_root = false, open = false;
MDSContext::vec waiting_for_open;
// -- snaprealms --
SnapRealm *global_snaprealm = nullptr;
- map<dirfrag_t, ufragment> uncommitted_fragments;
+ std::map<dirfrag_t, ufragment> uncommitted_fragments;
- map<dirfrag_t,fragment_info_t> fragments;
+ std::map<dirfrag_t,fragment_info_t> fragments;
DecayCounter trim_counter;
#undef dout_prefix
#define dout_prefix *_dout << "mds." << mds->get_nodeid() << ".log "
+using namespace std;
+
// cons/des
MDLog::~MDLog()
{
MDSRank *mds;
// replay state
- std::map<inodeno_t, set<inodeno_t>> pending_exports;
+ std::map<inodeno_t, std::set<inodeno_t>> pending_exports;
protected:
struct PendingEvent {
// -- segments --
std::map<uint64_t,LogSegment*> segments;
- set<LogSegment*> expiring_segments;
- set<LogSegment*> expired_segments;
+ std::set<LogSegment*> expiring_segments;
+ std::set<LogSegment*> expired_segments;
std::size_t pre_segments_size = 0; // the num of segments when the mds finished replay-journal, to calc the num of segments growing
uint64_t event_seq = 0;
int expiring_events = 0;
int expired_events = 0;
int64_t mdsmap_up_features = 0;
- std::map<uint64_t,list<PendingEvent> > pending_events; // log segment -> event list
+ std::map<uint64_t,std::list<PendingEvent> > pending_events; // log segment -> event list
ceph::mutex submit_mutex = ceph::make_mutex("MDLog::submit_mutex");
ceph::condition_variable submit_cond;
#define dout_subsys ceph_subsys_mds
#undef dout_prefix
#define dout_prefix *_dout << "mds." << name << ' '
+
+using std::string;
+using std::vector;
using TOPNSPC::common::cmd_getval;
+
// cons/des
MDSDaemon::MDSDaemon(std::string_view n, Messenger *m, MonClient *mc,
boost::asio::io_context& ioctx) :
mono_time get_starttime() const {
return starttime;
}
- chrono::duration<double> get_uptime() const {
+ std::chrono::duration<double> get_uptime() const {
mono_time now = mono_clock::now();
- return chrono::duration<double>(now-starttime);
+ return std::chrono::duration<double>(now-starttime);
}
// handle a signal (e.g., SIGTERM)
using std::multimap;
using std::ostream;
using std::pair;
-using std::string;
using std::set;
+using std::string;
+using std::vector;
using ceph::bufferlist;
using ceph::Formatter;
#define dout_subsys ceph_subsys_mds
#undef dout_prefix
#define dout_prefix *_dout << "mds." << whoami << '.' << incarnation << ' '
+
+using std::ostream;
+using std::set;
+using std::string;
+using std::vector;
using TOPNSPC::common::cmd_getval;
+
class C_Flush_Journal : public MDSInternalContext {
public:
C_Flush_Journal(MDCache *mdcache, MDLog *mdlog, MDSRank *mds,
mono_time get_starttime() const {
return starttime;
}
- chrono::duration<double> get_uptime() const {
+ std::chrono::duration<double> get_uptime() const {
mono_time now = mono_clock::now();
- return chrono::duration<double>(now-starttime);
+ return std::chrono::duration<double>(now-starttime);
}
bool is_daemon_stopping() const;
void hit_export_target(mds_rank_t rank, double amount=-1.0);
bool is_export_target(mds_rank_t rank) {
- const set<mds_rank_t>& map_targets = mdsmap->get_mds_info(get_nodeid()).export_targets;
+ const std::set<mds_rank_t>& map_targets = mdsmap->get_mds_info(get_nodeid()).export_targets;
return map_targets.count(rank);
}
void dump_clientreplay_status(Formatter *f) const;
void command_scrub_start(Formatter *f,
std::string_view path, std::string_view tag,
- const vector<string>& scrubop_vec, Context *on_finish);
+ const std::vector<std::string>& scrubop_vec, Context *on_finish);
void command_tag_path(Formatter *f, std::string_view path,
std::string_view tag);
// scrub control commands
MetricsHandler metrics_handler;
std::unique_ptr<MetricAggregator> metric_aggregator;
- list<cref_t<Message>> waiting_for_nolaggy;
+ std::list<cref_t<Message>> waiting_for_nolaggy;
MDSContext::que finished_queue;
// Dispatch, retry, queues
int dispatch_depth = 0;
ceph::heartbeat_handle_d *hb = nullptr; // Heartbeat for threads using mds_lock
double heartbeat_grace;
- map<mds_rank_t, version_t> peer_mdsmap_epoch;
+ std::map<mds_rank_t, version_t> peer_mdsmap_epoch;
ceph_tid_t last_tid = 0; // for mds-initiated requests (e.g. stray rename)
MDSContext::que replay_queue;
bool replaying_requests_done = false;
- map<mds_rank_t, MDSContext::vec > waiting_for_active_peer;
- map<epoch_t, MDSContext::vec > waiting_for_mdsmap;
+ std::map<mds_rank_t, MDSContext::vec > waiting_for_active_peer;
+ std::map<epoch_t, MDSContext::vec > waiting_for_mdsmap;
epoch_t osd_epoch_barrier = 0;
int mds_slow_req_count = 0;
- map<mds_rank_t,DecayCounter> export_targets; /* targets this MDS is exporting to or wants/tries to */
+ std::map<mds_rank_t,DecayCounter> export_targets; /* targets this MDS is exporting to or wants/tries to */
Messenger *messenger;
MonClient *monc;
#undef dout_prefix
#define dout_prefix *_dout << "mds." << rank << "." << table_name << ": "
+using namespace std;
class MDSTableIOContext : public MDSIOContextBase
{
version_t version = 0, committing_version = 0, committed_version = 0, projected_version = 0;
- map<version_t, MDSContext::vec > waitfor_save;
+ std::map<version_t, MDSContext::vec > waitfor_save;
};
#endif
void MDSTableClient::resend_commits()
{
- for (map<version_t,LogSegment*>::iterator p = pending_commit.begin();
- p != pending_commit.end();
- ++p) {
+ for (auto p = pending_commit.begin(); p != pending_commit.end(); ++p) {
dout(10) << "resending commit on " << p->first << dendl;
auto req = make_message<MMDSTableRequest>(table, TABLESERVER_OP_COMMIT, 0, p->first);
mds->send_message_mds(req, mds->get_mds_map()->get_tableserver());
waiting_for_reqid.pop_front();
}
- for (map<uint64_t, _pending_prepare>::iterator p = pending_prepare.begin();
- p != pending_prepare.end();
- ++p) {
+ for (auto p = pending_prepare.begin(); p != pending_prepare.end(); ++p) {
dout(10) << "resending prepare on " << p->first << dendl;
auto req = make_message<MMDSTableRequest>(table, TABLESERVER_OP_PREPARE, p->first);
req->bl = p->second.mutation;
ack_waiters[tid].push_back(c);
}
- set<version_t> get_journaled_tids() const {
- set<version_t> tids;
+ std::set<version_t> get_journaled_tids() const {
+ std::set<version_t> tids;
for (auto p : pending_commit)
tids.insert(p.first);
return tids;
bool server_ready = false;
- map<uint64_t, _pending_prepare> pending_prepare;
- map<version_t, uint64_t> prepared_update;
- list<_pending_prepare> waiting_for_reqid;
+ std::map<uint64_t, _pending_prepare> pending_prepare;
+ std::map<version_t, uint64_t> prepared_update;
+ std::list<_pending_prepare> waiting_for_reqid;
// pending commits
- map<version_t, LogSegment*> pending_commit;
- map<version_t, MDSContext::vec > ack_waiters;
+ std::map<version_t, LogSegment*> pending_commit;
+ std::map<version_t, MDSContext::vec > ack_waiters;
};
#endif
#undef dout_prefix
#define dout_prefix *_dout << "mds." << rank << ".tableserver(" << get_mdstable_name(table) << ") "
+using namespace std;
+
void MDSTableServer::handle_request(const cref_t<MMDSTableRequest> &req)
{
ceph_assert(req->op >= 0);
}
// recovery
- void finish_recovery(set<mds_rank_t>& active);
+ void finish_recovery(std::set<mds_rank_t>& active);
void _do_server_recovery();
void handle_mds_recovery(mds_rank_t who);
protected:
int table;
bool recovered = false;
- set<mds_rank_t> active_clients;
+ std::set<mds_rank_t> active_clients;
private:
struct notify_info_t {
notify_info_t() {}
- set<mds_rank_t> notify_ack_gather;
+ std::set<mds_rank_t> notify_ack_gather;
mds_rank_t mds;
ref_t<MMDSTableRequest> reply = NULL;
MDSContext *onfinish = nullptr;
void handle_notify_ack(const cref_t<MMDSTableRequest> &m);
- map<version_t,mds_table_pending_t> pending_for_mds; // ** child should encode this! **
- set<version_t> committing_tids;
+ std::map<version_t,mds_table_pending_t> pending_for_mds; // ** child should encode this! **
+ std::set<version_t> committing_tids;
- map<version_t, notify_info_t> pending_notifies;
+ std::map<version_t, notify_info_t> pending_notifies;
};
#endif
#undef dout_prefix
#define dout_prefix *_dout << "mds." << mds->get_nodeid() << ".mig " << __func__ << " "
+using namespace std;
class MigratorContext : public MDSContext {
protected:
}
void maybe_split_export(CDir* dir, uint64_t max_size, bool null_okay,
- vector<pair<CDir*, size_t> >& results);
+ std::vector<std::pair<CDir*, size_t> >& results);
bool export_try_grab_locks(CDir *dir, MutationRef& mut);
void get_export_client_set(CDir *dir, std::set<client_t> &client_set);
void decode_import_inode_caps(CInode *in, bool auth_cap, bufferlist::const_iterator &blp,
std::map<CInode*, std::map<client_t,Capability::Export> >& cap_imports);
void finish_import_inode_caps(CInode *in, mds_rank_t from, bool auth_cap,
- const std::map<client_t,pair<Session*,uint64_t> >& smap,
+ const std::map<client_t,std::pair<Session*,uint64_t> >& smap,
const std::map<client_t,Capability::Export> &export_map,
std::map<client_t,Capability::Import> &import_map);
void decode_import_dir(bufferlist::const_iterator& blp,
std::set<mds_rank_t> bystanders;
std::list<dirfrag_t> bound_ls;
std::list<ScatterLock*> updated_scatterlocks;
- std::map<client_t,pair<Session*,uint64_t> > session_map;
+ std::map<client_t,std::pair<Session*,uint64_t> > session_map;
std::map<CInode*, std::map<client_t,Capability::Export> > peer_exports;
MutationRef mut;
};
- typedef map<CDir*, export_state_t>::iterator export_state_iterator;
+ typedef std::map<CDir*, export_state_t>::iterator export_state_iterator;
friend class C_MDC_ExportFreeze;
friend class C_MDS_ExportFinishLogged;
void export_finish(CDir *dir);
void child_export_finish(std::shared_ptr<export_base_t>& parent, bool success);
void encode_export_prep_trace(bufferlist& bl, CDir *bound, CDir *dir, export_state_t &es,
- set<inodeno_t> &inodes_added, set<dirfrag_t> &dirfrags_added);
+ std::set<inodeno_t> &inodes_added, std::set<dirfrag_t> &dirfrags_added);
void decode_export_prep_trace(bufferlist::const_iterator& blp, mds_rank_t oldauth, MDSContext::vec &finished);
void handle_gather_caps(const cref_t<MGatherCaps> &m);
void import_notify_abort(CDir *dir, std::set<CDir*>& bounds);
void import_notify_finish(CDir *dir, std::set<CDir*>& bounds);
void import_logged_start(dirfrag_t df, CDir *dir, mds_rank_t from,
- std::map<client_t,pair<Session*,uint64_t> >& imported_session_map);
+ std::map<client_t,std::pair<Session*,uint64_t> >& imported_session_map);
void handle_export_finish(const cref_t<MExportDirFinish> &m);
void handle_export_caps(const cref_t<MExportCaps> &m);
void handle_export_caps_ack(const cref_t<MExportCapsAck> &m);
void logged_import_caps(CInode *in,
mds_rank_t from,
- std::map<client_t,pair<Session*,uint64_t> >& imported_session_map,
+ std::map<client_t,std::pair<Session*,uint64_t> >& imported_session_map,
std::map<CInode*, std::map<client_t,Capability::Export> >& cap_imports);
// bystander
uint64_t total_exporting_size = 0;
unsigned num_locking_exports = 0; // exports in locking state (approx_size == 0)
- std::list<pair<dirfrag_t,mds_rank_t> > export_queue;
+ std::list<std::pair<dirfrag_t,mds_rank_t> > export_queue;
uint64_t export_queue_gen = 1;
std::map<dirfrag_t, import_state_t> import_state;
#include "CInode.h"
#include "CDir.h"
+using namespace std;
+
// MutationImpl
void MutationImpl::pin(MDSCacheObject *o)
#define dout_subsys ceph_subsys_mds
#undef dout_prefix
#define dout_prefix _prefix(_dout, mds)
-static ostream& _prefix(std::ostream *_dout, MDSRank *mds) {
+
+using namespace std;
+
+static std::ostream& _prefix(std::ostream *_dout, MDSRank *mds) {
return *_dout << "mds." << mds->get_nodeid() << ".openfiles ";
}
class CInode;
class MDSRank;
+struct ObjectOperation;
+
class OpenFileTable
{
public:
bool should_log_open(CInode *in);
- void note_destroyed_inos(uint64_t seq, const vector<inodeno_t>& inos);
+ void note_destroyed_inos(uint64_t seq, const std::vector<inodeno_t>& inos);
void trim_destroyed_inos(uint64_t seq);
protected:
void _prefetch_dirfrags();
void _get_ancestors(const Anchor& parent,
- vector<inode_backpointer_t>& ancestors,
+ std::vector<inode_backpointer_t>& ancestors,
mds_rank_t& auth_hint);
MDSRank *mds;
unsigned omap_num_objs = 0;
std::vector<unsigned> omap_num_items;
- map<inodeno_t, OpenedAnchor> anchor_map;
+ std::map<inodeno_t, OpenedAnchor> anchor_map;
std::map<inodeno_t, int> dirty_items; // ino -> dirty state
int journal_state = 0;
std::vector<std::map<std::string, bufferlist> > loaded_journals;
- map<inodeno_t, RecoveredAnchor> loaded_anchor_map;
+ std::map<inodeno_t, RecoveredAnchor> loaded_anchor_map;
MDSContext::vec waiting_for_load;
bool load_done = false;
unsigned num_opening_inodes = 0;
MDSContext::vec waiting_for_prefetch;
- std::map<uint64_t, vector<inodeno_t> > logseg_destroyed_inos;
+ std::map<uint64_t, std::vector<inodeno_t> > logseg_destroyed_inos;
std::set<inodeno_t> destroyed_inos_set;
std::unique_ptr<PerfCounters> logger;
#define dout_subsys ceph_subsys_mds
#undef dout_prefix
#define dout_prefix _prefix(_dout, rank) << __func__ << ": "
+
+using namespace std;
+
static ostream& _prefix(std::ostream *_dout, mds_rank_t rank) {
return *_dout << "mds." << rank << ".purge_queue ";
}
#undef dout_prefix
#define dout_prefix *_dout << "mds." << mds->get_nodeid() << " RecoveryQueue::" << __func__ << " "
+using namespace std;
+
class C_MDC_Recover : public MDSIOContextBase {
public:
C_MDC_Recover(RecoveryQueue *rq_, CInode *i) :
#define dout_subsys ceph_subsys_mds
#undef dout_prefix
#define dout_prefix _prefix(_dout, mdcache->mds)
-static ostream& _prefix(std::ostream *_dout, MDSRank *mds) {
+
+using namespace std;
+
+static std::ostream& _prefix(std::ostream *_dout, MDSRank *mds) {
return *_dout << "mds." << mds->get_nodeid() << ".scrubstack ";
}
#undef dout_prefix
#define dout_prefix *_dout << "mds." << mds->get_nodeid() << ".server "
+using namespace std;
+
class ServerContext : public MDSContext {
protected:
Server *server;
void _session_logged(Session *session, uint64_t state_seq, bool open, version_t pv,
const interval_set<inodeno_t>& inos_to_free, version_t piv,
const interval_set<inodeno_t>& inos_to_purge, LogSegment *ls);
- version_t prepare_force_open_sessions(map<client_t,entity_inst_t> &cm,
- map<client_t,client_metadata_t>& cmm,
- map<client_t,pair<Session*,uint64_t> >& smap);
- void finish_force_open_sessions(const map<client_t,pair<Session*,uint64_t> >& smap,
+ version_t prepare_force_open_sessions(std::map<client_t,entity_inst_t> &cm,
+ std::map<client_t,client_metadata_t>& cmm,
+ std::map<client_t,std::pair<Session*,uint64_t> >& smap);
+ void finish_force_open_sessions(const std::map<client_t,std::pair<Session*,uint64_t> >& smap,
bool dec_import=true);
- void flush_client_sessions(set<client_t>& client_set, MDSGatherBuilder& gather);
+ void flush_client_sessions(std::set<client_t>& client_set, MDSGatherBuilder& gather);
void finish_flush_session(Session *session, version_t seq);
void terminate_sessions();
void find_idle_sessions();
void handle_client_setlayout(MDRequestRef& mdr);
void handle_client_setdirlayout(MDRequestRef& mdr);
- int parse_quota_vxattr(string name, string value, quota_info_t *quota);
+ int parse_quota_vxattr(std::string name, std::string value, quota_info_t *quota);
void create_quota_realm(CInode *in);
- int parse_layout_vxattr(string name, string value, const OSDMap& osdmap,
+ int parse_layout_vxattr(std::string name, std::string value, const OSDMap& osdmap,
file_layout_t *layout, bool validate=true);
int check_layout_vxattr(MDRequestRef& mdr,
- string name,
- string value,
+ std::string name,
+ std::string value,
file_layout_t *layout);
void handle_set_vxattr(MDRequestRef& mdr, CInode *cur);
void handle_remove_vxattr(MDRequestRef& mdr, CInode *cur);
void handle_peer_link_prep_ack(MDRequestRef& mdr, const cref_t<MMDSPeerRequest> &m);
void do_link_rollback(bufferlist &rbl, mds_rank_t leader, MDRequestRef& mdr);
void _link_rollback_finish(MutationRef& mut, MDRequestRef& mdr,
- map<client_t,ref_t<MClientSnap>>& split);
+ std::map<client_t,ref_t<MClientSnap>>& split);
// unlink
void handle_client_unlink(MDRequestRef& mdr);
void _unlink_local_finish(MDRequestRef& mdr,
CDentry *dn, CDentry *straydn,
version_t);
- bool _rmdir_prepare_witness(MDRequestRef& mdr, mds_rank_t who, vector<CDentry*>& trace, CDentry *straydn);
+ bool _rmdir_prepare_witness(MDRequestRef& mdr, mds_rank_t who, std::vector<CDentry*>& trace, CDentry *straydn);
void handle_peer_rmdir_prep(MDRequestRef& mdr);
void _logged_peer_rmdir(MDRequestRef& mdr, CDentry *srcdn, CDentry *straydn);
void _commit_peer_rmdir(MDRequestRef& mdr, int r, CDentry *straydn);
void _renamesnap_finish(MDRequestRef& mdr, CInode *diri, snapid_t snapid);
// helpers
- bool _rename_prepare_witness(MDRequestRef& mdr, mds_rank_t who, set<mds_rank_t> &witnesse,
- vector<CDentry*>& srctrace, vector<CDentry*>& dsttrace, CDentry *straydn);
+ bool _rename_prepare_witness(MDRequestRef& mdr, mds_rank_t who, std::set<mds_rank_t> &witnesse,
+ std::vector<CDentry*>& srctrace, std::vector<CDentry*>& dsttrace, CDentry *straydn);
version_t _rename_prepare_import(MDRequestRef& mdr, CDentry *srcdn, bufferlist *client_map_bl);
bool _need_force_journal(CInode *diri, bool empty);
void _rename_prepare(MDRequestRef& mdr,
void _commit_peer_rename(MDRequestRef& mdr, int r, CDentry *srcdn, CDentry *destdn, CDentry *straydn);
void do_rename_rollback(bufferlist &rbl, mds_rank_t leader, MDRequestRef& mdr, bool finish_mdr=false);
void _rename_rollback_finish(MutationRef& mut, MDRequestRef& mdr, CDentry *srcdn, version_t srcdnpv,
- CDentry *destdn, CDentry *staydn, map<client_t,ref_t<MClientSnap>> splits[2],
+ CDentry *destdn, CDentry *staydn, std::map<client_t,ref_t<MClientSnap>> splits[2],
bool finish_mdr);
void evict_cap_revoke_non_responders();
bool terminating_sessions = false;
- set<client_t> client_reclaim_gather;
+ std::set<client_t> client_reclaim_gather;
private:
friend class MDSContinuation;
return xattr_name.rfind("ceph.dir.layout", 0) == 0 ||
xattr_name.rfind("ceph.file.layout", 0) == 0 ||
xattr_name.rfind("ceph.quota", 0) == 0 ||
- xattr_name == "ceph.dir.subvolume"sv ||
- xattr_name == "ceph.dir.pin"sv ||
- xattr_name == "ceph.dir.pin.random"sv ||
- xattr_name == "ceph.dir.pin.distributed"sv;
+ xattr_name == "ceph.dir.subvolume" ||
+ xattr_name == "ceph.dir.pin" ||
+ xattr_name == "ceph.dir.pin.random" ||
+ xattr_name == "ceph.dir.pin.distributed";
}
static bool is_allowed_ceph_xattr(std::string_view xattr_name) {
// before proceeding to reconnect_gather_finish
time reconnect_start = clock::zero();
time reconnect_last_seen = clock::zero();
- set<client_t> client_reconnect_gather; // clients i need a reconnect msg from.
- set<client_t> client_reconnect_denied; // clients whose reconnect msg have been denied .
+ std::set<client_t> client_reconnect_gather; // clients i need a reconnect msg from.
+ std::set<client_t> client_reconnect_denied; // clients whose reconnect msg have been denied .
feature_bitset_t supported_features;
feature_bitset_t required_client_features;
#undef dout_prefix
#define dout_prefix *_dout << "mds." << rank << ".sessionmap "
+using namespace std;
+
namespace {
class SessionMapIOContext : public MDSIOContextBase
{
#undef dout_prefix
#define dout_prefix *_dout << "mds." << mds->get_nodeid() << ".snapclient "
+using namespace std;
+
void SnapClient::resend_queries()
{
if (!waiting_for_version.empty() || (!synced && sync_reqid > 0)) {
snapid_t get_last_created() const { return cached_last_created; }
snapid_t get_last_destroyed() const { return cached_last_destroyed; }
- void get_snaps(set<snapid_t>& snaps) const;
- set<snapid_t> filter(const set<snapid_t>& snaps) const;
+ void get_snaps(std::set<snapid_t>& snaps) const;
+ std::set<snapid_t> filter(const std::set<snapid_t>& snaps) const;
const SnapInfo* get_snap_info(snapid_t snapid) const;
- void get_snap_infos(map<snapid_t, const SnapInfo*>& infomap, const set<snapid_t>& snaps) const;
+ void get_snap_infos(std::map<snapid_t, const SnapInfo*>& infomap, const std::set<snapid_t>& snaps) const;
int dump_cache(Formatter *f) const;
private:
version_t cached_version = 0;
snapid_t cached_last_created = 0, cached_last_destroyed = 0;
- map<snapid_t, SnapInfo> cached_snaps;
- map<version_t, SnapInfo> cached_pending_update;
- map<version_t, pair<snapid_t,snapid_t> > cached_pending_destroy;
+ std::map<snapid_t, SnapInfo> cached_snaps;
+ std::map<version_t, SnapInfo> cached_pending_update;
+ std::map<version_t, std::pair<snapid_t,snapid_t> > cached_pending_destroy;
- set<version_t> committing_tids;
+ std::set<version_t> committing_tids;
- map<version_t, MDSContext::vec > waiting_for_version;
+ std::map<version_t, MDSContext::vec > waiting_for_version;
uint64_t sync_reqid = 0;
bool synced = false;
#define dout_subsys ceph_subsys_mds
#undef dout_prefix
#define dout_prefix _prefix(_dout, mdcache->mds->get_nodeid(), inode, srnode.seq, this)
-static ostream& _prefix(std::ostream *_dout, int whoami, const CInode *inode,
- uint64_t seq, const SnapRealm *realm) {
+
+using namespace std;
+
+static std::ostream& _prefix(std::ostream *_dout, int whoami, const CInode *inode,
+ uint64_t seq, const SnapRealm *realm) {
return *_dout << " mds." << whoami
<< ".cache.snaprealm(" << inode->ino()
<< " seq " << seq << " " << realm << ") ";
#undef dout_prefix
#define dout_prefix *_dout << "mds." << rank << ".snap "
+using namespace std;
void SnapServer::reset_state()
{
// bump last_snap... we use it as a version value on the snaprealm.
++last_snap;
- pending_destroy[version] = pair<snapid_t,snapid_t>(snapid, last_snap);
+ pending_destroy[version] = {snapid, last_snap};
dout(10) << "prepare v" << version << " destroy " << snapid << " seq " << last_snap << dendl;
encode(last_snap, out);
static void generate_test_instances(std::list<SnapServer*>& ls);
bool force_update(snapid_t last, snapid_t v2_since,
- map<snapid_t, SnapInfo>& _snaps);
+ std::map<snapid_t, SnapInfo>& _snaps);
protected:
void encode_server_state(bufferlist& bl) const override {
if (struct_v >= 2)
decode(pending_destroy, bl);
else {
- map<version_t, snapid_t> t;
+ std::map<version_t, snapid_t> t;
decode(t, bl);
- for (map<version_t, snapid_t>::iterator p = t.begin(); p != t.end(); ++p)
- pending_destroy[p->first].first = p->second;
- }
+ for (auto& [ver, snapid] : t) {
+ pending_destroy[ver].first = snapid;
+ }
+ }
decode(pending_noop, bl);
if (struct_v >= 4) {
decode(last_created, bl);
snapid_t last_snap = 0;
snapid_t last_created, last_destroyed;
snapid_t snaprealm_v2_since;
- map<snapid_t, SnapInfo> snaps;
- map<int, set<snapid_t> > need_to_purge;
+ std::map<snapid_t, SnapInfo> snaps;
+ std::map<int, std::set<snapid_t> > need_to_purge;
- map<version_t, SnapInfo> pending_update;
- map<version_t, pair<snapid_t,snapid_t> > pending_destroy; // (removed_snap, seq)
- set<version_t> pending_noop;
+ std::map<version_t, SnapInfo> pending_update;
+ std::map<version_t, std::pair<snapid_t,snapid_t> > pending_destroy; // (removed_snap, seq)
+ std::set<version_t> pending_noop;
version_t last_checked_osdmap = 0;
};
#define dout_subsys ceph_subsys_mds
#undef dout_prefix
#define dout_prefix _prefix(_dout, mds)
+
+using namespace std;
+
static ostream& _prefix(std::ostream *_dout, MDSRank *mds) {
return *_dout << "mds." << mds->get_nodeid() << ".cache.strays ";
}
std::string_view cephfs_feature_name(size_t id)
{
if (id > feature_names.size())
- return "unknown"sv;
+ return "unknown";
return feature_names[id];
}
int cephfs_feature_from_name(std::string_view name)
{
- if (name == "reserved"sv) {
+ if (name == "reserved") {
return -1;
}
for (size_t i = 0; i < feature_names.size(); ++i) {
explicit ECommitted(metareqid_t r) :
LogEvent(EVENT_COMMITTED), reqid(r) { }
- void print(ostream& out) const override {
+ void print(std::ostream& out) const override {
out << "ECommitted " << reqid;
}
EMetaBlob metablob; // exported dir
protected:
dirfrag_t base;
- set<dirfrag_t> bounds;
+ std::set<dirfrag_t> bounds;
mds_rank_t target;
public:
LogEvent(EVENT_EXPORT),
base(dir->dirfrag()), target(t) { }
- set<dirfrag_t> &get_bounds() { return bounds; }
+ std::set<dirfrag_t> &get_bounds() { return bounds; }
- void print(ostream& out) const override {
+ void print(std::ostream& out) const override {
out << "EExport " << base << " to mds." << target << " " << metablob;
}
LogEvent(EVENT_FRAGMENT),
op(o), ino(df.ino), basefrag(df.frag), bits(b) { }
- void print(ostream& out) const override {
+ void print(std::ostream& out) const override {
out << "EFragment " << op_name(op) << " " << ino << " " << basefrag << " by " << bits << " " << metablob;
}
success(s) { }
EImportFinish() : LogEvent(EVENT_IMPORTFINISH), base(), success(false) { }
- void print(ostream& out) const override {
+ void print(std::ostream& out) const override {
out << "EImportFinish " << base;
if (success)
out << " success";
class EImportStart : public LogEvent {
protected:
dirfrag_t base;
- vector<dirfrag_t> bounds;
+ std::vector<dirfrag_t> bounds;
mds_rank_t from;
public:
bufferlist client_map; // encoded map<__u32,entity_inst_t>
version_t cmapv{0};
- EImportStart(MDLog *log, dirfrag_t di, const vector<dirfrag_t>& b, mds_rank_t f) :
+ EImportStart(MDLog *log, dirfrag_t di, const std::vector<dirfrag_t>& b, mds_rank_t f) :
LogEvent(EVENT_IMPORTSTART),
base(di), bounds(b), from(f) { }
EImportStart() :
LogEvent(EVENT_IMPORTSTART), from(MDS_RANK_NONE) { }
- void print(ostream& out) const override {
+ void print(std::ostream& out) const override {
out << "EImportStart " << base << " from mds." << from << " " << metablob;
}
bool need_snapflush() const { return (state & STATE_NEED_SNAPFLUSH); }
bool is_export_ephemeral_random() const { return (state & STATE_EPHEMERAL_RANDOM); }
- void print(ostream& out) const {
+ void print(std::ostream& out) const {
out << " fullbit dn " << dn << " [" << dnfirst << "," << dnlast << "] dnv " << dnv
<< " inode " << inode->ino
<< " state=" << state;
}
out << std::endl;
}
- string state_string() const {
- string state_string;
+ std::string state_string() const {
+ std::string state_string;
bool marked_already = false;
if (is_dirty()) {
state_string.append("dirty");
void encode(bufferlist& bl) const;
void decode(bufferlist::const_iterator &bl);
- void print(ostream& out) const {
+ void print(std::ostream& out) const {
out << " remotebit dn " << dn << " [" << dnfirst << "," << dnlast << "] dnv " << dnv
<< " ino " << ino
<< " dirty=" << dirty;
void decode(bufferlist::const_iterator &bl);
void dump(Formatter *f) const;
static void generate_test_instances(std::list<nullbit*>& ls);
- void print(ostream& out) const {
+ void print(std::ostream& out) const {
out << " nullbit dn " << dn << " [" << dnfirst << "," << dnlast << "] dnv " << dnv
<< " dirty=" << dirty << std::endl;
}
private:
mutable bufferlist dnbl;
mutable bool dn_decoded;
- mutable list<fullbit> dfull;
- mutable vector<remotebit> dremote;
- mutable vector<nullbit> dnull;
+ mutable std::list<fullbit> dfull;
+ mutable std::vector<remotebit> dremote;
+ mutable std::vector<nullbit> dnull;
public:
dirlump() : state(0), nfull(0), nremote(0), nnull(0), dn_decoded(true) { }
bool is_dirty_dft() { return state & STATE_DIRTYDFT; }
void mark_dirty_dft() { state |= STATE_DIRTYDFT; }
- const list<fullbit> &get_dfull() const { return dfull; }
- list<fullbit> &_get_dfull() { return dfull; }
- const vector<remotebit> &get_dremote() const { return dremote; }
- const vector<nullbit> &get_dnull() const { return dnull; }
+ const std::list<fullbit> &get_dfull() const { return dfull; }
+ std::list<fullbit> &_get_dfull() { return dfull; }
+ const std::vector<remotebit> &get_dremote() const { return dremote; }
+ const std::vector<nullbit> &get_dnull() const { return dnull; }
template< class... Args>
void add_dfull(Args&&... args) {
dnull.emplace_back(std::forward<Args>(args)...);
}
- void print(dirfrag_t dirfrag, ostream& out) const {
+ void print(dirfrag_t dirfrag, std::ostream& out) const {
out << "dirlump " << dirfrag << " v " << fnode->version
<< " state " << state
<< " num " << nfull << "/" << nremote << "/" << nnull
p.print(out);
}
- string state_string() const {
- string state_string;
+ std::string state_string() const {
+ std::string state_string;
bool marked_already = false;
if (is_complete()) {
state_string.append("complete");
WRITE_CLASS_ENCODER_FEATURES(dirlump)
// my lumps. preserve the order we added them in a list.
- vector<dirfrag_t> lump_order;
- map<dirfrag_t, dirlump> lump_map;
- list<fullbit> roots;
+ std::vector<dirfrag_t> lump_order;
+ std::map<dirfrag_t, dirlump> lump_map;
+ std::list<fullbit> roots;
public:
- vector<pair<__u8,version_t> > table_tids; // tableclient transactions
+ std::vector<std::pair<__u8,version_t> > table_tids; // tableclient transactions
inodeno_t opened_ino;
public:
inodeno_t renamed_dirino;
- vector<frag_t> renamed_dir_frags;
+ std::vector<frag_t> renamed_dir_frags;
private:
// ino (pre)allocation. may involve both inotable AND session state.
entity_name_t client_name; // session
// inodes i've truncated
- vector<inodeno_t> truncate_start; // start truncate
- map<inodeno_t, LogSegment::seq_t> truncate_finish; // finished truncate (started in segment blah)
+ std::vector<inodeno_t> truncate_start; // start truncate
+ std::map<inodeno_t, LogSegment::seq_t> truncate_finish; // finished truncate (started in segment blah)
public:
- vector<inodeno_t> destroyed_inodes;
+ std::vector<inodeno_t> destroyed_inodes;
private:
// idempotent op(s)
- vector<pair<metareqid_t,uint64_t> > client_reqs;
- vector<pair<metareqid_t,uint64_t> > client_flushes;
+ std::vector<std::pair<metareqid_t,uint64_t> > client_reqs;
+ std::vector<std::pair<metareqid_t,uint64_t> > client_flushes;
public:
void encode(bufferlist& bl, uint64_t features) const;
~EMetaBlob() { }
EMetaBlob& operator=(const EMetaBlob&) = delete;
- void print(ostream& out) {
+ void print(std::ostream& out) {
for (const auto &p : lump_order)
lump_map[p].print(p, out);
}
void add_client_req(metareqid_t r, uint64_t tid=0) {
- client_reqs.push_back(pair<metareqid_t,uint64_t>(r, tid));
+ client_reqs.push_back(std::pair<metareqid_t,uint64_t>(r, tid));
}
void add_client_flush(metareqid_t r, uint64_t tid=0) {
- client_flushes.push_back(pair<metareqid_t,uint64_t>(r, tid));
+ client_flushes.push_back(std::pair<metareqid_t,uint64_t>(r, tid));
}
void add_table_transaction(int table, version_t tid) {
- table_tids.push_back(pair<__u8, version_t>(table, tid));
+ table_tids.emplace_back(table, tid);
}
void add_opened_ino(inodeno_t ino) {
}
}
- string empty;
+ std::string empty;
roots.emplace_back(empty, "", in->first, in->last, 0, pi, pdft, px, in->symlink,
in->oldest_snap, snapbl, (dirty ? fullbit::STATE_DIRTY : 0),
in->get_old_inodes());
opened_ino == 0 && inotablev == 0 && sessionmapv == 0;
}
- void print(ostream& out) const {
+ void print(std::ostream& out) const {
out << "[metablob";
if (!lump_order.empty())
out << " " << lump_order.front() << ", " << lump_map.size() << " dirs";
WRITE_CLASS_ENCODER(EMetaBlob::nullbit)
WRITE_CLASS_ENCODER_FEATURES(EMetaBlob::dirlump)
-inline ostream& operator<<(ostream& out, const EMetaBlob& t) {
+inline std::ostream& operator<<(std::ostream& out, const EMetaBlob& t) {
t.print(out);
return out;
}
class EOpen : public LogEvent {
public:
EMetaBlob metablob;
- vector<inodeno_t> inos;
- vector<vinodeno_t> snap_inos;
+ std::vector<inodeno_t> inos;
+ std::vector<vinodeno_t> snap_inos;
EOpen() : LogEvent(EVENT_OPEN) { }
explicit EOpen(MDLog *mdlog) :
LogEvent(EVENT_OPEN) { }
- void print(ostream& out) const override {
+ void print(std::ostream& out) const override {
out << "EOpen " << metablob << ", " << inos.size() << " open files";
}
struct rmdir_rollback {
metareqid_t reqid;
dirfrag_t src_dir;
- string src_dname;
+ std::string src_dname;
dirfrag_t dest_dir;
- string dest_dname;
+ std::string dest_dname;
bufferlist snapbl;
void encode(bufferlist& bl) const;
utime_t dirfrag_old_mtime;
utime_t dirfrag_old_rctime;
inodeno_t ino, remote_ino;
- string dname;
+ std::string dname;
char remote_d_type;
utime_t old_ctime;
*/
EMetaBlob commit;
bufferlist rollback;
- string type;
+ std::string type;
metareqid_t reqid;
mds_rank_t leader;
__u8 op; // prepare, commit, abort
leader(leadermds),
op(o), origop(oo) { }
- void print(ostream& out) const override {
+ void print(std::ostream& out) const override {
if (type.length())
out << type << " ";
out << " " << (int)op;
void encode(bufferlist& bl, uint64_t features) const override;
void decode(bufferlist::const_iterator& bl) override;
void dump(Formatter *f) const override;
- void print(ostream& out) const override {
+ void print(std::ostream& out) const override {
out << "Eurged " << inos.size() << " inos, inotable v" << inotablev;
}
void decode(bufferlist::const_iterator& bl) override;
void dump(Formatter *f) const override;
static void generate_test_instances(std::list<EResetJournal*>& ls);
- void print(ostream& out) const override {
+ void print(std::ostream& out) const override {
out << "EResetJournal";
}
void dump(Formatter *f) const override;
static void generate_test_instances(std::list<ESession*>& ls);
- void print(ostream& out) const override {
+ void print(std::ostream& out) const override {
if (open)
out << "ESession " << client_inst << " open cmapv " << cmapv;
else
bool old_style_encode;
public:
- map<client_t,entity_inst_t> client_map;
- map<client_t,client_metadata_t> client_metadata_map;
+ std::map<client_t,entity_inst_t> client_map;
+ std::map<client_t,client_metadata_t> client_metadata_map;
ESessions() : LogEvent(EVENT_SESSIONS), cmapv(0), old_style_encode(false) { }
- ESessions(version_t pv, map<client_t,entity_inst_t>&& cm,
- map<client_t,client_metadata_t>&& cmm) :
+ ESessions(version_t pv, std::map<client_t,entity_inst_t>&& cm,
+ std::map<client_t,client_metadata_t>&& cmm) :
LogEvent(EVENT_SESSIONS),
cmapv(pv), old_style_encode(false),
client_map(std::move(cm)),
void dump(Formatter *f) const override;
static void generate_test_instances(std::list<ESessions*>& ls);
- void print(ostream& out) const override {
+ void print(std::ostream& out) const override {
out << "ESessions " << client_map.size() << " opens cmapv " << cmapv;
}
class ESubtreeMap : public LogEvent {
public:
EMetaBlob metablob;
- map<dirfrag_t, vector<dirfrag_t> > subtrees;
- set<dirfrag_t> ambiguous_subtrees;
+ std::map<dirfrag_t, std::vector<dirfrag_t> > subtrees;
+ std::set<dirfrag_t> ambiguous_subtrees;
uint64_t expire_pos;
uint64_t event_seq;
ESubtreeMap() : LogEvent(EVENT_SUBTREEMAP), expire_pos(0), event_seq(0) { }
- void print(ostream& out) const override {
+ void print(std::ostream& out) const override {
out << "ESubtreeMap " << subtrees.size() << " subtrees "
<< ", " << ambiguous_subtrees.size() << " ambiguous "
<< metablob;
void dump(Formatter *f) const override;
static void generate_test_instances(std::list<ETableClient*>& ls);
- void print(ostream& out) const override {
+ void print(std::ostream& out) const override {
out << "ETableClient " << get_mdstable_name(table) << " " << get_mdstableserver_opname(op);
if (tid) out << " tid " << tid;
}
void dump(Formatter *f) const override;
static void generate_test_instances(std::list<ETableServer*>& ls);
- void print(ostream& out) const override {
+ void print(std::ostream& out) const override {
out << "ETableServer " << get_mdstable_name(table)
<< " " << get_mdstableserver_opname(op);
if (reqid) out << " reqid " << reqid;
class EUpdate : public LogEvent {
public:
EMetaBlob metablob;
- string type;
+ std::string type;
bufferlist client_map;
version_t cmapv;
metareqid_t reqid;
LogEvent(EVENT_UPDATE),
type(s), cmapv(0), had_peers(false) { }
- void print(ostream& out) const override {
+ void print(std::ostream& out) const override {
if (type.length())
out << "EUpdate " << type << " ";
out << metablob;
#undef dout_prefix
#define dout_prefix *_dout << "mds." << mds->get_nodeid() << ".journal "
+using std::list;
+using std::map;
+using std::ostream;
+using std::pair;
+using std::set;
+using std::string;
+using std::vector;
// -----------------------
// LogSegment
#include "common/Formatter.h"
+using namespace std;
/*
* SnapInfo
*/