~ubuntu-branches/ubuntu/raring/ceph/raring

« back to all changes in this revision

Viewing changes to src/messages/MOSDPGCreate.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-06-08 15:54:37 UTC
  • mfrom: (1.1.8) (0.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20120608155437-gy3j9k6wzv7w4gn9
Tags: 0.44.1-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - d/control: Switch from libcryptopp to libnss as libcryptopp
    is not seeded.
  - d/control,d/rules: Move from python-support to dh_python2.
  - d/patches/manpage_updates*.patch: cherry picked upstream manpage
    updates warning about lack of encryption, per MIR review.
  - d/rules,d/control: Drop radosgw since libfcgi is not in main and
    the code may not be suitable for LTS.
  - d/rules,d/control: Drop tcmalloc since google perftools is not
    in main yet.
  - d/rules,d/control: Drop ceph-fuse entirely per MIR review
    recommendation.
* d/patches/fix-radosgw-tests.patch: Cherry picked patch from upstream
  VCS to fixup tests to conditionally use radosgw if enabled.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
#define CEPH_MOSDPGCREATE_H
18
18
 
19
19
#include "msg/Message.h"
 
20
#include "osd/osd_types.h"
20
21
 
21
22
/*
22
23
 * PGCreate - instruct an OSD to create a pg, if it doesn't already exist
23
24
 */
24
25
 
25
26
struct MOSDPGCreate : public Message {
 
27
 
 
28
  const static int HEAD_VERSION = 2;
 
29
 
26
30
  version_t          epoch;
27
 
  struct create_rec {
28
 
    epoch_t created;   // epoch pg created
29
 
    pg_t parent;       // split from parent (if != pg_t())
30
 
    __s32 split_bits;
31
 
 
32
 
    void encode(bufferlist &bl) const {
33
 
      ::encode(created, bl);
34
 
      ::encode(parent, bl);
35
 
      ::encode(split_bits, bl);
36
 
    }
37
 
    void decode(bufferlist::iterator &bl) {
38
 
      ::decode(created, bl);
39
 
      ::decode(parent, bl);
40
 
      ::decode(split_bits, bl);
41
 
    }
42
 
  };
43
 
  WRITE_CLASS_ENCODER(create_rec)
44
 
 
45
 
  map<pg_t,create_rec> mkpg;
46
 
 
47
 
  MOSDPGCreate() {}
48
 
  MOSDPGCreate(epoch_t e) :
49
 
    Message(MSG_OSD_PG_CREATE),
50
 
    epoch(e) { }
 
31
  map<pg_t,pg_create_t> mkpg;
 
32
 
 
33
  MOSDPGCreate()
 
34
    : Message(MSG_OSD_PG_CREATE, HEAD_VERSION) {}
 
35
  MOSDPGCreate(epoch_t e)
 
36
    : Message(MSG_OSD_PG_CREATE, HEAD_VERSION),
 
37
      epoch(e) { }
51
38
private:
52
39
  ~MOSDPGCreate() {}
53
40
 
54
41
public:  
55
 
  const char *get_type_name() { return "pg_create"; }
 
42
  const char *get_type_name() const { return "pg_create"; }
56
43
 
57
 
  void encode_payload(CephContext *cct) {
 
44
  void encode_payload(uint64_t features) {
58
45
    ::encode(epoch, payload);
59
46
    ::encode(mkpg, payload);
60
47
  }
61
 
  void decode_payload(CephContext *cct) {
 
48
  void decode_payload() {
62
49
    bufferlist::iterator p = payload.begin();
63
50
    ::decode(epoch, p);
64
 
    ::decode(mkpg, p);
 
51
    if (header.version >= 2) {
 
52
      ::decode(mkpg, p);
 
53
    } else {
 
54
      __u32 n;
 
55
      ::decode(n, p);
 
56
      while (n--) {
 
57
        pg_t pgid;
 
58
        epoch_t created;   // epoch pg created
 
59
        pg_t parent;       // split from parent (if != pg_t())
 
60
        __s32 split_bits;
 
61
        ::decode(pgid, p);
 
62
        ::decode(created, p);
 
63
        ::decode(parent, p);
 
64
        ::decode(split_bits, p);
 
65
        mkpg[pgid] = pg_create_t(created, parent, split_bits);
 
66
      }
 
67
    }
65
68
  }
66
69
 
67
 
  void print(ostream& out) {
68
 
    out << "osd pg create(";
69
 
    for (map<pg_t,create_rec>::iterator i = mkpg.begin();
 
70
  void print(ostream& out) const {
 
71
    out << "osd_pg_create(";
 
72
    for (map<pg_t,pg_create_t>::const_iterator i = mkpg.begin();
70
73
         i != mkpg.end();
71
74
         ++i) {
72
75
      out << "pg" << i->first << "," << i->second.created << "; ";
75
78
  }
76
79
};
77
80
 
78
 
WRITE_CLASS_ENCODER(MOSDPGCreate::create_rec)
79
 
 
80
81
#endif