]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: introduce fs_cluster_id_t type
authorJohn Spray <john.spray@redhat.com>
Wed, 17 Feb 2016 15:19:10 +0000 (15:19 +0000)
committerJohn Spray <john.spray@redhat.com>
Thu, 10 Mar 2016 11:18:29 +0000 (11:18 +0000)
Unique identifier for a filesystem within
the ceph cluster.  Abbreviated to `fscid`,
deliberately chosen to not conflict
with legacy "fsid" identifiers.

Additionally add mds_role_t type which is
a more general form of rank: ranks are
now only unique within a particular fscid.
Roles are a fscid plus a rank.

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

index 5deec00cc2839806e50e35ef200f335ca56c8202..066b26b3536fa218f17bc3b4b16b4ee0accc5dfe 100644 (file)
@@ -1099,3 +1099,9 @@ void MDSCacheObject::dump_states(Formatter *f) const
 }
 
 
+ostream& operator<<(ostream &out, const mds_role_t &role)
+{
+  out << role.fscid << ":" << role.rank;
+  return out;
+}
+
index c42d6211002948e0f691a8cc6437230f2fa2cd08..e789856b36d7cb70e1ddb401383fdaf0021f3109 100644 (file)
 
 
 typedef int32_t mds_rank_t;
+typedef int32_t fs_cluster_id_t;
+
+
+
 BOOST_STRONG_TYPEDEF(uint64_t, mds_gid_t)
 extern const mds_gid_t MDS_GID_NONE;
+constexpr fs_cluster_id_t FS_CLUSTER_ID_NONE = {-1};
+// The namespace ID of the anonymous default filesystem from legacy systems
+constexpr fs_cluster_id_t FS_CLUSTER_ID_ANONYMOUS = {0};
 extern const mds_rank_t MDS_RANK_NONE;
 
+class mds_role_t
+{
+  public:
+  mds_rank_t rank;
+  fs_cluster_id_t fscid;
+  mds_role_t(fs_cluster_id_t fscid_, mds_rank_t rank_)
+    : rank(rank_), fscid(fscid_)
+  {}
+  mds_role_t()
+    : rank(MDS_RANK_NONE), fscid(FS_CLUSTER_ID_NONE)
+  {}
+  bool operator<(mds_role_t const &rhs) const
+  {
+    if (fscid < rhs.fscid) {
+      return true;
+    } else if (fscid == rhs.fscid) {
+      return rank < rhs.rank;
+    } else {
+      return false;
+    }
+  }
+
+  bool is_none() const
+  {
+    return (rank == MDS_RANK_NONE);
+  }
+};
+std::ostream& operator<<(std::ostream &out, const mds_role_t &role);
+
 
 extern long g_num_ino, g_num_dir, g_num_dn, g_num_cap;
 extern long g_num_inoa, g_num_dira, g_num_dna, g_num_capa;