typedef map<snapid_t, old_inode_t> old_inodes_t;
old_inodes_t old_inodes;
- bufferlist _enc;
-
fullbit(const fullbit& o);
const fullbit& operator=(const fullbit& o);
const map<string,bufferptr> &xa, const string& sym,
const bufferlist &sbl, __u8 st,
const old_inodes_t *oi = NULL) :
- //dn(d), dnfirst(df), dnlast(dl), dnv(v),
- //inode(i), dirfragtree(dft), xattrs(xa), symlink(sym), snapbl(sbl), dirty(dr)
- _enc(1024)
+ dn(d), dnfirst(df), dnlast(dl), dnv(v), inode(i), xattrs(xa), state(st)
{
- ::encode(d, _enc);
- ::encode(df, _enc);
- ::encode(dl, _enc);
- ::encode(v, _enc);
- ::encode(i, _enc);
- ::encode(xa, _enc);
if (i.is_symlink())
- ::encode(sym, _enc);
+ symlink = sym;
if (i.is_dir()) {
- ::encode(dft, _enc);
- ::encode(sbl, _enc);
+ dirfragtree = dft;
+ snapbl = sbl;
}
- ::encode(st, _enc);
- ::encode(oi ? true : false, _enc);
if (oi)
- ::encode(*oi, _enc);
+ old_inodes = *oi;
}
fullbit(bufferlist::iterator &p) {
decode(p);
unsigned char d_type;
bool dirty;
- bufferlist _enc;
-
remotebit(const string& d, snapid_t df, snapid_t dl, version_t v, inodeno_t i, unsigned char dt, bool dr) :
- //dn(d), dnfirst(df), dnlast(dl), dnv(v), ino(i), d_type(dt), dirty(dr) { }
- _enc(256) {
- ::encode(d, _enc);
- ::encode(df, _enc);
- ::encode(dl, _enc);
- ::encode(v, _enc);
- ::encode(i, _enc);
- ::encode(dt, _enc);
- ::encode(dr, _enc);
- }
+ dn(d), dnfirst(df), dnlast(dl), dnv(v), ino(i), d_type(dt), dirty(dr) { }
remotebit(bufferlist::iterator &p) { decode(p); }
remotebit(): dnfirst(0), dnlast(0), dnv(0), ino(0),
d_type('\0'), dirty(false) {}
version_t dnv;
bool dirty;
- bufferlist _enc;
-
nullbit(const string& d, snapid_t df, snapid_t dl, version_t v, bool dr) :
- //dn(d), dnfirst(df), dnlast(dl), dnv(v), dirty(dr) { }
- _enc(128) {
- ::encode(d, _enc);
- ::encode(df, _enc);
- ::encode(dl, _enc);
- ::encode(v, _enc);
- ::encode(dr, _enc);
- }
+ dn(d), dnfirst(df), dnlast(dl), dnv(v), dirty(dr) { }
nullbit(bufferlist::iterator &p) { decode(p); }
nullbit(): dnfirst(0), dnlast(0), dnv(0), dirty(false) {}
void EMetaBlob::fullbit::encode(bufferlist& bl) const {
ENCODE_START(6, 5, bl);
- if (!_enc.length()) {
- fullbit copy(dn, dnfirst, dnlast, dnv, inode, dirfragtree, xattrs, symlink,
- snapbl, state, &old_inodes);
- bl.append(copy._enc);
+ ::encode(dn, bl);
+ ::encode(dnfirst, bl);
+ ::encode(dnlast, bl);
+ ::encode(dnv, bl);
+ ::encode(inode, bl);
+ ::encode(xattrs, bl);
+ if (inode.is_symlink())
+ ::encode(symlink, bl);
+ if (inode.is_dir()) {
+ ::encode(dirfragtree, bl);
+ ::encode(snapbl, bl);
+ }
+ ::encode(state, bl);
+ if (old_inodes.empty()) {
+ ::encode(false, bl);
} else {
- bl.append(_enc);
+ ::encode(true, bl);
+ ::encode(old_inodes, bl);
}
ENCODE_FINISH(bl);
}
void EMetaBlob::fullbit::dump(Formatter *f) const
{
- if (_enc.length() && !dn.length()) {
- /* if our bufferlist has data but our name is empty, we
- * haven't initialized ourselves; do so in order to print members!
- * We use const_cast here because the whole point is we aren't
- * fully set up and this isn't changing who we "are", just our
- * representation.
- */
- EMetaBlob::fullbit *me = const_cast<EMetaBlob::fullbit*>(this);
- bufferlist encoded;
- encode(encoded);
- bufferlist::iterator p = encoded.begin();
- me->decode(p);
- }
f->dump_string("dentry", dn);
f->dump_stream("snapid.first") << dnfirst;
f->dump_stream("snapid.last") << dnlast;
void EMetaBlob::remotebit::encode(bufferlist& bl) const
{
ENCODE_START(2, 2, bl);
- if (!_enc.length()) {
- remotebit copy(dn, dnfirst, dnlast, dnv, ino, d_type, dirty);
- bl.append(copy._enc);
- } else {
- bl.append(_enc);
- }
+ ::encode(dn, bl);
+ ::encode(dnfirst, bl);
+ ::encode(dnlast, bl);
+ ::encode(dnv, bl);
+ ::encode(ino, bl);
+ ::encode(d_type, bl);
+ ::encode(dirty, bl);
ENCODE_FINISH(bl);
}
void EMetaBlob::remotebit::dump(Formatter *f) const
{
- if (_enc.length() && !dn.length()) {
- /* if our bufferlist has data but our name is empty, we
- * haven't initialized ourselves; do so in order to print members!
- * We use const_cast here because the whole point is we aren't
- * fully set up and this isn't changing who we "are", just our
- * representation.
- */
- EMetaBlob::remotebit *me = const_cast<EMetaBlob::remotebit*>(this);
- bufferlist encoded;
- encode(encoded);
- bufferlist::iterator p = encoded.begin();
- me->decode(p);
- }
f->dump_string("dentry", dn);
f->dump_int("snapid.first", dnfirst);
f->dump_int("snapid.last", dnlast);
void EMetaBlob::nullbit::encode(bufferlist& bl) const
{
ENCODE_START(2, 2, bl);
- if (!_enc.length()) {
- nullbit copy(dn, dnfirst, dnlast, dnv, dirty);
- bl.append(copy._enc);
- } else {
- bl.append(_enc);
- }
+ ::encode(dn, bl);
+ ::encode(dnfirst, bl);
+ ::encode(dnlast, bl);
+ ::encode(dnv, bl);
+ ::encode(dirty, bl);
ENCODE_FINISH(bl);
}
void EMetaBlob::nullbit::dump(Formatter *f) const
{
- if (_enc.length() && !dn.length()) {
- /* if our bufferlist has data but our name is empty, we
- * haven't initialized ourselves; do so in order to print members!
- * We use const_cast here because the whole point is we aren't
- * fully set up and this isn't changing who we "are", just our
- * representation.
- */
- EMetaBlob::nullbit *me = const_cast<EMetaBlob::nullbit*>(this);
- bufferlist encoded;
- encode(encoded);
- bufferlist::iterator p = encoded.begin();
- me->decode(p);
- }
f->dump_string("dentry", dn);
f->dump_int("snapid.first", dnfirst);
f->dump_int("snapid.last", dnlast);