#include <set>
#include <map>
#include <string>
-using namespace std;
#include "CInode.h"
fnode_t fnode;
snapid_t first;
- map<snapid_t,old_rstat_t> dirty_old_rstat; // [value.first,key]
+ std::map<snapid_t,old_rstat_t> dirty_old_rstat; // [value.first,key]
// my inodes with dirty rstat data
elist<CInode*> dirty_rstat_inodes;
protected:
version_t projected_version;
- list<fnode_t*> projected_fnode;
+ std::list<fnode_t*> projected_fnode;
public:
elist<CDir*>::item item_dirty, item_new;
void mark_new(LogSegment *ls);
public:
- typedef map<dentry_key_t, CDentry*> map_t;
+ typedef std::map<dentry_key_t, CDentry*> map_t;
protected:
// contents of this directory
// cache control (defined for authority; hints for replicas)
__s32 dir_rep;
- set<__s32> dir_rep_by; // if dir_rep == REP_LIST
+ std::set<__s32> dir_rep_by; // if dir_rep == REP_LIST
// popularity
dirfrag_load_vec_t pop_me;
// -- dentries and inodes --
public:
- CDentry* lookup_exact_snap(const string& dname, snapid_t last) {
+ CDentry* lookup_exact_snap(const std::string& dname, snapid_t last) {
map_t::iterator p = items.find(dentry_key_t(last, dname.c_str()));
if (p == items.end())
return NULL;
return p->second;
}
- CDentry* lookup(const string& n, snapid_t snap=CEPH_NOSNAP) {
+ CDentry* lookup(const std::string& n, snapid_t snap=CEPH_NOSNAP) {
return lookup(n.c_str(), snap);
}
CDentry* lookup(const char *n, snapid_t snap=CEPH_NOSNAP);
- CDentry* add_null_dentry(const string& dname,
+ CDentry* add_null_dentry(const std::string& dname,
snapid_t first=2, snapid_t last=CEPH_NOSNAP);
- CDentry* add_primary_dentry(const string& dname, CInode *in,
+ CDentry* add_primary_dentry(const std::string& dname, CInode *in,
snapid_t first=2, snapid_t last=CEPH_NOSNAP);
- CDentry* add_remote_dentry(const string& dname, inodeno_t ino, unsigned char d_type,
+ CDentry* add_remote_dentry(const std::string& dname, inodeno_t ino, unsigned char d_type,
snapid_t first=2, snapid_t last=CEPH_NOSNAP);
void remove_dentry( CDentry *dn ); // delete dentry
void link_remote_inode( CDentry *dn, inodeno_t ino, unsigned char d_type);
void try_remove_unlinked_dn(CDentry *dn);
void add_to_bloom(CDentry *dn);
- bool is_in_bloom(const string& name);
+ bool is_in_bloom(const std::string& name);
bool has_bloom() { return (bloom ? true : false); }
void remove_bloom();
private:
void link_inode_work( CDentry *dn, CInode *in );
void unlink_inode_work( CDentry *dn );
void remove_null_dentries();
- void purge_stale_snap_data(const set<snapid_t>& snaps);
+ void purge_stale_snap_data(const std::set<snapid_t>& snaps);
public:
void touch_dentries_bottom();
- bool try_trim_snap_dentry(CDentry *dn, const set<snapid_t>& snaps);
+ bool try_trim_snap_dentry(CDentry *dn, const std::set<snapid_t>& snaps);
public:
// for giving to clients
- void get_dist_spec(set<int>& ls, int auth) {
+ void get_dist_spec(std::set<int>& ls, int auth) {
if (is_rep()) {
- for (map<int,unsigned>::iterator p = replicas_begin();
+ for (std::map<int,unsigned>::iterator p = replicas_begin();
p != replicas_end();
++p)
ls.insert(p->first);
*/
frag_t frag = get_frag();
__s32 auth;
- set<__s32> dist;
+ std::set<__s32> dist;
auth = dir_auth.first;
if (is_auth())
return file_object_t(ino(), frag);
}
void fetch(Context *c, bool ignore_authpinnability=false);
- void fetch(Context *c, const string& want_dn, bool ignore_authpinnability=false);
+ void fetch(Context *c, const std::string& want_dn, bool ignore_authpinnability=false);
protected:
- void _omap_fetch(const string& want_dn);
- void _omap_fetched(bufferlist& hdrbl, map<string, bufferlist>& omap,
- const string& want_dn, int r);
- void _tmap_fetch(const string& want_dn);
- void _tmap_fetched(bufferlist &bl, const string& want_dn, int r);
+ void _omap_fetch(const std::string& want_dn);
+ void _omap_fetched(bufferlist& hdrbl, std::map<std::string, bufferlist>& omap,
+ const std::string& want_dn, int r);
+ void _tmap_fetch(const std::string& want_dn);
+ void _tmap_fetched(bufferlist &bl, const std::string& want_dn, int r);
// -- commit --
- map<version_t, list<Context*> > waiting_for_commit;
+ std::map<version_t, std::list<Context*> > waiting_for_commit;
void _commit(version_t want, int op_prio);
void _omap_commit(int op_prio);
- void _encode_dentry(CDentry *dn, bufferlist& bl, const set<snapid_t> *snaps);
+ void _encode_dentry(CDentry *dn, bufferlist& bl, const std::set<snapid_t> *snaps);
void _committed(version_t v);
public:
void wait_for_commit(Context *c, version_t v=0);
// -- waiters --
protected:
- map< string_snap_t, list<Context*> > waiting_on_dentry;
+ std::map< string_snap_t, std::list<Context*> > waiting_on_dentry;
public:
- bool is_waiting_for_dentry(const string& dname, snapid_t snap) {
+ bool is_waiting_for_dentry(const std::string& dname, snapid_t snap) {
return waiting_on_dentry.count(string_snap_t(dname, snap));
}
- void add_dentry_waiter(const string& dentry, snapid_t snap, Context *c);
- void take_dentry_waiting(const string& dentry, snapid_t first, snapid_t last, list<Context*>& ls);
- void take_sub_waiting(list<Context*>& ls); // dentry or ino
+ void add_dentry_waiter(const std::string& dentry, snapid_t snap, Context *c);
+ void take_dentry_waiting(const std::string& dentry, snapid_t first, snapid_t last, std::list<Context*>& ls);
+ void take_sub_waiting(std::list<Context*>& ls); // dentry or ino
void add_waiter(uint64_t mask, Context *c);
- void take_waiting(uint64_t mask, list<Context*>& ls); // may include dentry waiters
+ void take_waiting(uint64_t mask, std::list<Context*>& ls); // may include dentry waiters
void finish_waiting(uint64_t mask, int result = 0); // ditto
#include "SnapRealm.h"
#include <list>
-#include <vector>
#include <set>
#include <map>
-#include <iostream>
-using namespace std;
+//#include <iostream>
class Context;
class CDentry;
class InodeStore {
public:
inode_t inode; // the inode itself
- string symlink; // symlink dest, if symlink
- map<string, bufferptr> xattrs;
+ std::string symlink; // symlink dest, if symlink
+ std::map<std::string, bufferptr> xattrs;
fragtree_t dirfragtree; // dir frag tree, if any. always consistent with our dirfrag map.
- map<snapid_t, old_inode_t> old_inodes; // key = last, value.first = first
+ std::map<snapid_t, old_inode_t> old_inodes; // key = last, value.first = first
bufferlist snap_blob; // Encoded copy of SnapRealm, because we can't
// rehydrate it without full MDCache
/* For use in debug and ceph-dencoder */
void dump(Formatter *f) const;
- static void generate_test_instances(list<InodeStore*>& ls);
+ static void generate_test_instances(std::list<InodeStore*>& ls);
};
// cached inode wrapper
SnapRealm *snaprealm;
SnapRealm *containing_realm;
snapid_t first, last;
- set<snapid_t> dirty_old_rstats;
+ std::set<snapid_t> dirty_old_rstats;
bool is_multiversion() {
return snaprealm || // other snaprealms will link to me
struct projected_inode_t {
inode_t *inode;
- map<string,bufferptr> *xattrs;
+ std::map<std::string,bufferptr> *xattrs;
sr_t *snapnode;
projected_inode_t()
: inode(NULL), xattrs(NULL), snapnode(NULL) {}
projected_inode_t(inode_t *in, sr_t *sn)
: inode(in), xattrs(NULL), snapnode(sn) {}
- projected_inode_t(inode_t *in, map<string, bufferptr> *xp = NULL, sr_t *sn = NULL)
+ projected_inode_t(inode_t *in, std::map<std::string, bufferptr> *xp = NULL, sr_t *sn = NULL)
: inode(in), xattrs(xp), snapnode(sn) {}
};
- list<projected_inode_t*> projected_nodes; // projected values (only defined while dirty)
+ std::list<projected_inode_t*> projected_nodes; // projected values (only defined while dirty)
- inode_t *project_inode(map<string,bufferptr> *px=0);
+ inode_t *project_inode(std::map<std::string,bufferptr> *px=0);
void pop_and_dirty_projected_inode(LogSegment *ls);
projected_inode_t *get_projected_node() {
}
inode_t *get_previous_projected_inode() {
assert(!projected_nodes.empty());
- list<projected_inode_t*>::reverse_iterator p = projected_nodes.rbegin();
+ std::list<projected_inode_t*>::reverse_iterator p = projected_nodes.rbegin();
++p;
if (p != projected_nodes.rend())
return (*p)->inode;
return &inode;
}
- map<string,bufferptr> *get_projected_xattrs() {
- for (list<projected_inode_t*>::reverse_iterator p = projected_nodes.rbegin();
+ std::map<std::string,bufferptr> *get_projected_xattrs() {
+ for (std::list<projected_inode_t*>::reverse_iterator p = projected_nodes.rbegin();
p != projected_nodes.rend();
++p)
if ((*p)->xattrs)
return (*p)->xattrs;
return &xattrs;
}
- map<string,bufferptr> *get_previous_projected_xattrs() {
- list<projected_inode_t*>::reverse_iterator p = projected_nodes.rbegin();
+ std::map<std::string,bufferptr> *get_previous_projected_xattrs() {
+ std::list<projected_inode_t*>::reverse_iterator p = projected_nodes.rbegin();
for (p++; // skip the most recent projected value
p != projected_nodes.rend();
++p)
else
return NULL;
} else {
- for (list<projected_inode_t*>::reverse_iterator p = projected_nodes.rbegin();
+ for (std::list<projected_inode_t*>::reverse_iterator p = projected_nodes.rbegin();
p != projected_nodes.rend();
++p)
if ((*p)->snapnode)
old_inode_t& cow_old_inode(snapid_t follows, bool cow_head);
old_inode_t *pick_old_inode(snapid_t last);
void pre_cow_old_inode();
- void purge_stale_snap_data(const set<snapid_t>& snaps);
+ void purge_stale_snap_data(const std::set<snapid_t>& snaps);
// -- cache infrastructure --
private:
- map<frag_t,CDir*> dirfrags; // cached dir fragments under this Inode
+ std::map<frag_t,CDir*> dirfrags; // cached dir fragments under this Inode
int stickydir_ref;
public:
- __u32 hash_dentry_name(const string &dn);
- frag_t pick_dirfrag(const string &dn);
+ __u32 hash_dentry_name(const std::string &dn);
+ frag_t pick_dirfrag(const std::string &dn);
bool has_dirfrags() { return !dirfrags.empty(); }
CDir* get_dirfrag(frag_t fg) {
if (dirfrags.count(fg)) {
} else
return NULL;
}
- bool get_dirfrags_under(frag_t fg, list<CDir*>& ls);
+ bool get_dirfrags_under(frag_t fg, std::list<CDir*>& ls);
CDir* get_approx_dirfrag(frag_t fg);
- void get_dirfrags(list<CDir*>& ls);
- void get_nested_dirfrags(list<CDir*>& ls);
- void get_subtree_dirfrags(list<CDir*>& ls);
+ void get_dirfrags(std::list<CDir*>& ls);
+ void get_nested_dirfrags(std::list<CDir*>& ls);
+ void get_subtree_dirfrags(std::list<CDir*>& ls);
CDir *get_or_open_dirfrag(MDCache *mdcache, frag_t fg);
CDir *add_dirfrag(CDir *dir);
void close_dirfrag(frag_t fg);
protected:
// parent dentries in cache
CDentry *parent; // primary link
- set<CDentry*> remote_parents; // if hard linked
+ std::set<CDentry*> remote_parents; // if hard linked
- list<CDentry*> projected_parent; // for in-progress rename, (un)link, etc.
+ std::list<CDentry*> projected_parent; // for in-progress rename, (un)link, etc.
pair<int,int> inode_auth;
// -- distributed state --
protected:
// file capabilities
- map<client_t, Capability*> client_caps; // client -> caps
- map<int32_t, int32_t> mds_caps_wanted; // [auth] mds -> caps wanted
+ std::map<client_t, Capability*> client_caps; // client -> caps
+ std::map<int32_t, int32_t> mds_caps_wanted; // [auth] mds -> caps wanted
int replica_caps_wanted; // [replica] what i've requested from auth
- map<int, set<client_t> > client_snap_caps; // [auth] [snap] dirty metadata we still need from the head
+ std::map<int, std::set<client_t> > client_snap_caps; // [auth] [snap] dirty metadata we still need from the head
public:
- map<snapid_t, set<client_t> > client_need_snapflush;
+ std::map<snapid_t, std::set<client_t> > client_need_snapflush;
void add_need_snapflush(CInode *snapin, snapid_t snapid, client_t client);
void remove_need_snapflush(CInode *snapin, snapid_t snapid, client_t client);
void set_ambiguous_auth() {
state_set(STATE_AMBIGUOUSAUTH);
}
- void clear_ambiguous_auth(list<Context*>& finished);
+ void clear_ambiguous_auth(std::list<Context*>& finished);
void clear_ambiguous_auth();
inodeno_t ino() const { return inode.ino; }
// -- misc --
bool is_projected_ancestor_of(CInode *other);
- void make_path_string(string& s, bool force=false, CDentry *use_parent=NULL);
- void make_path_string_projected(string& s);
+ void make_path_string(std::string& s, bool force=false, CDentry *use_parent=NULL);
+ void make_path_string_projected(std::string& s);
void make_path(filepath& s);
- void name_stray_dentry(string& dname);
+ void name_stray_dentry(std::string& dname);
// -- dirtyness --
version_t get_version() { return inode.version; }
// -- waiting --
protected:
- map<frag_t, list<Context*> > waiting_on_dir;
+ std::map<frag_t, std::list<Context*> > waiting_on_dir;
public:
void add_dir_waiter(frag_t fg, Context *c);
- void take_dir_waiting(frag_t fg, list<Context*>& ls);
+ void take_dir_waiting(frag_t fg, std::list<Context*>& ls);
bool is_waiting_for_dir(frag_t fg) {
return waiting_on_dir.count(fg);
}
void add_waiter(uint64_t tag, Context *c);
- void take_waiting(uint64_t tag, list<Context*>& ls);
+ void take_waiting(uint64_t tag, std::list<Context*>& ls);
// -- encode/decode helpers --
void _encode_base(bufferlist& bl);
void _encode_locks_state_for_replica(bufferlist& bl);
void _encode_locks_state_for_rejoin(bufferlist& bl, int rep);
void _decode_locks_state(bufferlist::iterator& p, bool is_new);
- void _decode_locks_rejoin(bufferlist::iterator& p, list<Context*>& waiters,
- list<SimpleLock*>& eval_locks);
+ void _decode_locks_rejoin(bufferlist::iterator& p, std::list<Context*>& waiters,
+ std::list<SimpleLock*>& eval_locks);
// -- import/export --
void encode_export(bufferlist& bl);
int count_nonstale_caps() {
int n = 0;
- for (map<client_t,Capability*>::iterator it = client_caps.begin();
+ for (std::map<client_t,Capability*>::iterator it = client_caps.begin();
it != client_caps.end();
++it)
if (!it->second->is_stale())
}
bool multiple_nonstale_caps() {
int n = 0;
- for (map<client_t,Capability*>::iterator it = client_caps.begin();
+ for (std::map<client_t,Capability*>::iterator it = client_caps.begin();
it != client_caps.end();
++it)
if (!it->second->is_stale()) {
bool is_any_caps() { return !client_caps.empty(); }
bool is_any_nonstale_caps() { return count_nonstale_caps(); }
- map<int32_t,int32_t>& get_mds_caps_wanted() { return mds_caps_wanted; }
+ std::map<int32_t,int32_t>& get_mds_caps_wanted() { return mds_caps_wanted; }
- map<client_t,Capability*>& get_client_caps() { return client_caps; }
+ std::map<client_t,Capability*>& get_client_caps() { return client_caps; }
Capability *get_client_cap(client_t client) {
if (client_caps.count(client))
return client_caps[client];
Capability *reconnect_cap(client_t client, ceph_mds_cap_reconnect& icr, Session *session);
void clear_client_caps_after_export();
- void export_client_caps(map<client_t,Capability::Export>& cl);
+ void export_client_caps(std::map<client_t,Capability::Export>& cl);
// caps allowed
int get_caps_liked();
/* Freeze the inode. auth_pin_allowance lets the caller account for any
* auth_pins it is itself holding/responsible for. */
bool freeze_inode(int auth_pin_allowance=0);
- void unfreeze_inode(list<Context*>& finished);
+ void unfreeze_inode(std::list<Context*>& finished);
void unfreeze_inode();
void freeze_auth_pin();