]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: give MDSTables a `rank` attribute
authorJohn Spray <john.spray@redhat.com>
Fri, 16 Jan 2015 00:02:00 +0000 (00:02 +0000)
committerJohn Spray <john.spray@redhat.com>
Fri, 16 Jan 2015 00:45:25 +0000 (00:45 +0000)
...so that they (like the new SessionMapStore)
can be used outside of a live MDS in tool code.

Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/InoTable.cc
src/mds/MDS.cc
src/mds/MDSTable.cc
src/mds/MDSTable.h
src/mds/MDSTableServer.cc
src/mds/SnapServer.cc

index 518569511244b9e0a21a13d13970b2bbac4a9b1e..d8363e60ea6a691749c232180e79e05b1abf7392 100644 (file)
 
 #define dout_subsys ceph_subsys_mds
 #undef dout_prefix
-#define dout_prefix *_dout << "mds." << mds->get_nodeid() << "." << table_name << ": "
+#define dout_prefix *_dout << "mds." << rank << "." << table_name << ": "
 
 void InoTable::reset_state()
 {
   // use generic range. FIXME THIS IS CRAP
   free.clear();
   //#ifdef __LP64__
-  uint64_t start = (uint64_t)(mds->get_nodeid()+1) << 40;
+  uint64_t start = (uint64_t)(rank+1) << 40;
   uint64_t len = (uint64_t)1 << 40;
   //#else
   //# warning this looks like a 32-bit system, using small inode numbers.
index fc00797d20ed019e6164d66a93ff69814bfdf760..387eda18ffa34bfb7b72bdcc2f7ba315d31adbd5 100644 (file)
@@ -1768,6 +1768,8 @@ void MDS::boot_create()
 
   mdcache->init_layouts();
 
+  snapserver->set_rank(whoami);
+  inotable->set_rank(whoami);
   sessionmap.set_rank(whoami);
 
   // start with a fresh journal
@@ -1851,6 +1853,7 @@ void MDS::boot_start(BootStep step, int r)
         MDSGatherBuilder gather(g_ceph_context,
             new C_MDS_BootStart(this, MDS_BOOT_OPEN_ROOT));
         dout(2) << "boot_start " << step << ": opening inotable" << dendl;
+        inotable->set_rank(whoami);
         inotable->load(gather.new_sub());
 
         dout(2) << "boot_start " << step << ": opening sessionmap" << dendl;
@@ -1862,6 +1865,7 @@ void MDS::boot_start(BootStep step, int r)
 
         if (mdsmap->get_tableserver() == whoami) {
           dout(2) << "boot_start " << step << ": opening snap table" << dendl;
+          snapserver->set_rank(whoami);
           snapserver->load(gather.new_sub());
         }
 
index 8e159d7c9df63647c6cbc14f1d353a0cb6a5786f..a1712dcd9edfa030721d1687658b30474c3ef7c3 100644 (file)
@@ -29,7 +29,7 @@
 
 #define dout_subsys ceph_subsys_mds
 #undef dout_prefix
-#define dout_prefix *_dout << "mds." << (mds ? mds->get_nodeid() : -1) << "." << table_name << ": "
+#define dout_prefix *_dout << "mds." << rank << "." << table_name << ": "
 
 
 class MDSTableIOContext : public MDSIOContextBase
index c68a615ea2a23f493fc65847a26c3c790d948744..392f4fd19acfffbf219b733e60f3f268288d5182 100644 (file)
@@ -29,6 +29,7 @@ public:
 protected:
   const char *table_name;
   bool per_mds;
+  mds_rank_t rank;
 
   object_t get_object_name();
   
@@ -44,11 +45,16 @@ protected:
   
 public:
   MDSTable(MDS *m, const char *n, bool is_per_mds) :
-    mds(m), table_name(n), per_mds(is_per_mds),
+    mds(m), table_name(n), per_mds(is_per_mds), rank(MDS_RANK_NONE),
     state(STATE_UNDEF),
     version(0), committing_version(0), committed_version(0), projected_version(0) {}
   virtual ~MDSTable() {}
 
+  void set_rank(mds_rank_t r)
+  {
+    rank = r;
+  }
+
   version_t get_version() { return version; }
   version_t get_committed_version() { return committed_version; }
   version_t get_committing_version() { return committing_version; }
index 42f421351796b0e11e2d51db6de2cfb1af9d2b86..7c91a888e915df4909a549934c4b794956f44752 100644 (file)
@@ -22,7 +22,7 @@
 
 #define dout_subsys ceph_subsys_mds
 #undef dout_prefix
-#define dout_prefix *_dout << "mds." << mds->get_nodeid() << ".tableserver(" << get_mdstable_name(table) << ") "
+#define dout_prefix *_dout << "mds." << rank << ".tableserver(" << get_mdstable_name(table) << ") "
 
 /* This function DOES put the passed message before returning */
 void MDSTableServer::handle_request(MMDSTableRequest *req)
index 2e211d9f894015c987a4e5c91fc3d4897f09370f..ac0407393edec98518d2584438388bcf1ed1b6ef 100644 (file)
@@ -29,7 +29,7 @@
 
 #define dout_subsys ceph_subsys_mds
 #undef dout_prefix
-#define dout_prefix *_dout << "mds." << mds->get_nodeid() << ".snap "
+#define dout_prefix *_dout << "mds." << rank << ".snap "
 
 
 void SnapServer::reset_state()