~ubuntu-branches/ubuntu/quantal/ceph/quantal

« back to all changes in this revision

Viewing changes to src/osd/OSD.h

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum, Clint Byrum, Micah Gersten
  • Date: 2011-02-12 22:50:26 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110212225026-yyyw4tk0msgql3ul
Tags: 0.24.2-0ubuntu1
[ Clint Byrum <clint@ubuntu.com> ]
* New upstream release. (LP: #658670, LP: #684011)
* debian/patches/fix-mkcephfs.patch: dropped (applied upstream)
* Removed .la files from libceph1-dev, libcrush1-dev and 
  librados1-dev (per Debian policy v3.9.1 10.2).
* debian/control: adding pkg-config as a build dependency
* debian/control: depend on libcrypto++-dev instead of libssl-dev
* debian/watch: added watch file

[ Micah Gersten <micahg@ubuntu.com> ]
* debian/control: add Homepage

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
#include "auth/KeyRing.h"
37
37
 
38
38
#include <map>
 
39
#include <memory>
39
40
using namespace std;
40
41
 
41
42
#include <ext/hash_map>
96
97
class OSDMap;
97
98
class MLog;
98
99
class MClass;
 
100
class MOSDPGMissing;
99
101
 
100
102
extern const coll_t meta_coll;
101
103
 
102
104
class OSD : public Dispatcher {
103
105
  /** OSD **/
104
106
protected:
105
 
  Mutex osd_lock;     // global lock
 
107
  Mutex osd_lock;                       // global lock
106
108
  SafeTimer timer;    // safe timer (osd_lock)
107
109
 
108
 
  Messenger   *messenger; 
 
110
  Messenger   *cluster_messenger;
 
111
  Messenger   *client_messenger;
109
112
  MonClient   *monc;
110
113
  Logger      *logger;
111
114
  bool         logger_started;
112
115
  ObjectStore *store;
113
116
 
 
117
  // cover OSDMap update data when using multiple msgrs
 
118
  Cond *map_in_progress_cond;
 
119
  bool map_in_progress;
 
120
 
114
121
  LogClient   logclient;
115
122
 
116
123
  int whoami;
125
132
    }
126
133
  };
127
134
 
128
 
  bool dispatch_running;
 
135
  int dispatch_running;
129
136
 
130
137
  void open_logger();
131
138
  void start_logger();
138
145
  
139
146
  static sobject_t get_osdmap_pobject_name(epoch_t epoch) { 
140
147
    char foo[20];
141
 
    sprintf(foo, "osdmap.%d", epoch);
 
148
    snprintf(foo, sizeof(foo), "osdmap.%d", epoch);
142
149
    return sobject_t(object_t(foo), 0); 
143
150
  }
144
151
  static sobject_t get_inc_osdmap_pobject_name(epoch_t epoch) { 
145
152
    char foo[20];
146
 
    sprintf(foo, "inc_osdmap.%d", epoch);
 
153
    snprintf(foo, sizeof(foo), "inc_osdmap.%d", epoch);
147
154
    return sobject_t(object_t(foo), 0); 
148
155
  }
149
156
 
155
162
    return sobject_t(object_t(s.c_str()), 0);
156
163
  }
157
164
  
 
165
  sobject_t make_pg_biginfo_oid(pg_t pg) {
 
166
    stringstream ss;
 
167
    ss << "pginfo_" << pg;
 
168
    string s;
 
169
    getline(ss, s);
 
170
    return sobject_t(object_t(s.c_str()), 0);
 
171
  }
 
172
  
158
173
 
159
174
private:
160
175
  // -- superblock --
451
466
protected:
452
467
  // -- classes --
453
468
  Mutex class_lock;
454
 
  map<string, map<pg_t, list<Message*> > > waiting_for_missing_class;
 
469
  map<string, list<Message*> > waiting_for_missing_class;
455
470
 
456
471
  int get_class(const string& cname, ClassVersion& version, pg_t pgid, Message *m, ClassHandler::ClassData **cls);
457
472
  void handle_class(MClass *m);
541
556
  set<int> failure_queue;
542
557
  set<int> failure_pending;
543
558
 
 
559
 
544
560
  void queue_failure(int n) {
545
561
    failure_queue.insert(n);
546
562
  }
547
563
  void send_failures();
 
564
  void send_still_alive(int osd);
548
565
 
