From 0c75f1254ce0bf630ce24947defe8ca3c4e7e6c4 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 13 Jun 2008 07:33:57 -0700 Subject: [PATCH] mds: use nstring class --- src/Makefile.am | 2 +- src/client/Client.cc | 2 +- src/client/Client.h | 2 +- src/include/filepath.h | 9 ++ src/include/nstring.h | 146 +++++++++++++++++++++++++++++++++ src/mds/Anchor.h | 2 +- src/mds/CDentry.cc | 2 +- src/mds/CDentry.h | 13 +-- src/mds/CDir.cc | 34 ++++---- src/mds/CDir.h | 22 +++-- src/mds/CInode.cc | 2 +- src/mds/CInode.h | 2 +- src/mds/MDCache.cc | 12 +-- src/mds/events/EMetaBlob.h | 16 ++-- src/mds/events/ESlaveUpdate.h | 2 +- src/mds/mdstypes.h | 3 +- src/messages/MCacheExpire.h | 8 +- src/messages/MClientLease.h | 4 +- src/messages/MDentryUnlink.h | 6 +- src/messages/MExportDirPrep.h | 6 +- src/messages/MMDSCacheRejoin.h | 16 ++-- 21 files changed, 236 insertions(+), 75 deletions(-) create mode 100644 src/include/nstring.h diff --git a/src/Makefile.am b/src/Makefile.am index 71adef9c7c91d..fa66f5dee9b3d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -149,7 +149,7 @@ noinst_LIBRARIES = \ libmon.a libmds.a libosdc.a libosd.a libclient.a \ libos.a libebofs.a -noinst_LIBRARIES += libcrush_so.a libcephclient_so.a +noinst_LIBRARIES += libcrush_so.a #libcephclient_so.a # extra bits EXTRA_DIST = mkcephfs.sh mkfs.sh restart.sh startnew.sh stop.sh diff --git a/src/client/Client.cc b/src/client/Client.cc index 83bf5b16bd726..600ac9c70dfd6 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -192,7 +192,7 @@ void Client::dump_inode(Inode *in, set& did) if (in->dir) { dout(1) << " dir size " << in->dir->dentries.size() << dendl; //for (hash_map, eqstr>::iterator it = in->dir->dentries.begin(); - for (hash_map::iterator it = in->dir->dentries.begin(); + for (hash_map::iterator it = in->dir->dentries.begin(); it != in->dir->dentries.end(); it++) { dout(1) << " dn " << it->first << " ref " << it->second->ref << dendl; diff --git a/src/client/Client.h b/src/client/Client.h index 2646b82bc1b7f..ec61d08a93d06 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -117,7 +117,7 @@ class Dir { public: Inode *parent_inode; // my inode //hash_map, eqstr> dentries; - hash_map dentries; + hash_map dentries; Dir(Inode* in) { parent_inode = in; } diff --git a/src/include/filepath.h b/src/include/filepath.h index a0cf53a3397a6..b25d0c893a790 100644 --- a/src/include/filepath.h +++ b/src/include/filepath.h @@ -31,6 +31,7 @@ using namespace std; #include "buffer.h" #include "encoding.h" +#include "nstring.h" class filepath { inodeno_t ino; // base inode. ino=0 implies pure relative path. @@ -182,6 +183,14 @@ class filepath { path += s; bits.push_back(s); } + void push_dentry(const nstring &ns) { + string s = ns.c_str(); + push_dentry(s); + } + void push_dentry(const char *cs) { + string s = cs; + push_dentry(s); + } void append(const filepath& a) { assert(a.pure_relative()); for (unsigned i=0; i(const nstring &l, const nstring &r) { + return strcmp(l.c_str(), r.c_str()) > 0; +} +static inline bool operator>=(const nstring &l, const nstring &r) { + return strcmp(l.c_str(), r.c_str()) >= 0; +} + +static inline ostream& operator<<(ostream &out, const nstring &s) { + return out << s.c_str(); +} + +namespace __gnu_cxx { + template<> struct hash< nstring > + { + size_t operator()( const nstring& x ) const + { + static hash H; + return H(x.c_str()); + } + }; +} + +#endif diff --git a/src/mds/Anchor.h b/src/mds/Anchor.h index 7cdf8182fa8e2..af4165d81828d 100644 --- a/src/mds/Anchor.h +++ b/src/mds/Anchor.h @@ -77,7 +77,7 @@ public: Anchor() : dn_hash(0), nref(0) {} Anchor(inodeno_t i, inodeno_t di, __u32 hash, int nr=0) : ino(i), dirino(di), dn_hash(hash), nref(nr) { } - Anchor(inodeno_t i, inodeno_t di, const string &dname, int nr=0) : + Anchor(inodeno_t i, inodeno_t di, const nstring &dname, int nr=0) : ino(i), dirino(di), dn_hash(ceph_full_name_hash(dname.data(), dname.length())), nref(nr) { } diff --git a/src/mds/CDentry.cc b/src/mds/CDentry.cc index 95f4c7b61d1a1..94bed64f3800d 100644 --- a/src/mds/CDentry.cc +++ b/src/mds/CDentry.cc @@ -198,7 +198,7 @@ void CDentry::make_path_string(string& s) s = "???"; } s += "/"; - s += name; + s.append(name.data(), name.length()); } void CDentry::make_path(filepath& fp) diff --git a/src/mds/CDentry.h b/src/mds/CDentry.h index 55f2a49c11723..06efe67fdc3ee 100644 --- a/src/mds/CDentry.h +++ b/src/mds/CDentry.h @@ -27,6 +27,7 @@ using namespace std; #include "include/lru.h" #include "include/xlist.h" #include "include/filepath.h" +#include "include/nstring.h" #include "mdstypes.h" #include "SimpleLock.h" @@ -76,7 +77,7 @@ class CDentry : public MDSCacheObject, public LRUObject { } protected: - string name; + nstring name; inodeno_t remote_ino; // if remote dentry unsigned char remote_d_type; @@ -120,7 +121,7 @@ public: dir_offset(0), auth_pins(0), nested_auth_pins(0), nested_anchors(0), lock(this, CEPH_LOCK_DN, WAIT_LOCK_OFFSET) { } - CDentry(const string& n, CInode *in) : + CDentry(const nstring& n, CInode *in) : name(n), remote_ino(0), remote_d_type(0), inode(in), dir(0), @@ -129,7 +130,7 @@ public: dir_offset(0), auth_pins(0), nested_auth_pins(0), nested_anchors(0), lock(this, CEPH_LOCK_DN, WAIT_LOCK_OFFSET) { } - CDentry(const string& n, inodeno_t ino, unsigned char dt, CInode *in=0) : + CDentry(const nstring& n, inodeno_t ino, unsigned char dt, CInode *in=0) : name(n), remote_ino(ino), remote_d_type(dt), inode(in), dir(0), @@ -141,7 +142,7 @@ public: CInode *get_inode() const { return inode; } CDir *get_dir() const { return dir; } - const string& get_name() const { return name; } + const nstring& get_name() const { return name; } inodeno_t get_ino(); off_t get_dir_offset() { return dir_offset; } @@ -273,7 +274,7 @@ ostream& operator<<(ostream& out, CDentry& dn); class CDentryDiscover { - string dname; + nstring dname; __s32 replica_nonce; __s32 lockstate; __s64 dir_offset; @@ -289,7 +290,7 @@ public: remote_ino(dn->get_remote_ino()), remote_d_type(dn->get_remote_d_type()) { } CDentryDiscover(bufferlist::iterator &p) { decode(p); } - string& get_dname() { return dname; } + nstring& get_dname() { return dname; } int get_nonce() { return replica_nonce; } bool is_remote() { return remote_ino ? true:false; } inodeno_t get_remote_ino() { return remote_ino; } diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index 5347bfcbe2214..84b840cccd4c0 100644 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -186,7 +186,7 @@ CDir::CDir(CInode *in, frag_t fg, MDCache *mdcache, bool auth) : * linking fun */ -CDentry* CDir::add_null_dentry(const string& dname) +CDentry* CDir::add_null_dentry(const nstring& dname) { // foreign assert(lookup(dname) == 0); @@ -201,10 +201,10 @@ CDentry* CDir::add_null_dentry(const string& dname) dn->version = get_projected_version(); // add to dir - assert(items.count(dn->name) == 0); + assert(items.count(dn->name.c_str()) == 0); //assert(null_items.count(dn->name) == 0); - items[dn->name] = dn; + items[dn->name.c_str()] = dn; nnull++; dout(12) << "add_null_dentry " << *dn << dendl; @@ -218,7 +218,7 @@ CDentry* CDir::add_null_dentry(const string& dname) } -CDentry* CDir::add_primary_dentry(const string& dname, CInode *in) +CDentry* CDir::add_primary_dentry(const nstring& dname, CInode *in) { // primary assert(lookup(dname) == 0); @@ -233,10 +233,10 @@ CDentry* CDir::add_primary_dentry(const string& dname, CInode *in) dn->version = get_projected_version(); // add to dir - assert(items.count(dn->name) == 0); + assert(items.count(dn->name.c_str()) == 0); //assert(null_items.count(dn->name) == 0); - items[dn->name] = dn; + items[dn->name.c_str()] = dn; link_inode_work( dn, in ); dout(12) << "add_primary_dentry " << *dn << dendl; @@ -249,7 +249,7 @@ CDentry* CDir::add_primary_dentry(const string& dname, CInode *in) return dn; } -CDentry* CDir::add_remote_dentry(const string& dname, inodeno_t ino, unsigned char d_type) +CDentry* CDir::add_remote_dentry(const nstring& dname, inodeno_t ino, unsigned char d_type) { // foreign assert(lookup(dname) == 0); @@ -264,10 +264,10 @@ CDentry* CDir::add_remote_dentry(const string& dname, inodeno_t ino, unsigned ch dn->version = get_projected_version(); // add to dir - assert(items.count(dn->name) == 0); + assert(items.count(dn->name.c_str()) == 0); //assert(null_items.count(dn->name) == 0); - items[dn->name] = dn; + items[dn->name.c_str()] = dn; nitems++; dout(12) << "add_remote_dentry " << *dn << dendl; @@ -297,8 +297,8 @@ void CDir::remove_dentry(CDentry *dn) } // remove from list - assert(items.count(dn->name) == 1); - items.erase(dn->name); + assert(items.count(dn->name.c_str()) == 1); + items.erase(dn->name.c_str()); // adjust dirty counter? if (dn->state_test(CDentry::STATE_DIRTY)) @@ -498,9 +498,9 @@ void CDir::steal_dentry(CDentry *dn) { dout(15) << "steal_dentry " << *dn << dendl; - items[dn->name] = dn; + items[dn->name.c_str()] = dn; - dn->dir->items.erase(dn->name); + dn->dir->items.erase(dn->name.c_str()); if (dn->dir->items.empty()) dn->dir->put(PIN_CHILD); @@ -679,7 +679,7 @@ CDirDiscover *CDir::replicate_to(int mds) * WAITING */ -void CDir::add_dentry_waiter(const string& dname, Context *c) +void CDir::add_dentry_waiter(const nstring& dname, Context *c) { if (waiting_on_dentry.empty()) get(PIN_DNWAITER); @@ -687,7 +687,7 @@ void CDir::add_dentry_waiter(const string& dname, Context *c) dout(10) << "add_dentry_waiter dentry " << dname << " " << c << " on " << *this << dendl; } -void CDir::take_dentry_waiting(const string& dname, list& ls) +void CDir::take_dentry_waiting(const nstring& dname, list& ls) { if (waiting_on_dentry.empty()) return; if (waiting_on_dentry.count(dname) == 0) return; @@ -724,7 +724,7 @@ void CDir::take_ino_waiting(inodeno_t ino, list& ls) void CDir::take_sub_waiting(list& ls) { dout(10) << "take_sub_waiting" << dendl; - for (hash_map >::iterator p = waiting_on_dentry.begin(); + for (hash_map >::iterator p = waiting_on_dentry.begin(); p != waiting_on_dentry.end(); ++p) ls.splice(ls.end(), p->second); @@ -773,7 +773,7 @@ void CDir::take_waiting(int mask, list& ls) { if (mask & WAIT_DENTRY) { // take each each dentry waiter - hash_map >::iterator it = + hash_map >::iterator it = waiting_on_dentry.begin(); while (it != waiting_on_dentry.end()) { take_dentry_waiting((it++)->first, ls); // not post-inc diff --git a/src/mds/CDir.h b/src/mds/CDir.h index 9835409834cfb..1975679e6ed01 100644 --- a/src/mds/CDir.h +++ b/src/mds/CDir.h @@ -193,7 +193,7 @@ public: public: //typedef hash_map map_t; // there is a bug somewhere, valgrind me. - typedef map map_t; + typedef map map_t; protected: // contents @@ -279,17 +279,21 @@ protected: // -- dentries and inodes -- public: - CDentry* lookup(const string& n) { - map_t::iterator iter = items.find(n); + CDentry* lookup(const string& s) { + nstring ns(s); + return lookup(ns); + } + CDentry* lookup(const nstring& ns) { + map_t::iterator iter = items.find(ns.c_str()); if (iter == items.end()) return 0; else return iter->second; } - CDentry* add_null_dentry(const string& dname); - CDentry* add_primary_dentry(const string& dname, CInode *in); - CDentry* add_remote_dentry(const string& dname, inodeno_t ino, unsigned char d_type); + CDentry* add_null_dentry(const nstring& dname); + CDentry* add_primary_dentry(const nstring& dname, CInode *in); + CDentry* add_remote_dentry(const nstring& dname, inodeno_t ino, unsigned char d_type); void remove_dentry( CDentry *dn ); // delete dentry void link_remote_inode( CDentry *dn, inodeno_t ino, unsigned char d_type); void link_remote_inode( CDentry *dn, CInode *in ); @@ -406,15 +410,15 @@ private: // -- waiters -- protected: - hash_map< string, list > waiting_on_dentry; + hash_map< nstring, list > waiting_on_dentry; hash_map< inodeno_t, list > waiting_on_ino; public: bool is_waiting_for_dentry(const string& dn) { return waiting_on_dentry.count(dn); } - void add_dentry_waiter(const string& dentry, Context *c); - void take_dentry_waiting(const string& dentry, list& ls); + void add_dentry_waiter(const nstring& dentry, Context *c); + void take_dentry_waiting(const nstring& dentry, list& ls); bool is_waiting_for_ino(inodeno_t ino) { return waiting_on_ino.count(ino); diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index c61205d5c4f70..f93136d9b3dcc 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -163,7 +163,7 @@ void CInode::pop_and_dirty_projected_inode(LogSegment *ls) // dirfrags -frag_t CInode::pick_dirfrag(const string& dn) +frag_t CInode::pick_dirfrag(const nstring& dn) { if (dirfragtree.empty()) return frag_t(); // avoid the string hash if we can. diff --git a/src/mds/CInode.h b/src/mds/CInode.h index e6bc6143d58d9..05b6b32844d06 100644 --- a/src/mds/CInode.h +++ b/src/mds/CInode.h @@ -177,7 +177,7 @@ private: int stickydir_ref; public: - frag_t pick_dirfrag(const string &dn); + frag_t pick_dirfrag(const nstring &dn); bool has_dirfrags() { return !dirfrags.empty(); } CDir* get_dirfrag(frag_t fg) { if (dirfrags.count(fg)) { diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 6cf7187969b7b..c245a86a2d18b 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -2107,7 +2107,7 @@ void MDCache::handle_cache_rejoin_weak(MMDSCacheRejoin *weak) } // walk weak map - for (map >::iterator p = weak->weak.begin(); + for (map >::iterator p = weak->weak.begin(); p != weak->weak.end(); ++p) { CDir *dir = get_dirfrag(p->first); @@ -2120,7 +2120,7 @@ void MDCache::handle_cache_rejoin_weak(MMDSCacheRejoin *weak) ack->add_strong_dirfrag(p->first, nonce, dir->dir_rep); // weak dentries - for (map::iterator q = p->second.begin(); + for (map::iterator q = p->second.begin(); q != p->second.end(); ++q) { CDentry *dn = dir->lookup(q->first); @@ -2355,7 +2355,7 @@ void MDCache::handle_cache_rejoin_strong(MMDSCacheRejoin *strong) dir->add_replica(from); dir->dir_rep = p->second.dir_rep; - for (map::iterator q = strong->strong_dentries[p->first].begin(); + for (map::iterator q = strong->strong_dentries[p->first].begin(); q != strong->strong_dentries[p->first].end(); ++q) { CDentry *dn = dir->lookup(q->first); @@ -2511,7 +2511,7 @@ void MDCache::handle_cache_rejoin_ack(MMDSCacheRejoin *ack) dout(10) << " got " << *dir << dendl; // dentries - for (map::iterator q = ack->strong_dentries[p->first].begin(); + for (map::iterator q = ack->strong_dentries[p->first].begin(); q != ack->strong_dentries[p->first].end(); ++q) { CDentry *dn = dir->lookup(q->first); @@ -3602,7 +3602,7 @@ void MDCache::handle_cache_expire(MCacheExpire *m) } // DENTRIES - for (map >::iterator pd = p->second.dentries.begin(); + for (map >::iterator pd = p->second.dentries.begin(); pd != p->second.dentries.end(); ++pd) { dout(10) << " dn expires in dir " << pd->first << dendl; @@ -3617,7 +3617,7 @@ void MDCache::handle_cache_expire(MCacheExpire *m) assert(dir->is_auth()); } - for (map::iterator p = pd->second.begin(); + for (map::iterator p = pd->second.begin(); p != pd->second.end(); ++p) { int nonce = p->second; diff --git a/src/mds/events/EMetaBlob.h b/src/mds/events/EMetaBlob.h index 08c648b695747..51a9c7e994997 100644 --- a/src/mds/events/EMetaBlob.h +++ b/src/mds/events/EMetaBlob.h @@ -16,8 +16,8 @@ #define __MDS_EMETABLOB_H #include -#include -using std::string; + +#include "include/nstring.h" #include "../CInode.h" #include "../CDir.h" @@ -50,7 +50,7 @@ public: /* fullbit - a regular dentry + inode */ struct fullbit { - string dn; // dentry + nstring dn; // dentry version_t dnv; inode_t inode; // if it's not fragtree_t dirfragtree; @@ -58,7 +58,7 @@ public: string symlink; bool dirty; - fullbit(const string& d, version_t v, inode_t& i, fragtree_t &dft, map &xa, string& sym, bool dr) : + fullbit(const nstring& d, version_t v, inode_t& i, fragtree_t &dft, map &xa, const string& sym, bool dr) : dn(d), dnv(v), inode(i), dirfragtree(dft), xattrs(xa), symlink(sym), dirty(dr) { } fullbit(bufferlist::iterator &p) { decode(p); } fullbit() {} @@ -94,13 +94,13 @@ public: /* remotebit - a dentry + remote inode link (i.e. just an ino) */ struct remotebit { - string dn; + nstring dn; version_t dnv; inodeno_t ino; unsigned char d_type; bool dirty; - remotebit(const string& d, version_t v, inodeno_t i, unsigned char dt, bool dr) : + remotebit(const nstring& d, version_t v, inodeno_t i, unsigned char dt, bool dr) : dn(d), dnv(v), ino(i), d_type(dt), dirty(dr) { } remotebit(bufferlist::iterator &p) { decode(p); } remotebit() {} @@ -131,11 +131,11 @@ public: * nullbit - a null dentry */ struct nullbit { - string dn; + nstring dn; version_t dnv; bool dirty; - nullbit(const string& d, version_t v, bool dr) : dn(d), dnv(v), dirty(dr) { } + nullbit(const nstring& d, version_t v, bool dr) : dn(d), dnv(v), dirty(dr) { } nullbit(bufferlist::iterator &p) { decode(p); } nullbit() {} diff --git a/src/mds/events/ESlaveUpdate.h b/src/mds/events/ESlaveUpdate.h index d8d2443b0967e..3c348ead0c05b 100644 --- a/src/mds/events/ESlaveUpdate.h +++ b/src/mds/events/ESlaveUpdate.h @@ -56,7 +56,7 @@ struct rename_rollback { utime_t dirfrag_old_mtime; utime_t dirfrag_old_rctime; inodeno_t ino, remote_ino; - string dname; + nstring dname; char remote_d_type; utime_t old_ctime; diff --git a/src/mds/mdstypes.h b/src/mds/mdstypes.h index 1b8f5aeca0c75..597d0779cced5 100644 --- a/src/mds/mdstypes.h +++ b/src/mds/mdstypes.h @@ -18,6 +18,7 @@ using namespace std; #include "include/frag.h" #include "include/xlist.h" +#include "include/nstring.h" #define MDS_REF_SET // define me for improved debug output, sanity checking //#define MDS_VERIFY_FRAGSTAT // do do (slow) sanity checking on frags @@ -640,7 +641,7 @@ class MDSCacheObjectInfo { public: inodeno_t ino; dirfrag_t dirfrag; - string dname; + nstring dname; MDSCacheObjectInfo() : ino(0) {} diff --git a/src/messages/MCacheExpire.h b/src/messages/MCacheExpire.h index 43d69dcd321ac..ecab919dba296 100644 --- a/src/messages/MCacheExpire.h +++ b/src/messages/MCacheExpire.h @@ -26,7 +26,7 @@ public: struct realm { map inodes; map dirs; - map > dentries; + map > dentries; void encode(bufferlist &bl) const { ::encode(inodes, bl); @@ -58,7 +58,7 @@ public: void add_dir(dirfrag_t r, dirfrag_t df, int nonce) { realms[r].dirs[df] = nonce; } - void add_dentry(dirfrag_t r, dirfrag_t df, const string& dn, int nonce) { + void add_dentry(dirfrag_t r, dirfrag_t df, const nstring& dn, int nonce) { realms[r].dentries[df][dn] = nonce; } @@ -72,10 +72,10 @@ public: p != r.dirs.end(); ++p) myr.dirs[p->first] = p->second; - for (map >::iterator p = r.dentries.begin(); + for (map >::iterator p = r.dentries.begin(); p != r.dentries.end(); ++p) - for (map::iterator q = p->second.begin(); + for (map::iterator q = p->second.begin(); q != p->second.end(); ++q) myr.dentries[p->first][q->first] = q->second; diff --git a/src/messages/MClientLease.h b/src/messages/MClientLease.h index c4e54e5249654..0e12803dd7512 100644 --- a/src/messages/MClientLease.h +++ b/src/messages/MClientLease.h @@ -31,7 +31,7 @@ static const char *get_lease_action_name(int a) { struct MClientLease : public Message { struct ceph_mds_lease h; - string dname; + nstring dname; int get_action() { return h.action; } int get_mask() { return h.mask; } @@ -44,7 +44,7 @@ struct MClientLease : public Message { h.mask = m; h.ino = i; } - MClientLease(int ac, int m, __u64 i, const string& d) : + MClientLease(int ac, int m, __u64 i, const nstring& d) : Message(CEPH_MSG_CLIENT_LEASE), dname(d) { h.action = ac; diff --git a/src/messages/MDentryUnlink.h b/src/messages/MDentryUnlink.h index 0a50487667192..074e149b66e78 100644 --- a/src/messages/MDentryUnlink.h +++ b/src/messages/MDentryUnlink.h @@ -18,11 +18,11 @@ class MDentryUnlink : public Message { dirfrag_t dirfrag; - string dn; + nstring dn; public: dirfrag_t get_dirfrag() { return dirfrag; } - string& get_dn() { return dn; } + nstring& get_dn() { return dn; } CInodeDiscover *strayin; CDirDiscover *straydir; @@ -31,7 +31,7 @@ class MDentryUnlink : public Message { MDentryUnlink() : Message(MSG_MDS_DENTRYUNLINK), strayin(0), straydir(0), straydn(0) { } - MDentryUnlink(dirfrag_t df, string& n) : + MDentryUnlink(dirfrag_t df, nstring& n) : Message(MSG_MDS_DENTRYUNLINK), dirfrag(df), dn(n), diff --git a/src/messages/MExportDirPrep.h b/src/messages/MExportDirPrep.h index 206cc966efcca..7ee9f5f5ac16d 100644 --- a/src/messages/MExportDirPrep.h +++ b/src/messages/MExportDirPrep.h @@ -33,7 +33,7 @@ class MExportDirPrep : public Message { list inodes; list dentries; map inode_dirfrag; - map inode_dentry; + map inode_dentry; map > frags_by_ino; map dirfrags; @@ -53,7 +53,7 @@ class MExportDirPrep : public Message { dirfrag_t get_containing_dirfrag(inodeno_t ino) { return inode_dirfrag[ino]; } - string& get_dentry(inodeno_t ino) { + nstring& get_dentry(inodeno_t ino) { return inode_dentry[ino]; } bool have_dirfrag(dirfrag_t df) { @@ -98,7 +98,7 @@ class MExportDirPrep : public Message { void add_export(dirfrag_t df) { bounds.push_back( df ); } - void add_inode(dirfrag_t df, const string& name, CDentryDiscover *dn, CInodeDiscover *in) { + void add_inode(dirfrag_t df, const nstring& name, CDentryDiscover *dn, CInodeDiscover *in) { inodes.push_back(in); dentries.push_back(dn); inode_dirfrag[in->get_ino()] = df; diff --git a/src/messages/MMDSCacheRejoin.h b/src/messages/MMDSCacheRejoin.h index d687b1fa4150b..7928d580bf34a 100644 --- a/src/messages/MMDSCacheRejoin.h +++ b/src/messages/MMDSCacheRejoin.h @@ -160,12 +160,12 @@ class MMDSCacheRejoin : public Message { // weak map > dirfrag_stat; - map > weak; + map > weak; set weak_inodes; // strong map strong_dirfrags; - map > strong_dentries; + map > strong_dentries; map strong_inodes; // open @@ -179,8 +179,8 @@ class MMDSCacheRejoin : public Message { // authpins, xlocks map authpinned_inodes; map > xlocked_inodes; - map > authpinned_dentries; - map > xlocked_dentries; + map > authpinned_dentries; + map > xlocked_dentries; MMDSCacheRejoin() : Message(MSG_MDS_CACHEREJOIN) {} MMDSCacheRejoin(int o) : @@ -222,7 +222,7 @@ class MMDSCacheRejoin : public Message { void add_weak_dirfrag(dirfrag_t df) { weak[df]; } - void add_weak_dirfrag(dirfrag_t df, map& dnmap) { + void add_weak_dirfrag(dirfrag_t df, map& dnmap) { weak[df] = dnmap; } void add_strong_dirfrag(dirfrag_t df, int n, int dr) { @@ -236,13 +236,13 @@ class MMDSCacheRejoin : public Message { void add_weak_primary_dentry(dirfrag_t df, const string& dname, inodeno_t ino) { weak[df][dname] = dn_weak(ino); } - void add_strong_dentry(dirfrag_t df, const string& dname, inodeno_t pi, inodeno_t ri, unsigned char rdt, int n, int ls) { + void add_strong_dentry(dirfrag_t df, const nstring& dname, inodeno_t pi, inodeno_t ri, unsigned char rdt, int n, int ls) { strong_dentries[df][dname] = dn_strong(pi, ri, rdt, n, ls); } - void add_dentry_authpin(dirfrag_t df, const string& dname, const metareqid_t& ri) { + void add_dentry_authpin(dirfrag_t df, const nstring& dname, const metareqid_t& ri) { authpinned_dentries[df][dname] = ri; } - void add_dentry_xlock(dirfrag_t df, const string& dname, const metareqid_t& ri) { + void add_dentry_xlock(dirfrag_t df, const nstring& dname, const metareqid_t& ri) { xlocked_dentries[df][dname] = ri; } -- 2.39.5