#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 */
// -- sessions --
public:
+
+
+ static bool split_request(OpRequestRef op, unsigned match, unsigned bits) {
+ unsigned mask = ~((~0)<<bits);
+ switch (op->get_req()->get_type()) {
+ case CEPH_MSG_OSD_OP:
+ return (static_cast<MOSDOp*>(
+ op->get_req())->get_pg().m_seed & mask) == match;
+ }
+ return false;
+ }
+
+ static void split_list(
+ list<OpRequestRef> *from,
+ list<OpRequestRef> *to,
+ unsigned match,
+ unsigned bits) {
+ for (list<OpRequestRef>::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;
osd->osd->finish_recovery_op(this, soid, dequeue);
}
-static void split_list(
- list<OpRequestRef> *from,
- list<OpRequestRef> *to,
- unsigned match,
- unsigned bits)
-{
- for (list<OpRequestRef>::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<eversion_t, OpRequestRef> *from,
map<eversion_t, OpRequestRef> *to,
for (map<eversion_t, OpRequestRef>::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 {
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);
}
}
return true;
}
-bool PG::split_request(OpRequestRef op, unsigned match, unsigned bits)
-{
- unsigned mask = ~((~0)<<bits);
- switch (op->get_req()->get_type()) {
- case CEPH_MSG_OSD_OP:
- return (static_cast<MOSDOp*>(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()) {
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());