From: David Zafman Date: Tue, 17 Dec 2013 02:50:57 +0000 (-0800) Subject: messages, os, osd: Clean-up g/hobject_t MAX handling X-Git-Tag: v0.77~23^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=25a798edfae6cf5c8406e759026fd6ffb9710582;p=ceph.git messages, os, osd: Clean-up g/hobject_t MAX handling Add check of is_max() before updating an unset pool Use efficient is_max() instead of compare with hobject::get_max() Signed-off-by: David Zafman --- diff --git a/src/messages/MOSDPGScan.h b/src/messages/MOSDPGScan.h index 7df3a966dba7..4c86a3c7e7aa 100644 --- a/src/messages/MOSDPGScan.h +++ b/src/messages/MOSDPGScan.h @@ -47,9 +47,9 @@ public: ::decode(end, p); // handle hobject_t format upgrade - if (begin.pool == -1) + if (!begin.is_max() && begin.pool == -1) begin.pool = pgid.pool(); - if (end.pool == -1) + if (!end.is_max() && end.pool == -1) end.pool = pgid.pool(); } diff --git a/src/messages/MOSDSubOp.h b/src/messages/MOSDSubOp.h index 4169e01325e2..7e9f087fec80 100644 --- a/src/messages/MOSDSubOp.h +++ b/src/messages/MOSDSubOp.h @@ -149,7 +149,7 @@ public: if (header.version < 7) { // Handle hobject_t format change - if (poid.pool == -1) + if (!poid.is_max() && poid.pool == -1) poid.pool = pgid.pool(); hobject_incorrect_pool = true; } diff --git a/src/messages/MOSDSubOpReply.h b/src/messages/MOSDSubOpReply.h index d577dd3c2d30..6b0738a212f0 100644 --- a/src/messages/MOSDSubOpReply.h +++ b/src/messages/MOSDSubOpReply.h @@ -69,7 +69,7 @@ public: ::decode(peer_stat, p); ::decode(attrset, p); - if (poid.pool == -1) + if (!poid.is_max() && poid.pool == -1) poid.pool = pgid.pool(); } virtual void encode_payload(uint64_t features) { diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index 90db986b2954..17d360f0b436 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -342,7 +342,7 @@ public: } else { ::decode(oid, p); if (use_pool_override && pool_override != -1 && - oid.hobj.pool == -1) { + !oid.hobj.is_max() && oid.hobj.pool == -1) { oid.hobj.pool = pool_override; } } diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 6a2cf7c0a4f0..b5d3f8829651 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -526,7 +526,7 @@ bool PG::needs_backfill() const for (; a != end; ++a) { int peer = *a; map::const_iterator pi = peer_info.find(peer); - if (pi->second.last_backfill != hobject_t::get_max()) { + if (!pi->second.last_backfill.is_max()) { dout(10) << __func__ << " osd." << peer << " has last_backfill " << pi->second.last_backfill << dendl; ret = true; } diff --git a/src/osd/PG.h b/src/osd/PG.h index 31b9762e3bcb..4047dd4b3fcd 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -462,7 +462,7 @@ protected: /// true if interval extends to the end of the range bool extends_to_end() { - return end == hobject_t::get_max(); + return end.is_max(); } /// removes items <= soid and adjusts begin to the first object diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index e21efeb9ce00..ffa29a24c04a 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1857,7 +1857,7 @@ void ReplicatedPG::do_scan( i != tmp.end(); ++i) { hobject_t first(i->first); - if (first.pool == -1) + if (!first.is_max() && first.pool == -1) first.pool = info.pgid.pool(); bi.objects[first] = i->second; } @@ -6349,7 +6349,7 @@ void ReplicatedPG::sub_op_modify(OpRequestRef op) for (vector::iterator i = log.begin(); i != log.end(); ++i) { - if (i->soid.pool == -1) + if (!i->soid.is_max() && i->soid.pool == -1) i->soid.pool = info.pgid.pool(); } rm->opt.set_pool_override(info.pgid.pool()); @@ -8111,7 +8111,7 @@ void ReplicatedPG::on_activate() int backfill_target = get_backfill_target(); if (backfill_target != -1) { last_backfill_started = peer_info[backfill_target].last_backfill; - assert(last_backfill_started != hobject_t::get_max()); + assert(!last_backfill_started.is_max()); dout(10) << " chose backfill target osd." << backfill_target << " from " << last_backfill_started << dendl; } diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 7693eada4b95..6f72b05e4d20 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -2295,7 +2295,7 @@ void pg_log_t::decode(bufferlist::iterator &bl, int64_t pool) for (list::iterator i = log.begin(); i != log.end(); ++i) { - if (i->soid.pool == -1) + if (!i->soid.is_max() && i->soid.pool == -1) i->soid.pool = pool; } } @@ -2412,7 +2412,7 @@ void pg_missing_t::decode(bufferlist::iterator &bl, int64_t pool) for (map::iterator i = missing.begin(); i != missing.end(); ) { - if (i->first.pool == -1) { + if (!i->first.is_max() && i->first.pool == -1) { hobject_t to_insert(i->first); to_insert.pool = pool; tmp[to_insert] = i->second; @@ -3398,7 +3398,7 @@ void ObjectRecoveryInfo::decode(bufferlist::iterator &bl, DECODE_FINISH(bl); if (struct_v < 2) { - if (soid.pool == -1) + if (!soid.is_max() && soid.pool == -1) soid.pool = pool; map > tmp; tmp.swap(clone_subset); @@ -3406,7 +3406,7 @@ void ObjectRecoveryInfo::decode(bufferlist::iterator &bl, i != tmp.end(); ++i) { hobject_t first(i->first); - if (first.pool == -1) + if (!first.is_max() && first.pool == -1) first.pool = pool; clone_subset[first].swap(i->second); } @@ -3726,7 +3726,7 @@ void ScrubMap::decode(bufferlist::iterator& bl, int64_t pool) i != tmp.end(); ++i) { hobject_t first(i->first); - if (first.pool == -1) + if (!first.is_max() && first.pool == -1) first.pool = pool; objects[first] = i->second; } diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 49de460bb173..ddb55b71389f 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -1420,7 +1420,7 @@ struct pg_info_t { bool is_empty() const { return last_update.version == 0; } bool dne() const { return history.epoch_created == 0; } - bool is_incomplete() const { return last_backfill != hobject_t::get_max(); } + bool is_incomplete() const { return !last_backfill.is_max(); } void encode(bufferlist& bl) const; void decode(bufferlist::iterator& p);