]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
some small cleanups
authorSage Weil <sage@newdream.net>
Wed, 23 Jan 2008 20:59:31 +0000 (12:59 -0800)
committerSage Weil <sage@newdream.net>
Wed, 23 Jan 2008 20:59:31 +0000 (12:59 -0800)
src/include/ceph_fs.h
src/include/object.h
src/osd/ReplicatedPG.cc

index ef2e6e0167c33e526d1daef34e3a7cad7ba18291..1e4821ca610e25a65b4c6a23d1f20fc9d4050977 100644 (file)
@@ -42,9 +42,9 @@ static inline int ceph_fsid_equal(const struct ceph_fsid *a, const struct ceph_f
 typedef __u64 ceph_ino_t;
 
 struct ceph_object {
-       ceph_ino_t ino;  /* inode "file" identifier */
-       __u32 bno;  /* "block" (object) in that "file" */
-       __u32 rev;  /* revision.  normally ctime (as epoch). */
+       __le64 ino;  /* inode "file" identifier */
+       __le32 bno;  /* "block" (object) in that "file" */
+       __le32 rev;  /* revision.  normally ctime (as epoch). */
 };
 
 #define CEPH_INO_ROOT 1
index f1b247b01681e80b05a6b24f654a95f321656d8a..576093035a6c17d8be189b856eac4a0216b375bf 100644 (file)
@@ -31,8 +31,6 @@ typedef uint32_t objectrev_t;
 struct object_t {
   static const uint32_t MAXREV = 0xffffffffU;
 
-  // IMPORTANT: make this match struct ceph_object ****
-
   uint64_t ino;    // "file" identifier
   uint32_t bno;    // "block" in that "file"
   objectrev_t rev; // revision.  normally ctime (as epoch).
@@ -41,17 +39,17 @@ struct object_t {
   object_t(uint64_t i, uint32_t b) : ino(i), bno(b), rev(0) {}
   object_t(uint64_t i, uint32_t b, uint32_t r) : ino(i), bno(b), rev(r) {}
 
-  // yuck.
+  // IMPORTANT: make this match struct ceph_object ****
   object_t(const ceph_object& co) {
-    ino = co.ino;
-    bno = co.bno;
-    rev = co.rev;
+    ino = le64_to_cpu(co.ino);
+    bno = le32_to_cpu(co.bno);
+    rev = le32_to_cpu(co.rev);
   }  
   operator ceph_object() {
     ceph_object oid;
-    oid.ino = ino;
-    oid.bno = bno;
-    oid.rev = rev;
+    oid.ino = cpu_to_le64(ino);
+    oid.bno = cpu_to_le32(bno);
+    oid.rev = cpu_to_le32(rev);
     return oid;
   }
 } __attribute__ ((packed));
index ba93afadee08df3824b1c43997d57c586362552b..c56d3c67ac849381172569bd446ae7e5d1ba1431 100644 (file)
@@ -146,7 +146,8 @@ bool ReplicatedPG::preprocess_op(MOSDOp *op, utime_t now)
       bool is_balanced = false;
       bool b;
       // *** FIXME *** this may block, and we're in the fast path! ***
-      if (osd->store->getattr(pobject_t(0,0,oid), "balance-reads", &b, 1) >= 0)
+      if (g_conf.osd_balance_reads &&
+         osd->store->getattr(pobject_t(0,0,oid), "balance-reads", &b, 1) >= 0)
        is_balanced = true;
       
       if (!is_balanced && should_balance &&