osd: more list -> vector, remove old message types

This commit is contained in:
Sage Weil 2008-08-07 11:40:14 -07:00
parent fcc9095ede
commit 77204716a7
10 changed files with 11 additions and 305 deletions

View File

@ -419,12 +419,7 @@ noinst_HEADERS = \
messages/MOSDPGLog.h\
messages/MPGStats.h\
messages/MPing.h\
messages/MOSDPGPeer.h\
messages/MOSDPGPeerAck.h\
messages/MOSDPGPeerRequest.h\
messages/MHeartbeat.h\
messages/MOSDPGSummary.h\
messages/MOSDPGUpdate.h\
messages/MExportCaps.h\
messages/MMDSGetMap.h\
messages/MMonCommandAck.h\

View File

@ -25,17 +25,17 @@
class MOSDPGNotify : public Message {
epoch_t epoch;
list<PG::Info> pg_list; // pgid -> version
vector<PG::Info> pg_list; // pgid -> version
public:
version_t get_epoch() { return epoch; }
list<PG::Info>& get_pg_list() { return pg_list; }
vector<PG::Info>& get_pg_list() { return pg_list; }
MOSDPGNotify() {}
MOSDPGNotify(epoch_t e, list<PG::Info>& l) :
MOSDPGNotify(epoch_t e, vector<PG::Info>& l) :
Message(MSG_OSD_PG_NOTIFY) {
this->epoch = e;
pg_list.splice(pg_list.begin(),l);
pg_list.swap(l);
}
const char *get_type_name() { return "PGnot"; }

View File

@ -1,56 +0,0 @@
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
*
*/
#ifndef __MOSDPGPEER_H
#define __MOSDPGPEER_H
#include "msg/Message.h"
class MOSDPGPeer : public Message {
uint64_t map_version;
list<pg_t> pg_list;
bool complete;
public:
uint64_t get_version() { return map_version; }
list<pg_t>& get_pg_list() { return pg_list; }
bool get_complete() { return complete; }
MOSDPGPeer() {}
MOSDPGPeer(uint64_t v, list<pg_t>& l, bool c=false) :
Message(MSG_OSD_PG_PEER) {
this->map_version = v;
this->complete = c;
pg_list.splice(pg_list.begin(), l);
}
char *get_type_name() { return "PGPeer"; }
void encode_payload() {
::encode(map_version, payload);
::encode(complete, payload);
::encode(pg_list, payload);
}
void decode_payload() {
bufferlist::iterator p = payload.begin();
::decode(map_version, p);
::decode(complete, p);
::decode(pg_list, p);
}
};
#endif

View File

@ -1,52 +0,0 @@
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
*
*/
#ifndef __MOSDPGPEERACK_H
#define __MOSDPGPEERACK_H
#include "msg/Message.h"
#include "osd/OSD.h"
class MOSDPGPeerAck : public Message {
version_t map_version;
public:
vector<pg_t> pg_dne; // pg dne
map<pg_t, PGReplicaInfo > pg_state; // state, lists, etc.
version_t get_version() { return map_version; }
MOSDPGPeerAck() {}
MOSDPGPeerAck(version_t v) :
Message(MSG_OSD_PG_PEERACK) {
this->map_version = v;
}
char *get_type_name() { return "PGPeer"; }
void encode_payload() {
::encode(map_version, payload);
::encode(pg_dne, payload);
::encode(pg_state, payload);
}
void decode_payload() {
bufferlist::iterator p = payload.begin();
::decode(map_version, payload);
::decode(pg_dne, payload);
::decode(pg_state, payload);
}
};
#endif

View File

@ -1,50 +0,0 @@
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
*
*/
#ifndef __MOSDPEERREQUEST_H
#define __MOSDPEERREQUEST_H
#include "msg/Message.h"
class MOSDPGPeerRequest : public Message {
version_t map_version;
list<repgroup_t> pg_list;
public:
version_t get_version() { return map_version; }
list<repgroup_t>& get_pg_list() { return pg_list; }
MOSDPGPeerRequest() {}
MOSDPGPeerRequest(version_t v, list<repgroup_t>& l) :
Message(MSG_OSD_PG_PEERREQUEST) {
this->map_version = v;
pg_list.splice(pg_list.begin(), l);
}
char *get_type_name() { return "PGPR"; }
void encode_payload() {
::encode(map_version, payload);
::encode(pg_list, payload);
}
void decode_payload() {
bufferlist::iterator p = payload.begin();
::decode(map_version, p);
::decode(pg_list, p);
}
};
#endif

View File

@ -1,64 +0,0 @@
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
*
*/
#ifndef __MOSDPGQUERYREPLY_H
#define __MOSDPGQUERYREPLY_H
#include "msg/Message.h"
class MOSDPGSummary : public Message {
epoch_t epoch;
pg_t pgid;
public:
PG::PGInfo info;
bufferlist sumbl;
epoch_t get_epoch() { return epoch; }
MOSDPGSummary() {}
MOSDPGSummary(version_t mv, pg_t pgid, PG::PGSummary &summary) :
Message(MSG_OSD_PG_SUMMARY) {
this->epoch = mv;
this->pgid = pgid;
summary.encode(sumbl);
}
pg_t get_pgid() { return pgid; }
bufferlist& get_summary_bl() {
return sumbl;
}
char *get_type_name() { return "PGsum"; }
void print(ostream& out) {
out << "pg_summary(" << pgid << " e" << epoch << ")";
}
void encode_payload() {
::encode(epoch, payload);
::encode(pgid, payload);
::encode(info, payload);
::encode(sumbl, payload);
}
void decode_payload() {
bufferlist::iterator p = payload.begin();
::decode(epoch, payload);
::decode(pgid, payload);
::decode(info, payload);
::decode(sumbl, payload);
}
};
#endif

View File

@ -1,67 +0,0 @@
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
*
*/
#ifndef __MOSDPGUPDATE_H
#define __MOSDPGUPDATE_H
#include "msg/Message.h"
class MOSDPGUpdate : public Message {
version_t map_version;
pg_t pgid;
//pginfo_t info;
bool complete;
version_t last_any_complete;
public:
version_t get_version() { return map_version; }
pg_t get_pgid() { return pgid; }
//pginfo_t& get_pginfo() { return info; }
bool is_complete() { return complete; }
version_t get_last_any_complete() { return last_any_complete; }
MOSDPGUpdate() {}
MOSDPGUpdate(version_t mv, pg_t pgid, bool complete, version_t last_any_complete) :
Message(MSG_OSD_PG_UPDATE) {
this->map_version = mv;
this->pgid = pgid;
this->complete = complete;
this->last_any_complete = last_any_complete;
}
char *get_type_name() { return "PGUp"; }
void print(ostream& out) {
out << "pg_update(" << pgid << " e" << map_version;
if (complete) out << " complete";
out << " lac=" << last_any_complete;
out << ")";
}
void encode_payload() {
::encode(map_version, payload);
::encode(pgid, payload);
::encode(complete, payload);
::encode(last_any_complete, payload);
}
void decode_payload() {
bufferlist::iterator p = payload.begin();
::decode(map_version, p);
::decode(pgid, p);
::decode(complete, p);
::decode(last_any_complete, p);
}
};
#endif

View File

@ -1799,7 +1799,7 @@ void OSD::activate_map(ObjectStore::Transaction& t)
dout(7) << "activate_map version " << osdmap->get_epoch() << dendl;
map< int, list<PG::Info> > notify_list; // primary -> list
map< int, vector<PG::Info> > notify_list; // primary -> list
map< int, map<pg_t,PG::Query> > query_map; // peer -> PG -> get_summary_since
map<int,MOSDPGInfo*> info_map; // peer -> message
@ -2232,9 +2232,9 @@ void OSD::handle_pg_create(MOSDPGCreate *m)
* content for, and they are primary for.
*/
void OSD::do_notifies(map< int, list<PG::Info> >& notify_list)
void OSD::do_notifies(map< int, vector<PG::Info> >& notify_list)
{
for (map< int, list<PG::Info> >::iterator it = notify_list.begin();
for (map< int, vector<PG::Info> >::iterator it = notify_list.begin();
it != notify_list.end();
it++) {
if (it->first == whoami) {
@ -2296,7 +2296,7 @@ void OSD::handle_pg_notify(MOSDPGNotify *m)
map<int, MOSDPGInfo*> info_map;
int created = 0;
for (list<PG::Info>::iterator it = m->get_pg_list().begin();
for (vector<PG::Info>::iterator it = m->get_pg_list().begin();
it != m->get_pg_list().end();
it++) {
pg_t pgid = it->pgid;
@ -2559,7 +2559,7 @@ void OSD::handle_pg_query(MOSDPGQuery *m)
if (!require_same_or_newer_map(m, m->get_epoch())) return;
int created = 0;
map< int, list<PG::Info> > notify_list;
map< int, vector<PG::Info> > notify_list;
for (map<pg_t,PG::Query>::iterator it = m->pg_list.begin();
it != m->pg_list.end();

View File

@ -396,7 +396,7 @@ private:
// -- generic pg recovery --
int num_pulling;
void do_notifies(map< int, list<PG::Info> >& notify_list);
void do_notifies(map< int, vector<PG::Info> >& notify_list);
void do_queries(map< int, map<pg_t,PG::Query> >& query_map);
void do_infos(map<int, MOSDPGInfo*>& info_map);
void repeer(PG *pg, map< int, map<pg_t,PG::Query> >& query_map);

View File

@ -1831,7 +1831,7 @@ bool ReplicatedPG::do_recovery()
} else {
// tell primary
dout(7) << "do_recovery complete, telling primary" << dendl;
list<PG::Info> ls;
vector<PG::Info> ls;
ls.push_back(info);
osd->messenger->send_message(new MOSDPGNotify(osd->osdmap->get_epoch(),
ls),