]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: more list -> vector, remove old message types
authorSage Weil <sage@newdream.net>
Thu, 7 Aug 2008 18:40:14 +0000 (11:40 -0700)
committerSage Weil <sage@newdream.net>
Thu, 7 Aug 2008 18:40:14 +0000 (11:40 -0700)
src/Makefile.am
src/messages/MOSDPGNotify.h
src/messages/MOSDPGPeer.h [deleted file]
src/messages/MOSDPGPeerAck.h [deleted file]
src/messages/MOSDPGPeerRequest.h [deleted file]
src/messages/MOSDPGSummary.h [deleted file]
src/messages/MOSDPGUpdate.h [deleted file]
src/osd/OSD.cc
src/osd/OSD.h
src/osd/ReplicatedPG.cc

index 110a203eadb7d3f038da7977c9caf5dff66d6c32..17c9f7e524158aa9fd48214279f2f589479d469e 100644 (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\
index 1294390d6f4ec68e81ad7e4e20c46c2fc7b1f8e4..629d1e7f68fcfbab9b6073dd3238eb2f7d05cac0 100644 (file)
 
 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"; }
diff --git a/src/messages/MOSDPGPeer.h b/src/messages/MOSDPGPeer.h
deleted file mode 100644 (file)
index 978f540..0000000
+++ /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 <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
diff --git a/src/messages/MOSDPGPeerAck.h b/src/messages/MOSDPGPeerAck.h
deleted file mode 100644 (file)
index 3eff70f..0000000
+++ /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 <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
diff --git a/src/messages/MOSDPGPeerRequest.h b/src/messages/MOSDPGPeerRequest.h
deleted file mode 100644 (file)
index e6626c5..0000000
+++ /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 <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
diff --git a/src/messages/MOSDPGSummary.h b/src/messages/MOSDPGSummary.h
deleted file mode 100644 (file)
index 239fbeb..0000000
+++ /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 <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
diff --git a/src/messages/MOSDPGUpdate.h b/src/messages/MOSDPGUpdate.h
deleted file mode 100644 (file)
index 46fa308..0000000
+++ /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 <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
index 526803944bd6172d58dac86e06b92fda541e22f6..08d574d8a738a7ca6de7bb041d378b1eded2762e 100644 (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();
index 93f1235205b4048302141822412050763fa2781a..82835a909b4c61394aceef298ce55290780046a8 100644 (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);
index 5f3e7d57e21678db38fbe0491179183ad38a1827..0e92aa1144325c3b75fdb71f10e2224e107e5f6a 100644 (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),