some small cleanups

This commit is contained in:
Sage Weil 2008-01-23 12:59:31 -08:00
parent e988d85d5c
commit 611ca711f7
3 changed files with 12 additions and 13 deletions

View 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

View 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));

View 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 &&