encode/decode_simple, streamlined MClientReply::InodeStat encoding

git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1873 29311d96-e01e-0410-9327-a35deaab8ce9
This commit is contained in:
sageweil 2007-09-29 20:12:50 +00:00
parent 8da82c0e11
commit d82f1009c3
9 changed files with 435 additions and 216 deletions

View File

@ -13,7 +13,7 @@
# on issdm, it's /usr/local/mpich2/bin.
# Hook for extra -I options, etc.
EXTRA_CFLAGS = -O3 -pg -g #-I${HOME}/include -L${HOME}/lib
EXTRA_CFLAGS = -pg -g #-I${HOME}/include -L${HOME}/lib
# base
CFLAGS = -Wall -I. -D_FILE_OFFSET_BITS=64 -D_REENTRANT -D_THREAD_SAFE ${EXTRA_CFLAGS}

View File

@ -441,6 +441,10 @@ public:
unsigned get_off() { return off; }
bool end() {
return p == ls.end();
}
void advance(unsigned o) {
//cout << this << " advance " << o << " from " << off << " (p_off " << p_off << " in " << p->length() << ")" << std::endl;
p_off += o;
@ -946,7 +950,9 @@ inline std::ostream& operator<<(std::ostream& out, const buffer::list& bl) {
// ----------------------------------------------------------
// new encoders
// encoders
// DEPRECATED, please use _(en|de)code_(simple|complex)
// raw
template<class T>

View File

@ -24,24 +24,276 @@
#include <string>
#include <ext/hash_map>
// ==================================================================
// simple
// raw
template<class T>
inline void _encode_raw(const T& t, bufferlist& bl)
{
bl.append((char*)&t, sizeof(t));
}
template<class T>
inline void _decode_raw(T& t, bufferlist::iterator &p)
{
p.copy(sizeof(t), (char*)&t);
}
#include <set>
#include <map>
#include <deque>
#include <vector>
#include <string>
#include <ext/hash_map>
// list
template<class T>
inline void _encode_simple(const std::list<T>& ls, bufferlist& bl)
{
// should i pre- or post- count?
if (!ls.empty()) {
unsigned pos = bl.length();
uint32_t n = 0;
_encode_raw(n, bl);
for (typename std::list<T>::const_iterator p = ls.begin(); p != ls.end(); ++p) {
n++;
_encode_simple(*p, bl);
}
bl.copy_in(pos, sizeof(n), (char*)&n);
} else {
uint32_t n = ls.size(); // FIXME: this is slow on a list.
_encode_raw(n, bl);
for (typename std::list<T>::const_iterator p = ls.begin(); p != ls.end(); ++p)
_encode_simple(*p, bl);
}
}
template<class T>
inline void _decode_simple(std::list<T>& ls, bufferlist::iterator& p)
{
uint32_t n;
_decode_raw(n, p);
ls.clear();
while (n--) {
T v;
_decode_simple(v, p);
ls.push_back(v);
}
}
// deque
template<class T>
inline void _encode_simple(const std::deque<T>& ls, bufferlist& bl)
{
uint32_t n = ls.size();
_encode_raw(n, bl);
for (typename std::deque<T>::const_iterator p = ls.begin(); p != ls.end(); ++p)
_encode_simple(*p, bl);
}
template<class T>
inline void _decode_simple(std::deque<T>& ls, bufferlist::iterator& p)
{
uint32_t n;
_decode_raw(n, p);
ls.clear();
while (n--) {
T v;
_decode_simple(v, p);
ls.push_back(v);
}
}
// set
template<class T>
inline void _encode_simple(const std::set<T>& s, bufferlist& bl)
{
uint32_t n = s.size();
_encode_raw(n, bl);
for (typename std::set<T>::const_iterator p = s.begin(); p != s.end(); ++p)
_encode_simple(*p, bl);
}
template<class T>
inline void _decode_simple(std::set<T>& s, bufferlist::iterator& p)
{
uint32_t n;
_decode_raw(n, p);
s.clear();
while (n--) {
T v;
_decode_simple(v, p);
s.insert(v);
}
}
// vector
template<class T>
inline void _encode_simple(const std::vector<T>& v, bufferlist& bl)
{
uint32_t n = v.size();
_encode_raw(n, bl);
for (typename std::vector<T>::const_iterator p = v.begin(); p != v.end(); ++p)
_encode_simple(*p, bl);
}
template<class T>
inline void _decode_simple(std::vector<T>& v, bufferlist::iterator& p)
{
uint32_t n;
_decode_raw(n, p);
v.resize(n);
for (uint32_t i=0; i<n; i++)
_decode_simple(v[i], p);
}
// map
template<class T, class U>
inline void _encode_simple(const std::map<T,U>& m, bufferlist& bl)
{
uint32_t n = m.size();
_encode_raw(n, bl);
for (typename std::map<T,U>::const_iterator p = m.begin(); p != m.end(); ++p) {
_encode_simple(p->first, bl);
_encode_simple(p->second, bl);
}
}
template<class T, class U>
inline void _decode_simple(std::map<T,U>& m, bufferlist::iterator& p)
{
uint32_t n;
_decode_raw(n, p);
m.clear();
while (n--) {
T k;
_decode_simple(k, p);
_decode_simple(m[k], p);
}
}
// hash_map
template<class T, class U>
inline void _encode_simple(const __gnu_cxx::hash_map<T,U>& m, bufferlist& bl)
{
uint32_t n = m.size();
_encode_raw(n, bl);
for (typename __gnu_cxx::hash_map<T,U>::const_iterator p = m.begin(); p != m.end(); ++p) {
_encode_simple(p->first, bl);
_encode_simple(p->second, bl);
}
}
template<class T, class U>
inline void _decode_simple(__gnu_cxx::hash_map<T,U>& m, bufferlist::iterator& p)
{
uint32_t n;
_decode_raw(n, p);
m.clear();
while (n--) {
T k;
_decode_simple(k, p);
_decode_simple(m[k], p);
}
}
// string
inline void _encode_simple(const std::string& s, bufferlist& bl)
{
uint32_t len = s.length();
_encode_raw(len, bl);
bl.append(s.data(), len);
}
inline void _decode_simple(std::string& s, bufferlist::iterator& p)
{
uint32_t len;
_decode_raw(len, p);
s.clear();
p.copy(len, s);
}
// const char* (encode only, string compatible)
inline void _encode_simple(const char *s, bufferlist& bl)
{
uint32_t len = strlen(s);
_encode_raw(len, bl);
bl.append(s, len);
}
// bufferptr (encapsulated)
inline void _encode_simple(const buffer::ptr& bp, bufferlist& bl)
{
uint32_t len = bp.length();
_encode_raw(len, bl);
bl.append(bp);
}
inline void _decode_simple(buffer::ptr& bp, bufferlist::iterator& p)
{
uint32_t len;
_decode_raw(len, p);
bufferlist s;
p.copy(len, s);
if (s.buffers().size() == 1)
bp = s.buffers().front();
else
bp = buffer::copy(s.c_str(), s.length());
}
// bufferlist (encapsulated)
inline void _encode_simple(const bufferlist& s, bufferlist& bl)
{
uint32_t len = s.length();
_encode_raw(len, bl);
bl.append(s);
}
inline void _encode_simple_destructively(bufferlist& s, bufferlist& bl)
{
uint32_t len = s.length();
_encode_raw(len, bl);
bl.claim_append(s);
}
inline void _decode_simple(bufferlist& s, bufferlist::iterator& p)
{
uint32_t len;
_decode_raw(len, p);
s.clear();
p.copy(len, s);
}
// base
template<class T>
inline void _encode_simple(const T& t, bufferlist& bl)
{
_encode_raw(t, bl);
}
template<class T>
inline void _decode_simple(T& t, bufferlist::iterator& p)
{
_decode_raw(t, p);
}
// ==================================================================
// complex
// list
template<class T>
inline void _encode_complex(const std::list<T>& ls, bufferlist& bl)
{
uint32_t n = ls.size();
_encoderaw(n, bl);
_encode_raw(n, bl);
for (typename std::list<T>::const_iterator p = ls.begin(); p != ls.end(); ++p)
_encode_complex(*p, bl);
}
template<class T>
inline void _decode_complex(std::list<T>& ls, bufferlist& bl, int& off)
inline void _decode_complex(std::list<T>& ls, bufferlist::iterator& p)
{
uint32_t n;
_decoderaw(n, bl, off);
_decode_raw(n, p);
ls.clear();
while (n--) {
T v;
_decode_complex(v, bl, off);
_decode_complex(v, p);
ls.push_back(v);
}
}
@ -51,19 +303,19 @@ template<class T>
inline void _encode_complex(const std::deque<T>& ls, bufferlist& bl)
{
uint32_t n = ls.size();
_encoderaw(n, bl);
_encode_raw(n, bl);
for (typename std::deque<T>::const_iterator p = ls.begin(); p != ls.end(); ++p)
_encode_complex(*p, bl);
}
template<class T>
inline void _decode_complex(std::deque<T>& ls, bufferlist& bl, int& off)
inline void _decode_complex(std::deque<T>& ls, bufferlist::iterator& p)
{
uint32_t n;
_decoderaw(n, bl, off);
_decode_raw(n, p);
ls.clear();
while (n--) {
T v;
_decode_complex(v, bl, off);
_decode_complex(v, p);
ls.push_back(v);
}
}
@ -73,19 +325,19 @@ template<class T>
inline void _encode_complex(const std::set<T>& s, bufferlist& bl)
{
uint32_t n = s.size();
_encoderaw(n, bl);
_encode_raw(n, bl);
for (typename std::set<T>::const_iterator p = s.begin(); p != s.end(); ++p)
_encode_complex(*p, bl);
}
template<class T>
inline void _decode_complex(std::set<T>& s, bufferlist& bl, int& off)
inline void _decode_complex(std::set<T>& s, bufferlist::iterator& p)
{
uint32_t n;
_decoderaw(n, bl, off);
_decode_raw(n, p);
s.clear();
while (n--) {
T v;
_decode_complex(v, bl, off);
_decode_complex(v, p);
s.insert(v);
}
}
@ -95,18 +347,18 @@ template<class T>
inline void _encode_complex(const std::vector<T>& v, bufferlist& bl)
{
uint32_t n = v.size();
_encoderaw(n, bl);
_encode_raw(n, bl);
for (typename std::vector<T>::const_iterator p = v.begin(); p != v.end(); ++p)
_encode_complex(*p, bl);
}
template<class T>
inline void _decode_complex(std::vector<T>& v, bufferlist& bl, int& off)
inline void _decode_complex(std::vector<T>& v, bufferlist::iterator& p)
{
uint32_t n;
_decoderaw(n, bl, off);
_decode_raw(n, p);
v.resize(n);
for (uint32_t i=0; i<n; i++)
_decode_complex(v[i], bl, off);
_decode_complex(v[i], p);
}
// map
@ -114,22 +366,22 @@ template<class T, class U>
inline void _encode_complex(const std::map<T,U>& m, bufferlist& bl)
{
uint32_t n = m.size();
_encoderaw(n, bl);
_encode_raw(n, bl);
for (typename std::map<T,U>::const_iterator p = m.begin(); p != m.end(); ++p) {
_encode(p->first, bl);
_encode_simple(p->first, bl);
_encode_complex(p->second, bl);
}
}
template<class T, class U>
inline void _decode_complex(std::map<T,U>& m, bufferlist& bl, int& off)
inline void _decode_complex(std::map<T,U>& m, bufferlist::iterator& p)
{
uint32_t n;
_decoderaw(n, bl, off);
_decode_raw(n, p);
m.clear();
while (n--) {
T k;
_decode(k, bl, off);
_decode_complex(m[k], bl, off);
_decode_simple(k, p);
_decode_complex(m[k], p);
}
}
@ -138,22 +390,22 @@ template<class T, class U>
inline void _encode_complex(const __gnu_cxx::hash_map<T,U>& m, bufferlist& bl)
{
uint32_t n = m.size();
_encoderaw(n, bl);
_encode_raw(n, bl);
for (typename __gnu_cxx::hash_map<T,U>::const_iterator p = m.begin(); p != m.end(); ++p) {
_encode(p->first, bl);
_encode_simple(p->first, bl);
_encode_complex(p->second, bl);
}
}
template<class T, class U>
inline void _decode_complex(__gnu_cxx::hash_map<T,U>& m, bufferlist& bl, int& off)
inline void _decode_complex(__gnu_cxx::hash_map<T,U>& m, bufferlist::iterator& p)
{
uint32_t n;
_decoderaw(n, bl, off);
_decode_raw(n, p);
m.clear();
while (n--) {
T k;
_decode(k, bl, off);
_decode_complex(m[k], bl, off);
_decode_simple(k, p);
_decode_complex(m[k], p);
}
}
@ -164,9 +416,9 @@ inline void _encode_complex(const T& t, bufferlist& bl)
t._encode(bl);
}
template<class T>
inline void _decode_complex(T& t, bufferlist& bl, int& off)
inline void _decode_complex(T& t, bufferlist::iterator& p)
{
t._decode(bl, off);
t._decode(p);
}
#endif

View File

@ -20,6 +20,7 @@
#include <list>
#include <iostream>
#include "buffer.h"
#include "encodable.h"
/*
*
@ -462,6 +463,9 @@ class fragtree_t {
void _decode(bufferlist& bl, int& off) {
::_decode(_splits, bl, off);
}
void _decode(bufferlist::iterator& p) {
::_decode_simple(_splits, p);
}
void print(std::ostream& out) {
out << "fragtree_t(";

View File

@ -1567,8 +1567,7 @@ void Server::handle_client_readdir(MDRequest *mdr)
}
// build dir contents
list<InodeStat*> inls;
list<string> dnls;
bufferlist dirbl;
int numfiles = 0;
for (CDir::map_t::iterator it = dir->begin();
@ -1601,29 +1600,14 @@ void Server::handle_client_readdir(MDRequest *mdr)
}
assert(in);
InodeStat *st;
if (in) {
dout(12) << "including inode " << *in << dendl;
assert(in);
// add this item
// note: InodeStat makes note of whether inode data is readable.
st = new InodeStat(in, mds->get_nodeid());
} else {
assert(0);
/*
assert(dn->is_remote());
dout(12) << "including inode-less (remote) dentry " << *dn << dendl;
st = new InodeStat;
st->mask = STAT_MASK_INO | STAT_MASK_TYPE;
memset(&st->inode, 0, sizeof(st->inode));
st->inode.ino = dn->get_remote_ino();
st->inode.mode = DT_TO_MODE(dn->get_remote_d_type());
*/
}
dnls.push_back( it->first );
inls.push_back(st);
numfiles++;
dout(12) << "including inode " << *in << dendl;
// add this dentry + inodeinfo
::_encode(it->first, dirbl);
InodeStat::_encode(dirbl, in, mds->get_nodeid());
// touch it
mdcache->lru.lru_touch(dn);
@ -1631,7 +1615,7 @@ void Server::handle_client_readdir(MDRequest *mdr)
// yay, reply
MClientReply *reply = new MClientReply(req);
reply->take_dir_items(dnls, inls, numfiles);
reply->take_dir_items(dirbl);
dout(10) << "reply to " << *req << " readdir " << numfiles << " files" << dendl;
reply->set_result(0);

