From: Samuel Just Date: Tue, 27 May 2014 20:16:41 +0000 (-0700) Subject: osd/: move split_list and split_request into OSD X-Git-Tag: v0.83~57^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4021fb69e229c0438d3ce909dd709e4b640583b4;p=ceph.git osd/: move split_list and split_request into OSD Signed-off-by: Samuel Just --- diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 0f5f05560c1..b3e30c57183 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -53,6 +53,7 @@ using namespace std; #include "common/simple_cache.hpp" #include "common/sharedptr_registry.hpp" #include "common/PrioritizedQueue.h" +#include "messages/MOSDOp.h" #define CEPH_OSD_PROTOCOL 10 /* cluster internal */ @@ -1095,6 +1096,35 @@ private: // -- sessions -- public: + + + static bool split_request(OpRequestRef op, unsigned match, unsigned bits) { + unsigned mask = ~((~0)<get_req()->get_type()) { + case CEPH_MSG_OSD_OP: + return (static_cast( + op->get_req())->get_pg().m_seed & mask) == match; + } + return false; + } + + static void split_list( + list *from, + list *to, + unsigned match, + unsigned bits) { + for (list::iterator i = from->begin(); + i != from->end(); + ) { + if (split_request(*i, match, bits)) { + to->push_back(*i); + from->erase(i++); + } else { + ++i; + } + } + } + struct Session : public RefCountedObject { EntityName entity_name; OSDCap caps; diff --git a/src/osd/PG.cc b/src/osd/PG.cc index aa3b6d5ac71..b994cf24147 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1946,24 +1946,6 @@ void PG::finish_recovery_op(const hobject_t& soid, bool dequeue) osd->osd->finish_recovery_op(this, soid, dequeue); } -static void split_list( - list *from, - list *to, - unsigned match, - unsigned bits) -{ - for (list::iterator i = from->begin(); - i != from->end(); - ) { - if (PG::split_request(*i, match, bits)) { - to->push_back(*i); - from->erase(i++); - } else { - ++i; - } - } -} - static void split_replay_queue( map *from, map *to, @@ -1973,7 +1955,7 @@ static void split_replay_queue( for (map::iterator i = from->begin(); i != from->end(); ) { - if (PG::split_request(i->second, match, bits)) { + if (OSD::split_request(i->second, match, bits)) { to->insert(*i); from->erase(i++); } else { @@ -1993,10 +1975,12 @@ void PG::split_ops(PG *child, unsigned split_bits) { split_replay_queue(&replay_queue, &(child->replay_queue), match, split_bits); osd->dequeue_pg(this, &waiting_for_active); - split_list(&waiting_for_active, &(child->waiting_for_active), match, split_bits); + OSD::split_list( + &waiting_for_active, &(child->waiting_for_active), match, split_bits); { Mutex::Locker l(map_lock); // to avoid a race with the osd dispatch - split_list(&waiting_for_map, &(child->waiting_for_map), match, split_bits); + OSD::split_list( + &waiting_for_map, &(child->waiting_for_map), match, split_bits); } } @@ -4851,16 +4835,6 @@ bool PG::can_discard_request(OpRequestRef op) return true; } -bool PG::split_request(OpRequestRef op, unsigned match, unsigned bits) -{ - unsigned mask = ~((~0)<get_req()->get_type()) { - case CEPH_MSG_OSD_OP: - return (static_cast(op->get_req())->get_pg().m_seed & mask) == match; - } - return false; -} - bool PG::op_must_wait_for_map(OSDMapRef curmap, OpRequestRef op) { switch (op->get_req()->get_type()) { diff --git a/src/osd/PG.h b/src/osd/PG.h index 1b7311d6252..95179810ac5 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -2053,8 +2053,6 @@ public: static bool op_must_wait_for_map(OSDMapRef curmap, OpRequestRef op); - static bool split_request(OpRequestRef op, unsigned match, unsigned bits); - bool old_peering_msg(epoch_t reply_epoch, epoch_t query_epoch); bool old_peering_evt(CephPeeringEvtRef evt) { return old_peering_msg(evt->get_epoch_sent(), evt->get_epoch_requested());