]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/CInode: move hash_dentry_name up into InodeStore
authorJohn Spray <john.spray@redhat.com>
Fri, 12 Jun 2015 13:24:04 +0000 (14:24 +0100)
committerJohn Spray <john.spray@redhat.com>
Mon, 13 Jul 2015 13:05:16 +0000 (14:05 +0100)
Because it only depends on the data in the store, not
anything from a live MDS, and it's useful when
we're dealing with fragmented directories from
an offline tool.

Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/CInode.cc
src/mds/CInode.h

index 41bcb5c53794abdf93c438ab8be7881a3dfe8575..58ebf3f9664301daedec71a8da0b333e10e395ca 100644 (file)
@@ -468,7 +468,7 @@ void CInode::pop_projected_snaprealm(sr_t *next_snaprealm)
 
 // dirfrags
 
-__u32 CInode::hash_dentry_name(const string &dn)
+__u32 InodeStoreBase::hash_dentry_name(const string &dn)
 {
   int which = inode.dir_layout.dl_dir_hash;
   if (!which)
@@ -476,7 +476,7 @@ __u32 CInode::hash_dentry_name(const string &dn)
   return ceph_str_hash(which, dn.data(), dn.length());
 }
 
-frag_t CInode::pick_dirfrag(const string& dn)
+frag_t InodeStoreBase::pick_dirfrag(const string& dn)
 {
   if (dirfragtree.empty())
     return frag_t();          // avoid the string hash if we can.
index e63bce8208c05e776e9ebb1299d685c7c813c038..8b7a38db83f81ad088b9099386124cf89cd5449a 100644 (file)
@@ -97,6 +97,10 @@ public:
 
   /* For test/debug output */
   void dump(Formatter *f) const;
+
+  /* For use by offline tools */
+  __u32 hash_dentry_name(const std::string &dn);
+  frag_t pick_dirfrag(const std::string &dn);
 };
 
 class InodeStore : public InodeStoreBase {
@@ -398,8 +402,6 @@ private:
   int stickydir_ref;
 
 public:
-  __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)) {