Skip to content

Commit

Permalink
osd/osd_types: skip encoding newer object_info_t fields if they are u…
Browse files Browse the repository at this point in the history
…nused

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>
  • Loading branch information
liewegas committed Dec 15, 2015
1 parent 1548a3f commit a9d3f07
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/osd/osd_types.cc
Expand Up @@ -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
Expand All @@ -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);
}

Expand Down

0 comments on commit a9d3f07

Please sign in to comment.