]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
type hell
authorSage Weil <sage@newdream.net>
Wed, 30 Apr 2008 14:06:16 +0000 (07:06 -0700)
committerSage Weil <sage@newdream.net>
Wed, 30 Apr 2008 14:06:16 +0000 (07:06 -0700)
12 files changed:
src/client/Client.cc
src/client/Client.h
src/include/ceph_fs.h
src/include/types.h
src/mds/Locker.cc
src/mds/Server.cc
src/mds/events/EMetaBlob.h
src/mds/journal.cc
src/mds/mdstypes.h
src/messages/MClientFileCaps.h
src/messages/MClientReply.h
src/messages/MClientRequest.h

index bca6dbf706e7346ee66af9d4509928cd927322f7..84106432d9028d3111007bb3471a175631141fcf 100644 (file)
@@ -338,7 +338,7 @@ void Client::update_inode(Inode *in, InodeStat *st, LeaseStat *lease, utime_t fr
     // 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;
@@ -1960,7 +1960,7 @@ int Client::_mkdir(const filepath &path, mode_t mode, int uid, int gid)
 {
   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();
@@ -2089,7 +2089,7 @@ int Client::_do_lstat(const filepath &path, int mask, Inode **in, int uid, int g
     *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);
@@ -2212,7 +2212,7 @@ int Client::_chmod(const filepath &path, mode_t mode, bool followsym, int uid, i
   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();
@@ -2240,8 +2240,8 @@ int Client::_chown(const filepath &path, uid_t uid, gid_t gid, bool followsym, i
   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();
@@ -2284,7 +2284,7 @@ int Client::_utimes(const filepath &path, utime_t mtime, utime_t atime, bool fol
   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();
@@ -2314,8 +2314,8 @@ int Client::_mknod(const filepath &path, mode_t mode, dev_t rdev, int uid, int g
 
   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();
@@ -2680,8 +2680,8 @@ int Client::_open(const filepath &path, int flags, mode_t mode, Fh **fhp, int ui
   // 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);
 
@@ -2956,7 +2956,7 @@ int Client::read(int fd, char *buf, off_t size, off_t offset)
   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;
 
@@ -3001,12 +3001,12 @@ int Client::_read(Fh *f, off_t offset, off_t size, bufferlist *bl)
       }
 
       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;
@@ -3107,7 +3107,7 @@ int Client::write(int fd, const char *buf, off_t size, off_t offset)
 }
 
 
-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;
@@ -3205,7 +3205,7 @@ int Client::_write(Fh *f, off_t offset, off_t size, const char *buf)
   }
     
   // assume success for now.  FIXME.
-  off_t totalwritten = size;
+  __u64 totalwritten = size;
   
   // extend file?
   if (totalwritten + offset > in->inode.size) {
@@ -3239,12 +3239,12 @@ int Client::truncate(const char *relpath, off_t length)
   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();
index 5b30f0d50d50712548b6d7bb8740afc50f6201ea..4473a84549ab6509d31eddcd3e48456525531691 100644 (file)
@@ -785,11 +785,11 @@ private:
   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);
 
index 49ecff2d7d3d3332f3e9cad1982c17cc248d753a..18527acf0dd4ecc68f0ef0bf34e8c9ad7fb45dd8 100644 (file)
@@ -23,7 +23,7 @@
 /*
  * 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.
  */
 
 
@@ -418,19 +418,19 @@ enum {
 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;
@@ -439,28 +439,28 @@ struct ceph_mds_request_head {
                        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));
@@ -469,11 +469,11 @@ struct ceph_mds_request_head {
 /* 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 {
index 2a9192f40c36bbbcd2b2d282c1a48bcf9c5e2680..b9cd0675cbef383c93b1e94695d50a42511b198f 100644 (file)
@@ -155,7 +155,6 @@ static inline bool file_mode_is_readonly(int mode) {
   return (mode & CEPH_FILE_MODE_WR) == 0;
 }
 
-
 inline int DT_TO_MODE(int dt) {
   return dt << 12;
 }
@@ -163,6 +162,23 @@ inline unsigned char MODE_TO_DT(int mode) {
   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;
@@ -182,8 +198,8 @@ struct inode_t {
   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?
index db698f289273dbbbc6cec46e9d88051be46d4618..d75634dd0147a62f0571f5b2d63280f27c6a36b1 100644 (file)
@@ -807,7 +807,7 @@ void Locker::check_inode_max_size(CInode *in)
   }
 
   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)
@@ -931,7 +931,7 @@ void Locker::handle_client_file_caps(MClientFileCaps *m)
   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;
@@ -954,7 +954,7 @@ void Locker::handle_client_file_caps(MClientFileCaps *m)
   
   // 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) {
index 5d6e648ae9726430a2ed6e51dd7cfc66f6f91d3a..2dd815817daf1f14fda733e5e3c294ccd9d903ae 100644 (file)
@@ -739,7 +739,7 @@ void Server::dispatch_client_request(MDRequest *mdr)
 
     // 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;
     }
@@ -1528,7 +1528,7 @@ void Server::handle_client_stat(MDRequest *mdr)
   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() && 
@@ -1606,7 +1606,7 @@ void Server::handle_client_utime(MDRequest *mdr)
   // 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;
@@ -1652,10 +1652,10 @@ void Server::handle_client_chmod(MDRequest *mdr)
   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();
@@ -1691,10 +1691,10 @@ void Server::handle_client_chown(MDRequest *mdr)
 
   // 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();
   
@@ -1889,8 +1889,8 @@ void Server::handle_client_mknod(MDRequest *mdr)
   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;
@@ -1927,7 +1927,7 @@ void Server::handle_client_mkdir(MDRequest *mdr)
   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;
@@ -3839,10 +3839,10 @@ class C_MDS_truncate_logged : public Context {
   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) { }
@@ -3869,7 +3869,7 @@ void Server::handle_client_truncate(MDRequest *mdr)
 {
   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;
   }
@@ -3888,7 +3888,7 @@ void Server::handle_client_truncate(MDRequest *mdr)
     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;
   }
@@ -3897,19 +3897,19 @@ void Server::handle_client_truncate(MDRequest *mdr)
   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);
@@ -3923,8 +3923,8 @@ void Server::handle_client_open(MDRequest *mdr)
 {
   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);
 
@@ -3947,7 +3947,7 @@ void Server::handle_client_open(MDRequest *mdr)
     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;
@@ -3980,7 +3980,7 @@ void Server::handle_client_open(MDRequest *mdr)
 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
@@ -4143,13 +4143,13 @@ void Server::handle_client_openc(MDRequest *mdr)
 
   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;
@@ -4170,7 +4170,7 @@ void Server::handle_client_openc(MDRequest *mdr)
   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();
index 63490b13b4229ea9c4d626a5b2d723d30410e927..ace218020edfe74aef14446608f1ff11f7c5d95b 100644 (file)
@@ -245,7 +245,7 @@ private:
   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;
@@ -286,8 +286,8 @@ private:
     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) {
index 987821c18e8fd22afd5bb1608ad6f306c1fea35b..44dfa1ffffa9fcf622ca64290cd76a6aa0ee10af 100644 (file)
@@ -439,7 +439,7 @@ void EMetaBlob::replay(MDS *mds, LogSegment *logseg)
   }
 
   // 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);
index 502f449d27de670e710ee60385e3875ad2f1adf2..b57dce2184a738d35a44df45059d52a732259450 100644 (file)
@@ -91,13 +91,13 @@ namespace __gnu_cxx {
 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) {}
 };
 
index 124ae9dabd7c15cb8d62c51724c7072fe9a856eb..7c492a424c29975ba0e631ddaeb5eb3f1e8e0d82 100644 (file)
@@ -41,8 +41,8 @@ class MClientFileCaps : public Message {
   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); }
index 5f262d814adaa188d7225bb2ac450de374aa39fa..4e798388ac6f93ab0c17fea2357edcd880f674ee 100644 (file)
@@ -184,20 +184,20 @@ class MClientReply : public Message {
 
  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() {}
@@ -205,15 +205,15 @@ class MClientReply : public Message {
     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 << ")";
   }
 
index 6b48cf1234b90b02bf1f89e645f1f40b84a65317..a3736a00d77168ddbcd28dd871a4f691c35ca743 100644 (file)
@@ -84,13 +84,13 @@ public:
   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
@@ -98,20 +98,20 @@ public:
   }
 
   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;
   }
 
 
@@ -119,16 +119,16 @@ public:
   // 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); }
   
@@ -142,11 +142,11 @@ public:
   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; }
@@ -178,8 +178,8 @@ public:
       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 << ")";
   }