View File

@ -357,6 +357,11 @@ public:
::_decode(dirfrag, bl, off);
::_decode(dname, bl, off);
}
void _decode(bufferlist::iterator& p) {
::_decode_simple(ino, p);
::_decode_simple(dirfrag, p);
::_decode_simple(dname, p);
}
};

View File

@ -17,7 +17,7 @@
#define __MCLIENTREPLY_H
#include "include/types.h"
#include "include/encodable.h"
#include "MClientRequest.h"
#include "msg/Message.h"
@ -64,23 +64,36 @@ class InodeStat {
public:
InodeStat() {}
InodeStat(CInode *in, int whoami) :
inode(in->inode),
mask(STAT_MASK_INO|STAT_MASK_TYPE|STAT_MASK_BASE)
{
InodeStat(bufferlist::iterator& p) {
_decode(p);
}
void _decode(bufferlist::iterator &p) {
::_decode_simple(mask, p);
::_decode_simple(inode, p);
::_decode_simple(dirfrag_auth, p);
::_decode_simple(dirfrag_dist, p);
::_decode_simple(dirfrag_rep, p);
::_decode_simple(symlink, p);
dirfragtree._decode(p);
}
static void _encode(bufferlist &bl, CInode *in, int whoami) {
int mask = STAT_MASK_INO|STAT_MASK_TYPE|STAT_MASK_BASE;
// mask
if (in->authlock.can_rdlock(0)) mask |= STAT_MASK_AUTH;
if (in->linklock.can_rdlock(0)) mask |= STAT_MASK_LINK;
if (in->filelock.can_rdlock(0)) mask |= STAT_MASK_FILE;
// symlink content?
if (in->is_symlink())
symlink = in->symlink;
// dirfragtree
dirfragtree = in->dirfragtree;
::_encode_simple(mask, bl);
::_encode_simple(in->inode, bl);
// dirfrag info
map<frag_t,int> dirfrag_auth;
map<frag_t,set<int> > dirfrag_dist;
set<frag_t> dirfrag_rep;
list<CDir*> ls;
in->get_dirfrags(ls);
for (list<CDir*>::iterator p = ls.begin();
@ -93,50 +106,38 @@ class InodeStat {
if (dir->is_rep())
dirfrag_rep.insert(dir->dirfrag().frag);
}
::_encode_simple(dirfrag_auth, bl);
::_encode_simple(dirfrag_dist, bl);
::_encode_simple(dirfrag_rep, bl);
::_encode_simple(in->symlink, bl);
in->dirfragtree._encode(bl);
}
void _encode(bufferlist &bl) {
::_encode(mask, bl);
::_encode(inode, bl);
::_encode(dirfrag_auth, bl);
::_encode(dirfrag_dist, bl);
::_encode(dirfrag_rep, bl);
::_encode(symlink, bl);
dirfragtree._encode(bl);
}
void _decode(bufferlist &bl, int& off) {
::_decode(mask, bl, off);
::_decode(inode, bl, off);
::_decode(dirfrag_auth, bl, off);
::_decode(dirfrag_dist, bl, off);
::_decode(dirfrag_rep, bl, off);
::_decode(symlink, bl, off);
dirfragtree._decode(bl, off);
}
};
class MClientReply : public Message {
// reply data
struct {
struct st_ {
long tid;
int op;
int result; // error code
unsigned char file_caps; // for open
long file_caps_seq;
uint64_t file_data_version; // for client buffercache consistency
int _num_trace_in;
int _dir_size;
} st;
string path;
list<InodeStat*> trace_in;
list<string> trace_dn;
bufferlist trace_bl;
list<string> dir_dn;
list<InodeStat*> dir_in;
list<string> dir_dn;
bufferlist dir_bl;
public:
long get_tid() { return st.tid; }
@ -148,12 +149,6 @@ class MClientReply : public Message {
inodeno_t get_ino() { return trace_in.back()->inode.ino; }
const inode_t& get_inode() { return trace_in.back()->inode; }
const list<InodeStat*>& get_trace_in() { return trace_in; }
const list<string>& get_trace_dn() { return trace_dn; }
const list<InodeStat*>& get_dir_in() { return dir_in; }
const list<string>& get_dir_dn() { return dir_dn; }
unsigned char get_file_caps() { return st.file_caps; }
long get_file_caps_seq() { return st.file_caps_seq; }
uint64_t get_file_data_version() { return st.file_data_version; }
@ -172,9 +167,6 @@ class MClientReply : public Message {
this->path = req->get_path();
this->st.result = result;
st._dir_size = 0;
st._num_trace_in = 0;
}
virtual ~MClientReply() {
list<InodeStat*>::iterator it;
@ -195,100 +187,76 @@ class MClientReply : public Message {
// serialization
virtual void decode_payload() {
int off = 0;
payload.copy(off, sizeof(st), (char*)&st);
off += sizeof(st);
_decode(path, payload, off);
for (int i=0; i<st._num_trace_in; ++i) {
if (i) {
string ref_dn;
::_decode(ref_dn, payload, off);
trace_dn.push_back(ref_dn);
}
InodeStat *ci = new InodeStat;
ci->_decode(payload, off);
trace_in.push_back(ci);
}
// dir contents
::_decode(dir_dn, payload, off);
for (int i=0; i<st._dir_size; ++i) {
InodeStat *ci = new InodeStat;
ci->_decode(payload, off);
dir_in.push_back(ci);
}
bufferlist::iterator p = payload.begin();
::_decode_simple(st, p);
::_decode_simple(path, p);
::_decode_simple(trace_bl, p);
::_decode_simple(dir_bl, p);
assert(p.end());
}
virtual void encode_payload() {
payload.append((char*)&st, sizeof(st));
_encode(path, payload);
// trace
list<string>::iterator pdn = trace_dn.begin();
list<InodeStat*>::iterator pin;
for (pin = trace_in.begin();
pin != trace_in.end();
++pin) {
if (pin != trace_in.begin()) {
::_encode(*pdn, payload);
++pdn;
}
(*pin)->_encode(payload);
}
// dir contents
::_encode(dir_dn, payload);
for (pin = dir_in.begin();
pin != dir_in.end();
++pin)
(*pin)->_encode(payload);
::_encode_simple(st, payload);
::_encode_simple(path, payload);
::_encode_simple(trace_bl, payload);
::_encode_simple(dir_bl, payload);
}
// builders
/*
void add_dir_item(string& dn, InodeStat *in) {
dir_dn.push_back(dn);
dir_in.push_back(in);
++st._dir_size;
}*/
void take_dir_items(list<string>& dnls,
list<InodeStat*>& inls,
int num) {
dir_dn.swap(dnls);
dir_in.swap(inls);
st._dir_size = num;
// dir contents
void take_dir_items(bufferlist& bl) {
dir_bl.claim(bl);
}
/*
void copy_dir_items(const list<InodeStat*>& inls,
const list<string>& dnls) {
list<string>::const_iterator pdn = dnls.begin();
list<InodeStat*>::const_iterator pin = inls.begin();
while (pin != inls.end()) {
// copy!
InodeStat *i = new InodeStat;
*i = **pin;
dir_in.push_back(i);
dir_dn.push_back(*pdn);
++pin;
++pdn;
++st._dir_size;
void _decode_dir() {
bufferlist::iterator p = dir_bl.begin();
while (!p.end()) {
string dn;
::_decode_simple(dn, p);
dir_dn.push_back(dn);
dir_in.push_back(new InodeStat(p));
}
}
*/
const list<InodeStat*>& get_dir_in() {
if (dir_in.empty() && dir_bl.length()) _decode_dir();
return dir_in;
}
const list<string>& get_dir_dn() {
if (dir_dn.empty() && dir_bl.length()) _decode_dir();
return dir_dn;
}
// trace
void set_trace_dist(CInode *in, int whoami) {
st._num_trace_in = 0;
// inode, dentry, ..., inode
while (in) {
// add this inode to trace, along with referring dentry name
InodeStat::_encode(trace_bl, in, whoami);
if (in->get_parent_dn())
trace_dn.push_front(in->get_parent_dn()->get_name());
trace_in.push_front(new InodeStat(in, whoami));
++st._num_trace_in;
::_encode_simple(in->get_parent_dn()->get_name(), trace_bl);
in = in->get_parent_inode();
}
}
void _decode_trace() {
bufferlist::iterator p = trace_bl.begin();
while (!p.end()) {
trace_in.push_front(new InodeStat(p));
if (!p.end()) {
string ref_dn;
::_decode_simple(ref_dn, p);
trace_dn.push_front(ref_dn);
}
}
}
const list<InodeStat*>& get_trace_in() {
if (trace_in.empty() && trace_bl.length()) _decode_trace();
return trace_in;
}
const list<string>& get_trace_dn() {
if (trace_in.empty() && trace_bl.length()) _decode_trace();
return trace_dn;
}
};

View File

@ -64,10 +64,10 @@ class MMDSCacheRejoin : public Message {
inode_full(const inode_t& i, const string& s, const fragtree_t& f) :
inode(i), symlink(s), dirfragtree(f) {}
void _decode(bufferlist& bl, int& off) {
::_decode(inode, bl, off);
::_decode(symlink, bl, off);
::_decode(dirfragtree, bl, off);
void _decode(bufferlist::iterator& p) {
::_decode_simple(inode, p);
::_decode_simple(symlink, p);
::_decode_simple(dirfragtree, p);
}
void _encode(bufferlist& bl) const {
::_encode(inode, bl);
@ -205,24 +205,24 @@ class MMDSCacheRejoin : public Message {
::_encode(xlocked_dentries, payload);
}
void decode_payload() {
int off = 0;
::_decode(op, payload, off);
::_decode(strong_inodes, payload, off);
::_decode_complex(full_inodes, payload, off);
::_decode(authpinned_inodes, payload, off);
::_decode(xlocked_inodes, payload, off);
::_decode(cap_export_bl, payload, off);
bufferlist::iterator p = payload.begin();
::_decode_simple(op, p);
::_decode_simple(strong_inodes, p);
::_decode_complex(full_inodes, p);
::_decode_simple(authpinned_inodes, p);
::_decode_simple(xlocked_inodes, p);
::_decode_simple(cap_export_bl, p);
if (cap_export_bl.length()) {
int off = 0;
::_decode(cap_exports, cap_export_bl, off);
::_decode(cap_export_paths, cap_export_bl, off);
bufferlist::iterator q = cap_export_bl.begin();
::_decode_simple(cap_exports, q);
::_decode_simple(cap_export_paths, q);
}
::_decode(strong_dirfrags, payload, off);
::_decode(weak, payload, off);
::_decode(weak_inodes, payload, off);
::_decode(strong_dentries, payload, off);
::_decode(authpinned_dentries, payload, off);
::_decode(xlocked_dentries, payload, off);
::_decode_simple(strong_dirfrags, p);
::_decode_simple(weak, p);
::_decode_simple(weak_inodes, p);
::_decode_simple(strong_dentries, p);
::_decode_simple(authpinned_dentries, p);
::_decode_simple(xlocked_dentries, p);
}
};

View File

@ -123,19 +123,19 @@ public:
::_encode(stray, payload);
}
void decode_payload() {
int off = 0;
::_decode(reqid, payload, off);
::_decode(op, payload, off);
::_decode(lock_type, payload, off);
object_info._decode(payload, off);
::_decode_complex(authpins, payload, off);
::_decode(srcdnpath, payload, off);
::_decode(destdnpath, payload, off);
::_decode(srcdn_replicas, payload, off);
::_decode(now, payload, off);
::_decode(inode_export, payload, off);
::_decode(inode_export_v, payload, off);
::_decode(stray, payload, off);
bufferlist::iterator p = payload.begin();
::_decode_simple(reqid, p);
::_decode_simple(op, p);
::_decode_simple(lock_type, p);
object_info._decode(p);
::_decode_complex(authpins, p);
::_decode_simple(srcdnpath, p);
::_decode_simple(destdnpath, p);
::_decode_simple(srcdn_replicas, p);
::_decode_simple(now, p);
::_decode_simple(inode_export, p);
::_decode_simple(inode_export_v, p);
::_decode_simple(stray, p);
}
char *get_type_name() { return "slave_request"; }