// be careful with size, mtime, atime
if (issued & (CEPH_CAP_WR|CEPH_CAP_WRBUFFER)) {
if ((issued & CEPH_CAP_EXCL) == 0) {
- if (st->size > in->inode.size)
+ if ((uint64_t)st->size > in->inode.size)
in->inode.size = st->size;
if (st->mtime > in->inode.mtime)
in->inode.mtime = st->mtime;
{
MClientRequest *req = new MClientRequest(CEPH_MDS_OP_MKDIR, messenger->get_myinst());
req->set_filepath(path);
- req->head.args.mkdir.mode = mode;
+ req->head.args.mkdir.mode = cpu_to_le32(mode);
MClientReply *reply = make_request(req, uid, gid);
int res = reply->get_result();
*in = dn->inode;
} else {
req = new MClientRequest(CEPH_MDS_OP_LSTAT, messenger->get_myinst());
- req->head.args.stat.mask = mask;
+ req->head.args.stat.mask = cpu_to_le32(mask);
req->set_filepath(path);
MClientReply *reply = make_request(req, uid, gid, in, 0);
MClientRequest *req = new MClientRequest(symop(CEPH_MDS_OP_CHMOD, followsym),
messenger->get_myinst());
req->set_filepath(path);
- req->head.args.chmod.mode = mode;
+ req->head.args.chmod.mode = cpu_to_le32(mode);
MClientReply *reply = make_request(req, uid, gid);
int res = reply->get_result();
MClientRequest *req = new MClientRequest(symop(CEPH_MDS_OP_CHOWN, followsym),
messenger->get_myinst());
req->set_filepath(path);
- req->head.args.chown.uid = uid;
- req->head.args.chown.gid = gid;
+ req->head.args.chown.uid = cpu_to_le32(uid);
+ req->head.args.chown.gid = cpu_to_le32(gid);
MClientReply *reply = make_request(req, cuid, cgid);
int res = reply->get_result();
req->set_filepath(path);
mtime.encode_timeval(&req->head.args.utime.mtime);
atime.encode_timeval(&req->head.args.utime.atime);
- req->head.args.utime.mask = CEPH_UTIME_ATIME | CEPH_UTIME_MTIME;
+ req->head.args.utime.mask = cpu_to_le32(CEPH_UTIME_ATIME | CEPH_UTIME_MTIME);
MClientReply *reply = make_request(req, uid, gid);
int res = reply->get_result();
MClientRequest *req = new MClientRequest(CEPH_MDS_OP_MKNOD, messenger->get_myinst());
req->set_filepath(path);
- req->head.args.mknod.mode = mode;
- req->head.args.mknod.rdev = rdev;
+ req->head.args.mknod.mode = cpu_to_le32(mode);
+ req->head.args.mknod.rdev = cpu_to_le32(rdev);
MClientReply *reply = make_request(req, uid, gid);
int res = reply->get_result();
// go
MClientRequest *req = new MClientRequest(CEPH_MDS_OP_OPEN, messenger->get_myinst());
req->set_filepath(path);
- req->head.args.open.flags = flags;
- req->head.args.open.mode = mode;
+ req->head.args.open.flags = cpu_to_le32(flags);
+ req->head.args.open.mode = cpu_to_le32(mode);
int cmode = ceph_flags_to_mode(flags);
return r;
}
-int Client::_read(Fh *f, off_t offset, off_t size, bufferlist *bl)
+int Client::_read(Fh *f, __s64 offset, __u64 size, bufferlist *bl)
{
Inode *in = f->inode;
}
dout(10) << "file size: " << in->inode.size << dendl;
- if (offset > 0 && offset >= in->inode.size) {
+ if (offset > 0 && (__u64)offset >= in->inode.size) {
if (movepos) unlock_fh_pos(f);
return 0;
}
- if (offset + size > (off_t)in->inode.size)
- size = (off_t)in->inode.size - offset;
+ if ((__u64)(offset + size) > in->inode.size)
+ size = in->inode.size - offset;
if (size == 0) {
dout(10) << "read is size=0, returning 0" << dendl;
}
-int Client::_write(Fh *f, off_t offset, off_t size, const char *buf)
+int Client::_write(Fh *f, __s64 offset, __u64 size, const char *buf)
{
//dout(7) << "write fh " << fh << " size " << size << " offset " << offset << dendl;
Inode *in = f->inode;
}
// assume success for now. FIXME.
- off_t totalwritten = size;
+ __u64 totalwritten = size;
// extend file?
if (totalwritten + offset > in->inode.size) {
return _truncate(path, length, true);
}
-int Client::_truncate(const filepath &path, off_t length, bool followsym, int uid, int gid)
+int Client::_truncate(const filepath &path, loff_t length, bool followsym, int uid, int gid)
{
MClientRequest *req = new MClientRequest(symop(CEPH_MDS_OP_TRUNCATE, followsym),
messenger->get_myinst());
req->set_filepath(path);
- req->head.args.truncate.length = length;
+ req->head.args.truncate.length = cpu_to_le64(length);
MClientReply *reply = make_request(req, uid, gid);
int res = reply->get_result();
int _mknod(const filepath &path, mode_t mode, dev_t rdev, int uid=-1, int gid=-1);
int _open(const filepath &path, int flags, mode_t mode, Fh **fhp, int uid=-1, int gid=-1);
int _release(Fh *fh);
- int _read(Fh *fh, off_t offset, off_t size, bufferlist *bl);
- int _write(Fh *fh, off_t offset, off_t size, const char *buf);
+ int _read(Fh *fh, __s64 offset, __u64 size, bufferlist *bl);
+ int _write(Fh *fh, __s64 offset, __u64 size, const char *buf);
int _flush(Fh *fh);
- int _truncate(const filepath &path, off_t length, bool followsym, int uid=-1, int gid=-1);
- int _ftruncate(Fh *fh, off_t length);
+ int _truncate(const filepath &path, loff_t length, bool followsym, int uid=-1, int gid=-1);
+ int _ftruncate(Fh *fh, loff_t length);
int _fsync(Fh *fh, bool syncdataonly);
int _statfs(struct statvfs *stbuf);
/*
* types in this file are defined as little-endian, and are
* primarily intended to describe data structures that pass
- * over the wire or are stored on disk.
+ * over the wire or that are stored on disk.
*/
struct ceph_mds_request_head {
struct ceph_entity_inst client_inst;
ceph_tid_t tid, oldest_client_tid;
- __u64 mdsmap_epoch; /* on client */
- __u32 num_fwd;
- __u32 retry_attempt;
+ ceph_epoch_t mdsmap_epoch; /* on client */
+ __le32 num_fwd;
+ __le32 retry_attempt;
ceph_ino_t mds_wants_replica_in_dirino;
- __u32 op;
- __u32 caller_uid, caller_gid;
+ __le32 op;
+ __le32 caller_uid, caller_gid;
union {
struct {
- __u32 mask;
+ __le32 mask;
} stat;
struct {
- __u32 mask;
+ __le32 mask;
} fstat;
struct {
ceph_frag_t frag;
struct ceph_timespec mtime;
struct ceph_timespec atime;
struct ceph_timespec ctime;
- __u32 mask;
+ __le32 mask;
} __attribute__ ((packed)) utime;
struct {
- __u32 mode;
+ __le32 mode;
} chmod;
struct {
- __s32 uid;
- __s32 gid;
+ __le32 uid;
+ __le32 gid;
} chown;
struct {
- __u32 mode;
- __u32 rdev;
+ __le32 mode;
+ __le32 rdev;
} mknod;
struct {
- __u32 mode;
+ __le32 mode;
} mkdir;
struct {
- __u32 flags;
- __u32 mode;
+ __le32 flags;
+ __le32 mode;
} open;
struct {
- __s64 length;
+ __le64 length;
} truncate;
} __attribute__ ((packed)) args;
} __attribute__ ((packed));
/* client reply */
struct ceph_mds_reply_head {
ceph_tid_t tid;
- __u32 op;
- __s32 result;
- __u32 file_caps;
- __u32 file_caps_seq;
- __u64 mdsmap_epoch;
+ __le32 op;
+ __le32 result;
+ __le32 file_caps;
+ __le32 file_caps_seq;
+ __le32 mdsmap_epoch;
} __attribute__ ((packed));
struct ceph_frag_tree_head {
return (mode & CEPH_FILE_MODE_WR) == 0;
}
-
inline int DT_TO_MODE(int dt) {
return dt << 12;
}
return mode >> 12;
}
+struct FileLayout {
+ /* file -> object mapping */
+ __u32 fl_stripe_unit; /* stripe unit, in bytes. must be multiple of page size. */
+ __u32 fl_stripe_count; /* over this many objects */
+ __u32 fl_object_size; /* until objects are this big, then move to new objects */
+ __u32 fl_cas_hash; /* 0 = none; 1 = sha256 */
+
+ /* pg -> disk layout */
+ __u32 fl_object_stripe_unit; /* for per-object parity, if any */
+
+ /* object -> pg layout */
+ __s32 fl_pg_preferred; /* preferred primary for pg, if any (-1 = none) */
+ __u8 fl_pg_type; /* pg type; see PG_TYPE_* */
+ __u8 fl_pg_size; /* pg size (num replicas, raid stripe width, etc. */
+ __u8 fl_pg_pool; /* implies crush ruleset AND object namespace */
+};
+
struct inode_t {
// base (immutable)
inodeno_t ino;
bool anchored; // auth only?
// file (data access)
- int64_t size;
- int64_t max_size; // client(s) are auth to write this much...
+ uint64_t size;
+ uint64_t max_size; // client(s) are auth to write this much...
utime_t mtime; // file data modify time.
utime_t atime; // file data access time.
utime_t rmtime; // recursive mtime?
}
inode_t *latest = in->get_projected_inode();
- int64_t new_max;
+ uint64_t new_max;
if (!in->is_any_caps())
new_max = 0;
else if ((latest->size << 1) >= latest->max_size)
utime_t atime = m->get_atime();
utime_t mtime = m->get_mtime();
utime_t ctime = m->get_ctime();
- off_t size = m->get_size();
+ uint64_t size = m->get_size();
// atime|mtime|size?
bool had_or_has_wr = (had|has) & CEPH_CAP_WR;
// increase or zero max_size?
bool change_max = false;
- int64_t new_max = latest->max_size;
+ uint64_t new_max = latest->max_size;
if (in->is_auth()) {
if (latest->max_size && (wanted & (CEPH_CAP_WR|CEPH_CAP_WRBUFFER)) == 0) {
// funky.
case CEPH_MDS_OP_OPEN:
- if ((req->head.args.open.flags & O_CREAT) == 0) {
+ if ((le32_to_cpu(req->head.args.open.flags) & O_CREAT) == 0) {
handle_client_open(mdr);
break;
}
set<SimpleLock*> wrlocks = mdr->wrlocks;
set<SimpleLock*> xlocks = mdr->xlocks;
- int mask = req->head.args.stat.mask;
+ int mask = le32_to_cpu(req->head.args.stat.mask);
if (mask & CEPH_LOCK_ILINK) rdlocks.insert(&ref->linklock);
if (mask & CEPH_LOCK_IAUTH) rdlocks.insert(&ref->authlock);
if (ref->is_file() &&
// project update
inode_t *pi = cur->project_inode();
- mask = req->head.args.utime.mask;
+ mask = le32_to_cpu(req->head.args.utime.mask);
if (mask & CEPH_UTIME_MTIME)
pi->mtime = req->head.args.utime.mtime;
inode_t *pi = cur->project_inode();
pi->mode =
(pi->mode & ~07777) |
- (req->head.args.chmod.mode & 07777);
+ (le32_to_cpu(req->head.args.chmod.mode) & 07777);
pi->version = cur->pre_dirty();
pi->ctime = g_clock.real_now();
- dout(10) << "chmod " << oct << pi->mode << " (" << req->head.args.chmod.mode << ")" << dec << *cur << dendl;
+ dout(10) << "chmod " << oct << pi->mode << " (" << le32_to_cpu(req->head.args.chmod.mode) << ")" << dec << *cur << dendl;
// log + wait
mdr->ls = mdlog->get_current_segment();
// project update
inode_t *pi = cur->project_inode();
- if (req->head.args.chown.uid != -1)
- pi->uid = req->head.args.chown.uid;
- if (req->head.args.chown.gid != -1)
- pi->gid = req->head.args.chown.gid;
+ if ((__s32)le32_to_cpu(req->head.args.chown.uid) != -1)
+ pi->uid = le32_to_cpu(req->head.args.chown.uid);
+ if ((__s32)le32_to_cpu(req->head.args.chown.gid) != -1)
+ pi->gid = le32_to_cpu(req->head.args.chown.gid);
pi->version = cur->pre_dirty();
pi->ctime = g_clock.real_now();
CInode *newi = prepare_new_inode(mdr, dn->dir);
assert(newi);
- newi->inode.rdev = req->head.args.mknod.rdev;
- newi->inode.mode = req->head.args.mknod.mode;
+ newi->inode.rdev = le32_to_cpu(req->head.args.mknod.rdev);
+ newi->inode.mode = le32_to_cpu(req->head.args.mknod.mode);
if ((newi->inode.mode & S_IFMT) == 0)
newi->inode.mode |= S_IFREG;
newi->inode.version = dn->pre_dirty() - 1;
assert(newi);
// it's a directory.
- newi->inode.mode = req->head.args.mkdir.mode;
+ newi->inode.mode = le32_to_cpu(req->head.args.mkdir.mode);
newi->inode.mode &= ~S_IFMT;
newi->inode.mode |= S_IFDIR;
newi->inode.layout = g_default_mds_dir_layout;
MDRequest *mdr;
CInode *in;
version_t pv;
- off_t size;
+ uint64_t size;
utime_t ctime;
public:
- C_MDS_truncate_logged(MDS *m, MDRequest *r, CInode *i, version_t pdv, off_t sz, utime_t ct) :
+ C_MDS_truncate_logged(MDS *m, MDRequest *r, CInode *i, version_t pdv, uint64_t sz, utime_t ct) :
mds(m), mdr(r), in(i),
pv(pdv),
size(sz), ctime(ct) { }
{
MClientRequest *req = mdr->client_request;
- if ((__u64)req->head.args.truncate.length > CEPH_FILE_MAX_SIZE) {
+ if (le64_to_cpu(req->head.args.truncate.length) > (__u64)CEPH_FILE_MAX_SIZE) {
reply_request(mdr, -EFBIG);
return;
}
return;
// already the correct size?
- if (cur->inode.size == req->head.args.truncate.length) {
+ if (cur->inode.size == le64_to_cpu(req->head.args.truncate.length)) {
reply_request(mdr, 0);
return;
}
version_t pdv = cur->pre_dirty();
utime_t ctime = g_clock.real_now();
Context *fin = new C_MDS_truncate_logged(mds, mdr, cur,
- pdv, req->head.args.truncate.length, ctime);
+ pdv, le64_to_cpu(req->head.args.truncate.length), ctime);
// log + wait
mdr->ls = mdlog->get_current_segment();
EUpdate *le = new EUpdate(mdlog, "truncate");
le->metablob.add_client_req(mdr->reqid);
le->metablob.add_dir_context(cur->get_parent_dir());
- le->metablob.add_inode_truncate(cur->ino(), req->head.args.truncate.length, cur->inode.size);
+ le->metablob.add_inode_truncate(cur->ino(), le64_to_cpu(req->head.args.truncate.length), cur->inode.size);
inode_t *pi = cur->project_inode();
pi->mtime = ctime;
pi->ctime = ctime;
pi->version = pdv;
- pi->size = req->head.args.truncate.length;
+ pi->size = le64_to_cpu(req->head.args.truncate.length);
le->metablob.add_primary_dentry(cur->parent, true, 0, pi);
mdlog->submit_entry(le, fin);
{
MClientRequest *req = mdr->client_request;
- int flags = req->head.args.open.flags;
- int cmode = ceph_flags_to_mode(req->head.args.open.flags);
+ int flags = le32_to_cpu(req->head.args.open.flags);
+ int cmode = ceph_flags_to_mode(le32_to_cpu(req->head.args.open.flags));
bool need_auth = !file_mode_is_readonly(cmode) || (flags & O_TRUNC);
reply_request(mdr, -EINVAL); // FIXME what error do we want?
return;
}
- if ((req->head.args.open.flags & O_DIRECTORY) && !cur->inode.is_dir()) {
+ if ((le32_to_cpu(req->head.args.open.flags) & O_DIRECTORY) && !cur->inode.is_dir()) {
dout(7) << "specified O_DIRECTORY on non-directory " << *cur << dendl;
reply_request(mdr, -EINVAL);
return;
void Server::_do_open(MDRequest *mdr, CInode *cur)
{
MClientRequest *req = mdr->client_request;
- int cmode = ceph_flags_to_mode(req->head.args.open.flags);
+ int cmode = ceph_flags_to_mode(le32_to_cpu(req->head.args.open.flags));
if (cur->inode.is_dir()) cmode = CEPH_FILE_MODE_PIN;
// register new cap
dout(7) << "open w/ O_CREAT on " << req->get_filepath() << dendl;
- bool excl = (req->head.args.open.flags & O_EXCL);
+ bool excl = (le32_to_cpu(req->head.args.open.flags) & O_EXCL);
CDentry *dn = rdlock_path_xlock_dentry(mdr, !excl, false);
if (!dn) return;
if (!dn->is_null()) {
// it existed.
- if (req->head.args.open.flags & O_EXCL) {
+ if (le32_to_cpu(req->head.args.open.flags) & O_EXCL) {
dout(10) << "O_EXCL, target exists, failing with -EEXIST" << dendl;
reply_request(mdr, -EEXIST, dn->get_inode(), dn);
return;
assert(in);
// it's a file.
- in->inode.mode = req->head.args.open.mode;
+ in->inode.mode = le32_to_cpu(req->head.args.open.mode);
in->inode.mode |= S_IFREG;
in->inode.version = dn->pre_dirty() - 1;
in->inode.max_size = in->get_layout_size_increment();
version_t alloc_tablev;
// inodes i've destroyed.
- list< triple<inodeno_t,off_t,off_t> > truncated_inodes;
+ list< triple<inodeno_t,uint64_t,uint64_t> > truncated_inodes;
// idempotent op(s)
list<metareqid_t> client_reqs;
alloc_tablev = tablev;
}
- void add_inode_truncate(inodeno_t ino, off_t newsize, off_t oldsize) {
- truncated_inodes.push_back(triple<inodeno_t,off_t,off_t>(ino, newsize, oldsize));
+ void add_inode_truncate(inodeno_t ino, uint64_t newsize, uint64_t oldsize) {
+ truncated_inodes.push_back(triple<inodeno_t,uint64_t,uint64_t>(ino, newsize, oldsize));
}
void add_null_dentry(CDentry *dn, bool dirty) {
}
// truncated inodes
- for (list< triple<inodeno_t,off_t,off_t> >::iterator p = truncated_inodes.begin();
+ for (list< triple<inodeno_t,uint64_t,uint64_t> >::iterator p = truncated_inodes.begin();
p != truncated_inodes.end();
++p) {
CInode *in = mds->mdcache->get_inode(p->first);
struct inode_caps_reconnect_t {
int32_t wanted;
int32_t issued;
- off_t size;
+ uint64_t size;
utime_t mtime, atime;
inode_caps_reconnect_t() {}
inode_caps_reconnect_t(int w, int i) :
wanted(w), issued(i), size(0) {}
- inode_caps_reconnect_t(int w, int i, off_t sz, utime_t mt, utime_t at) :
+ inode_caps_reconnect_t(int w, int i, uint64_t sz, utime_t mt, utime_t at) :
wanted(w), issued(i), size(sz), mtime(mt), atime(at) {}
};
capseq_t get_seq() { return le32_to_cpu(h.seq); }
inodeno_t get_ino() { return le64_to_cpu(h.ino); }
- __s64 get_size() { return le64_to_cpu(h.size); }
- __s64 get_max_size() { return le64_to_cpu(h.max_size); }
+ __u64 get_size() { return le64_to_cpu(h.size); }
+ __u64 get_max_size() { return le64_to_cpu(h.max_size); }
utime_t get_ctime() { return utime_t(h.ctime); }
utime_t get_mtime() { return utime_t(h.mtime); }
utime_t get_atime() { return utime_t(h.atime); }
public:
long get_tid() { return le64_to_cpu(st.tid); }
- int get_op() { return st.op; }
+ int get_op() { return le32_to_cpu(st.op); }
- void set_mdsmap_epoch(epoch_t e) { st.mdsmap_epoch = e; }
- epoch_t get_mdsmap_epoch() { return st.mdsmap_epoch; }
+ void set_mdsmap_epoch(epoch_t e) { st.mdsmap_epoch = cpu_to_le32(e); }
+ epoch_t get_mdsmap_epoch() { return le32_to_cpu(st.mdsmap_epoch); }
- int get_result() { return st.result; }
+ int get_result() { return (__s32)(le32_to_cpu(st.result)); }
- unsigned char get_file_caps() { return st.file_caps; }
- long get_file_caps_seq() { return st.file_caps_seq; }
+ unsigned get_file_caps() { return le32_to_cpu(st.file_caps); }
+ unsigned get_file_caps_seq() { return le32_to_cpu(st.file_caps_seq); }
//uint64_t get_file_data_version() { return st.file_data_version; }
- void set_result(int r) { st.result = r; }
- void set_file_caps(unsigned char c) { st.file_caps = c; }
- void set_file_caps_seq(long s) { st.file_caps_seq = s; }
+ void set_result(int r) { st.result = cpu_to_le32(r); }
+ void set_file_caps(unsigned char c) { st.file_caps = cpu_to_le32(c); }
+ void set_file_caps_seq(long s) { st.file_caps_seq = cpu_to_le32(s); }
//void set_file_data_version(uint64_t v) { st.file_data_version = v; }
MClientReply() {}
Message(CEPH_MSG_CLIENT_REPLY) {
memset(&st, 0, sizeof(st));
this->st.tid = cpu_to_le64(req->get_tid());
- this->st.op = req->get_op();
- this->st.result = result;
+ this->st.op = cpu_to_le32(req->get_op());
+ this->st.result = cpu_to_le32(result);
}
const char *get_type_name() { return "creply"; }
void print(ostream& o) {
o << "client_reply(" << env.dst.name << "." << le64_to_cpu(st.tid);
- o << " = " << st.result;
- if (st.result <= 0)
- o << " " << strerror(-st.result);
+ o << " = " << get_result();
+ if (get_result() <= 0)
+ o << " " << strerror(-get_result());
o << ")";
}
MClientRequest() : Message(CEPH_MSG_CLIENT_REQUEST) {}
MClientRequest(int op, entity_inst_t ci) : Message(CEPH_MSG_CLIENT_REQUEST) {
memset(&head, 0, sizeof(head));
- this->head.op = op;
+ this->head.op = cpu_to_le32(op);
this->head.client_inst.name = ci.name;
this->head.client_inst.addr = ci.addr;
}
- void set_mdsmap_epoch(epoch_t e) { head.mdsmap_epoch = e; }
- epoch_t get_mdsmap_epoch() { return head.mdsmap_epoch; }
+ void set_mdsmap_epoch(epoch_t e) { head.mdsmap_epoch = cpu_to_le32(e); }
+ epoch_t get_mdsmap_epoch() { return le32_to_cpu(head.mdsmap_epoch); }
metareqid_t get_reqid() {
// FIXME: for now, assume clients always have 1 incarnation
}
bool open_file_mode_is_readonly() {
- return file_mode_is_readonly(ceph_flags_to_mode(head.args.open.flags));
+ return file_mode_is_readonly(ceph_flags_to_mode(le32_to_cpu(head.args.open.flags)));
}
bool is_idempotent() {
- if (head.op == CEPH_MDS_OP_OPEN)
+ if (le32_to_cpu(head.op) == CEPH_MDS_OP_OPEN)
return open_file_mode_is_readonly();
- return (head.op & CEPH_MDS_OP_WRITE) == 0;
+ return (le32_to_cpu(head.op) & CEPH_MDS_OP_WRITE) == 0;
}
bool auth_is_best() {
if (!is_idempotent()) return true;
- if (head.op == CEPH_MDS_OP_READDIR) return true;
+ if (le32_to_cpu(head.op) == CEPH_MDS_OP_READDIR) return true;
return false;
}
bool follow_trailing_symlink() {
- return head.op & CEPH_MDS_OP_FOLLOW_LINK;
+ return le32_to_cpu(head.op) & CEPH_MDS_OP_FOLLOW_LINK;
}
// normal fields
void set_tid(tid_t t) { head.tid = cpu_to_le64(t); }
void set_oldest_client_tid(tid_t t) { head.oldest_client_tid = cpu_to_le64(t); }
- void inc_num_fwd() { head.num_fwd++; }
- void set_retry_attempt(int a) { head.retry_attempt = a; }
+ void inc_num_fwd() { head.num_fwd = cpu_to_le32(le32_to_cpu(head.num_fwd) + 1 ); }
+ void set_retry_attempt(int a) { head.retry_attempt = cpu_to_le32(a); }
void set_path(string& p) { path.set_path(p); }
void set_path(const char *p) { path.set_path(p); }
void set_filepath(const filepath& fp) { path = fp; }
void set_path2(string& p) { path2.set_path(p); }
void set_path2(const char *p) { path2.set_path(p); }
void set_filepath2(const filepath& fp) { path2 = fp; }
- void set_caller_uid(int u) { head.caller_uid = u; }
- void set_caller_gid(int g) { head.caller_gid = g; }
+ void set_caller_uid(unsigned u) { head.caller_uid = cpu_to_le32(u); }
+ void set_caller_gid(unsigned g) { head.caller_gid = cpu_to_le32(g); }
void set_mds_wants_replica_in_dirino(inodeno_t dirino) {
head.mds_wants_replica_in_dirino = cpu_to_le64(dirino); }
entity_name_t get_client() { return head.client_inst.name; }
tid_t get_tid() { return le64_to_cpu(head.tid); }
tid_t get_oldest_client_tid() { return le64_to_cpu(head.oldest_client_tid); }
- int get_num_fwd() { return head.num_fwd; }
- int get_retry_attempt() { return head.retry_attempt; }
- int get_op() { return head.op; }
- int get_caller_uid() { return head.caller_uid; }
- int get_caller_gid() { return head.caller_gid; }
+ int get_num_fwd() { return le32_to_cpu(head.num_fwd); }
+ int get_retry_attempt() { return le32_to_cpu(head.retry_attempt); }
+ int get_op() { return le32_to_cpu(head.op); }
+ unsigned get_caller_uid() { return le32_to_cpu(head.caller_uid); }
+ unsigned get_caller_gid() { return le32_to_cpu(head.caller_gid); }
const string& get_path() { return path.get_path(); }
filepath& get_filepath() { return path; }
out << " " << get_filepath();
if (!get_filepath2().empty())
out << " " << get_filepath2();
- if (head.retry_attempt)
- out << " RETRY=" << head.retry_attempt;
+ if (le32_to_cpu(head.retry_attempt))
+ out << " RETRY=" << le32_to_cpu(head.retry_attempt);
out << ")";
}