From 611ca711f76663f0932308f788e3c20ce18d599b Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 23 Jan 2008 12:59:31 -0800 Subject: [PATCH] some small cleanups --- src/include/ceph_fs.h | 6 +++--- src/include/object.h | 16 +++++++--------- src/osd/ReplicatedPG.cc | 3 ++- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/include/ceph_fs.h b/src/include/ceph_fs.h index ef2e6e0167c33..1e4821ca610e2 100644 --- a/src/include/ceph_fs.h +++ b/src/include/ceph_fs.h @@ -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 diff --git a/src/include/object.h b/src/include/object.h index f1b247b01681e..576093035a6c1 100644 --- a/src/include/object.h +++ b/src/include/object.h @@ -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)); diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index ba93afadee08d..c56d3c67ac849 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -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 && -- 2.39.5