]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: store dir inode in separate object; fetch from both. incompat flag.
authorSage Weil <sage@newdream.net>
Wed, 27 Oct 2010 21:43:43 +0000 (14:43 -0700)
committerSage Weil <sage@newdream.net>
Thu, 28 Oct 2010 00:17:33 +0000 (17:17 -0700)
This avoids setting large xattrs.  There's no reason the inode needs to be
on the same object as the dir(frag) data.

Signed-off-by: Sage Weil <sage@newdream.net>
src/mds/CInode.cc
src/mds/CInode.h
src/mds/MDSMap.cc
src/mds/MDSMap.h

index 89e52d2cf8bdf53fc9f38cdeb7f4e91ef64e496b..5f400bdabbe1ede59a6c86d976b9d094628bf005 100644 (file)
@@ -831,6 +831,7 @@ void CInode::store(Context *fin)
   dout(10) << "store " << get_version() << dendl;
   assert(is_base());
 
+  // encode
   bufferlist bl;
   string magic = CEPH_FS_ONDISK_MAGIC;
   ::encode(magic, bl);
@@ -839,10 +840,10 @@ void CInode::store(Context *fin)
   // write it.
   SnapContext snapc;
   ObjectOperation m;
-  m.setxattr("inode", bl);
+  m.write_full(bl);
 
   char n[30];
-  snprintf(n, sizeof(n), "%llx.%08llx", (long long unsigned)ino(), (long long unsigned)frag_t());
+  snprintf(n, sizeof(n), "%llx.%08llx.inode", (long long unsigned)ino(), (long long unsigned)frag_t());
   object_t oid(n);
   OSDMap *osdmap = mdcache->mds->objecter->osdmap;
   ceph_object_layout ol = osdmap->make_object_layout(oid,
@@ -864,11 +865,11 @@ void CInode::_stored(version_t v, Context *fin)
 
 struct C_Inode_Fetched : public Context {
   CInode *in;
-  bufferlist bl;
+  bufferlist bl, bl2;
   Context *fin;
   C_Inode_Fetched(CInode *i, Context *f) : in(i), fin(f) {}
   void finish(int r) {
-    in->_fetched(bl, fin);
+    in->_fetched(bl, bl2, fin);
   }
 };
 
@@ -877,6 +878,8 @@ void CInode::fetch(Context *fin)
   dout(10) << "fetch" << dendl;
 
   C_Inode_Fetched *c = new C_Inode_Fetched(this, fin);
+  C_Gather *gather = new C_Gather(c);
+
   char n[30];
   snprintf(n, sizeof(n), "%llx.%08llx", (long long unsigned)ino(), (long long unsigned)frag_t());
   object_t oid(n);
@@ -888,13 +891,27 @@ void CInode::fetch(Context *fin)
   ceph_object_layout ol = osdmap->make_object_layout(oid,
                                                     mdcache->mds->mdsmap->get_metadata_pg_pool());
 
-  mdcache->mds->objecter->read(oid, ol, rd, CEPH_NOSNAP, &c->bl, 0, c );
+  mdcache->mds->objecter->read(oid, ol, rd, CEPH_NOSNAP, &c->bl, 0, gather->new_sub() );
+
+  
+  // read from separate object too
+  snprintf(n, sizeof(n), "%llx.%08llx.inode", (long long unsigned)ino(), (long long unsigned)frag_t());
+  object_t oid2(n);
+
+  ceph_object_layout ol2 = osdmap->make_object_layout(oid2,
+                                                    mdcache->mds->mdsmap->get_metadata_pg_pool());
+
+  mdcache->mds->objecter->read(oid2, ol2, 0, 0, CEPH_NOSNAP, &c->bl2, 0, gather->new_sub() );
 }
 
-void CInode::_fetched(bufferlist& bl, Context *fin)
+void CInode::_fetched(bufferlist& bl, bufferlist& bl2, Context *fin)
 {
-  dout(10) << "_fetched" << dendl;
-  bufferlist::iterator p = bl.begin();
+  dout(10) << "_fetched got " << bl.length() << " and " << bl2.length() << dendl;
+  bufferlist::iterator p;
+  if (bl2.length())
+    p = bl2.begin();
+  else
+    p = bl.begin();
   string magic;
   ::decode(magic, p);
   dout(10) << " magic is '" << magic << "' (expecting '" << CEPH_FS_ONDISK_MAGIC << "')" << dendl;
index 5e8b6f7be751fe873fedd3480a6d10a79a7fcadd..b0ab2b18cd572c1ece4b5db1d462a4011f1b2f9f 100644 (file)
@@ -546,7 +546,7 @@ private:
   void store(Context *fin);
   void _stored(version_t cv, Context *fin);
   void fetch(Context *fin);
-  void _fetched(bufferlist& bl, Context *fin);  
+  void _fetched(bufferlist& bl, bufferlist& bl2, Context *fin);  
 
   void store_parent(Context *fin);
   void _stored_parent(version_t v, Context *fin);
index 10d2f45736f67107dd0b0d7b5970979bb8de030c..f2bac97cdabbc832e3dd3f0df74f092cea76c5ed 100644 (file)
@@ -28,6 +28,7 @@ const struct CompatSet::Feature feature_incompat[] = {
   MDS_FEATURE_INCOMPAT_BASE,
   MDS_FEATURE_INCOMPAT_CLIENTRANGES,
   MDS_FEATURE_INCOMPAT_FILELAYOUT,
+  MDS_FEATURE_INCOMPAT_DIRINODE,
   END_FEATURE
 };
 const struct CompatSet::Feature feature_ro_compat[] = {
index 867d8410495db619f16e82b698ab385137f3e7a6..7c9749075a91f1c2eabc43e83f5b08aceae42a3d 100644 (file)
@@ -59,6 +59,7 @@ extern CompatSet mdsmap_compat_base; // pre v0.20
 #define MDS_FEATURE_INCOMPAT_BASE CompatSet::Feature(1, "base v0.20")
 #define MDS_FEATURE_INCOMPAT_CLIENTRANGES CompatSet::Feature(2, "client writeable ranges")
 #define MDS_FEATURE_INCOMPAT_FILELAYOUT CompatSet::Feature(3, "default file layouts on dirs")
+#define MDS_FEATURE_INCOMPAT_DIRINODE CompatSet::Feature(4, "dir inode in separate objec")
 
 class MDSMap {
 public: