From 77204716a7579cac8b503e9a0a703d839c125c52 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 7 Aug 2008 11:40:14 -0700 Subject: [PATCH] osd: more list -> vector, remove old message types --- src/Makefile.am | 5 --- src/messages/MOSDPGNotify.h | 8 ++-- src/messages/MOSDPGPeer.h | 56 -------------------------- src/messages/MOSDPGPeerAck.h | 52 ------------------------- src/messages/MOSDPGPeerRequest.h | 50 ------------------------ src/messages/MOSDPGSummary.h | 64 ------------------------------ src/messages/MOSDPGUpdate.h | 67 -------------------------------- src/osd/OSD.cc | 10 ++--- src/osd/OSD.h | 2 +- src/osd/ReplicatedPG.cc | 2 +- 10 files changed, 11 insertions(+), 305 deletions(-) delete mode 100644 src/messages/MOSDPGPeer.h delete mode 100644 src/messages/MOSDPGPeerAck.h delete mode 100644 src/messages/MOSDPGPeerRequest.h delete mode 100644 src/messages/MOSDPGSummary.h delete mode 100644 src/messages/MOSDPGUpdate.h diff --git a/src/Makefile.am b/src/Makefile.am index 110a203eadb..17c9f7e5241 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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\ diff --git a/src/messages/MOSDPGNotify.h b/src/messages/MOSDPGNotify.h index 1294390d6f4..629d1e7f68f 100644 --- a/src/messages/MOSDPGNotify.h +++ b/src/messages/MOSDPGNotify.h @@ -25,17 +25,17 @@ class MOSDPGNotify : public Message { epoch_t epoch; - list pg_list; // pgid -> version + vector pg_list; // pgid -> version public: version_t get_epoch() { return epoch; } - list& get_pg_list() { return pg_list; } + vector& get_pg_list() { return pg_list; } MOSDPGNotify() {} - MOSDPGNotify(epoch_t e, list& l) : + MOSDPGNotify(epoch_t e, vector& 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"; } diff --git a/src/messages/MOSDPGPeer.h b/src/messages/MOSDPGPeer.h deleted file mode 100644 index 978f540c233..00000000000 --- a/src/messages/MOSDPGPeer.h +++ /dev/null @@ -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 - * - * 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_list; - - bool complete; - - public: - uint64_t get_version() { return map_version; } - list& get_pg_list() { return pg_list; } - bool get_complete() { return complete; } - - MOSDPGPeer() {} - MOSDPGPeer(uint64_t v, list& 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 diff --git a/src/messages/MOSDPGPeerAck.h b/src/messages/MOSDPGPeerAck.h deleted file mode 100644 index 3eff70f689e..00000000000 --- a/src/messages/MOSDPGPeerAck.h +++ /dev/null @@ -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 - * - * 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_dne; // pg dne - map 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 diff --git a/src/messages/MOSDPGPeerRequest.h b/src/messages/MOSDPGPeerRequest.h deleted file mode 100644 index e6626c549ce..00000000000 --- a/src/messages/MOSDPGPeerRequest.h +++ /dev/null @@ -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 - * - * 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 pg_list; - - public: - version_t get_version() { return map_version; } - list& get_pg_list() { return pg_list; } - - MOSDPGPeerRequest() {} - MOSDPGPeerRequest(version_t v, list& 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 diff --git a/src/messages/MOSDPGSummary.h b/src/messages/MOSDPGSummary.h deleted file mode 100644 index 239fbebd727..00000000000 --- a/src/messages/MOSDPGSummary.h +++ /dev/null @@ -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 - * - * 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 diff --git a/src/messages/MOSDPGUpdate.h b/src/messages/MOSDPGUpdate.h deleted file mode 100644 index 46fa30865af..00000000000 --- a/src/messages/MOSDPGUpdate.h +++ /dev/null @@ -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 - * - * 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 diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 526803944bd..08d574d8a73 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1799,7 +1799,7 @@ void OSD::activate_map(ObjectStore::Transaction& t) dout(7) << "activate_map version " << osdmap->get_epoch() << dendl; - map< int, list > notify_list; // primary -> list + map< int, vector > notify_list; // primary -> list map< int, map > query_map; // peer -> PG -> get_summary_since map 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 >& notify_list) +void OSD::do_notifies(map< int, vector >& notify_list) { - for (map< int, list >::iterator it = notify_list.begin(); + for (map< int, vector >::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 info_map; int created = 0; - for (list::iterator it = m->get_pg_list().begin(); + for (vector::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 > notify_list; + map< int, vector > notify_list; for (map::iterator it = m->pg_list.begin(); it != m->pg_list.end(); diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 93f1235205b..82835a909b4 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -396,7 +396,7 @@ private: // -- generic pg recovery -- int num_pulling; - void do_notifies(map< int, list >& notify_list); + void do_notifies(map< int, vector >& notify_list); void do_queries(map< int, map >& query_map); void do_infos(map& info_map); void repeer(PG *pg, map< int, map >& query_map); diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 5f3e7d57e21..0e92aa11443 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1831,7 +1831,7 @@ bool ReplicatedPG::do_recovery() } else { // tell primary dout(7) << "do_recovery complete, telling primary" << dendl; - list ls; + vector ls; ls.push_back(info); osd->messenger->send_message(new MOSDPGNotify(osd->osdmap->get_epoch(), ls),