]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: include osd_fsid in OSDSuperblock
authorSage Weil <sage.weil@dreamhost.com>
Wed, 30 Nov 2011 05:05:20 +0000 (21:05 -0800)
committerSage Weil <sage@newdream.net>
Mon, 19 Dec 2011 16:12:11 +0000 (08:12 -0800)
Generated during mkfs.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/osd/OSD.cc
src/osd/osd_types.cc
src/osd/osd_types.h

index e39dfe4382bfdbc20826af489c52b36cd73433f7..11ef3be2022851214fde733c2fbd79ef7c88647e 100644 (file)
@@ -263,8 +263,11 @@ int OSD::mkfs(const std::string &dev, const std::string &jdev, uuid_d fsid, int
   int ret;
   ObjectStore *store = NULL;
   OSDSuperblock sb;
+
   sb.cluster_fsid = fsid;
+
   sb.whoami = whoami;
+  sb.osd_fsid.generate_random();
 
   try {
     store = create_object_store(dev, jdev);
index b5b522813b1c4d13d8d68053c6a18aaec254a71a..f8ead594ac0bd7eef9136fad1d5d550f16910854 100644 (file)
@@ -522,7 +522,7 @@ ostream& operator<<(ostream& out, const pg_pool_t& p)
 
 void OSDSuperblock::encode(bufferlist &bl) const
 {
-  __u8 v = 3;
+  __u8 v = 4;
   ::encode(v, bl);
 
   ::encode(cluster_fsid, bl);
@@ -534,6 +534,7 @@ void OSDSuperblock::encode(bufferlist &bl) const
   compat_features.encode(bl);
   ::encode(clean_thru, bl);
   ::encode(mounted, bl);
+  ::encode(osd_fsid, bl);
 }
 
 void OSDSuperblock::decode(bufferlist::iterator &bl)
@@ -558,6 +559,8 @@ void OSDSuperblock::decode(bufferlist::iterator &bl)
   }
   ::decode(clean_thru, bl);
   ::decode(mounted, bl);
+  if (v >= 4)
+    ::decode(osd_fsid, bl);
 }
 
 
index cbd694d76abf179756d0f488b94f308e9e750503..169166f4fa1610d1583a87f6567df865d1319992 100644 (file)
@@ -1107,7 +1107,7 @@ inline ostream& operator<<(ostream& out, const ObjectExtent &ex)
 
 class OSDSuperblock {
 public:
-  uuid_d cluster_fsid;
+  uuid_d cluster_fsid, osd_fsid;
   int32_t whoami;    // my role in this fs.
   epoch_t current_epoch;             // most recent epoch
   epoch_t oldest_map, newest_map;    // oldest/newest maps we have.
@@ -1134,6 +1134,7 @@ inline ostream& operator<<(ostream& out, const OSDSuperblock& sb)
 {
   return out << "sb(" << sb.cluster_fsid
              << " osd." << sb.whoami
+            << " " << sb.osd_fsid
              << " e" << sb.current_epoch
              << " [" << sb.oldest_map << "," << sb.newest_map << "]"
             << " lci=[" << sb.mounted << "," << sb.clean_thru << "]"