549
566
  // -- pg stats --
550
567
  Mutex pg_stat_queue_lock;
611
628
  bool require_same_or_newer_map(Message *m, epoch_t e);
612
629
 
613
630
  void handle_pg_query(class MOSDPGQuery *m);
 
631
  void handle_pg_missing(class MOSDPGMissing *m);
614
632
  void handle_pg_notify(class MOSDPGNotify *m);
615
633
  void handle_pg_log(class MOSDPGLog *m);
616
634
  void handle_pg_info(class MOSDPGInfo *m);
624
642
  void _process_pg_info(epoch_t epoch, int from,
625
643
                        PG::Info &info, 
626
644
                        PG::Log &log, 
627
 
                        PG::Missing &missing,
 
645
                        PG::Missing *missing,
628
646
                        map<int, MOSDPGInfo*>* info_map,
629
647
                        int& created);
630
648
 
679
697
  utime_t defer_recovery_until;
680
698
  int recovery_ops_active;
681
699
#ifdef DEBUG_RECOVERY_OIDS
682
 
  set<sobject_t> recovery_oids;
 
700
  map<pg_t, set<sobject_t> > recovery_oids;
683
701
#endif
684
702
 
685
703
  struct RecoveryWQ : public ThreadPool::WorkQueue<PG> {
787
805
    }
788
806
  } snap_trim_wq;
789
807
 
 
808
  // -- scrub scheduling --
 
809
  Mutex sched_scrub_lock;
 
810
  int scrubs_pending;
 
811
  int scrubs_active;
 
812
  set< pair<utime_t,pg_t> > last_scrub_pg;
 
813
 
 
814
  bool scrub_should_schedule();
 
815
  void sched_scrub();
 
816
 
 
817
  void reg_last_pg_scrub(pg_t pgid, utime_t t) {
 
818
    Mutex::Locker l(sched_scrub_lock);
 
819
    last_scrub_pg.insert(pair<utime_t,pg_t>(t, pgid));
 
820
  }
 
821
  void unreg_last_pg_scrub(pg_t pgid, utime_t t) {
 
822
    Mutex::Locker l(sched_scrub_lock);
 
823
    pair<utime_t,pg_t> p(t, pgid);
 
824
    last_scrub_pg.erase(p);
 
825
  }
 
826
 
 
827
  bool inc_scrubs_pending();
 
828
  void dec_scrubs_pending();
 
829
  void dec_scrubs_active();
790
830
 
791
831
  // -- scrubbing --
792
832
  xlist<PG*> scrub_queue;
793
833
 
 
834
 
794
835
  struct ScrubWQ : public ThreadPool::WorkQueue<PG> {
795
836
    OSD *osd;
796
837
    ScrubWQ(OSD *o, ThreadPool *tp) : ThreadPool::WorkQueue<PG>("OSD::ScrubWQ", tp), osd(o) {}
799
840
      return osd->scrub_queue.empty();
800
841
    }
801
842
    bool _enqueue(PG *pg) {
802
 
      if (pg->scrub_item.is_on_list())
 
843
      if (pg->scrub_item.is_on_list()) {
803
844
        return false;
 
845
      }
804
846
      pg->get();
805
847
      osd->scrub_queue.push_back(&pg->scrub_item);
806
848
      return true;
807
849
    }
808
850
    void _dequeue(PG *pg) {
809
 
      if (pg->scrub_item.remove_myself())
 
851
      if (pg->scrub_item.remove_myself()) {
810
852
        pg->put();
 
853
      }
811
854
    }
812
855
    PG *_dequeue() {
813
856
      if (osd->scrub_queue.empty())
818
861
    }
819
862
    void _process(PG *pg) {
820
863
      pg->scrub();
821
 
      pg->get();
822
864
    }
823
865
    void _clear() {
824
866
      while (!osd->scrub_queue.empty()) {
880
922
  void ms_handle_remote_reset(Connection *con) {}
881
923
 
882
924
 public:
883
 
  OSD(int id, Messenger *m, Messenger *hbm, MonClient *mc,
 
925
  /* internal and external can point to the same messenger, they will still
 
926
   * be cleaned up properly*/
 
927
  OSD(int id, Messenger *internal, Messenger *external, Messenger *hbm, MonClient *mc,
884
928
      const char *dev = 0, const char *jdev = 0);
885
929
  ~OSD();
886
930