]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/osd_types: skip encoding newer object_info_t fields if they are unused 6544/head
authorSage Weil <sage@redhat.com>
Mon, 14 Dec 2015 18:13:33 +0000 (13:13 -0500)
committerSage Weil <sage@redhat.com>
Tue, 15 Dec 2015 02:07:14 +0000 (21:07 -0500)
This reduces the size of the encoded object_info_t in most cases,
enough to get us under the 255 byte limit for a single inline
xattr in XFS.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/osd_types.cc

index 94ca0832313efc2f288b77b93c6cbf09174bf27b..29f4fc4cc53a13032c402d6209004240f4abaed9 100644 (file)
@@ -4225,7 +4225,16 @@ void object_info_t::encode(bufferlist& bl) const
        ++i) {
     old_watchers.insert(make_pair(i->first.second, i->second));
   }
-  ENCODE_START(15, 8, bl);
+
+  // kludge to reduce xattr size for most rbd objects
+  int ev = 15;
+  if (!(flags & FLAG_OMAP_DIGEST) &&
+      !(flags & FLAG_DATA_DIGEST) &&
+      local_mtime == utime_t()) {
+    ev = 13;
+  }
+
+  ENCODE_START(ev, 8, bl);
   ::encode(soid, bl);
   ::encode(myoloc, bl);        //Retained for compatibility
   ::encode((__u32)0, bl); // was category, no longer used
@@ -4250,9 +4259,13 @@ void object_info_t::encode(bufferlist& bl) const
   ::encode(watchers, bl);
   __u32 _flags = flags;
   ::encode(_flags, bl);
-  ::encode(local_mtime, bl);
-  ::encode(data_digest, bl);
-  ::encode(omap_digest, bl);
+  if (ev >= 14) {
+    ::encode(local_mtime, bl);
+  }
+  if (ev >= 15) {
+    ::encode(data_digest, bl);
+    ::encode(omap_digest, bl);
+  }
   ENCODE_FINISH(bl);
 }