~ubuntu-branches/ubuntu/precise/ceph/precise-proposed

« back to all changes in this revision

Viewing changes to src/osd/OSDMap.cc

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2011-04-25 10:09:05 UTC
  • mfrom: (1.1.3 upstream) (0.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110425100905-exm7dfvi2v5ick02
Tags: 0.27-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
#include "OSDMap.h"
16
16
 
17
 
#include "config.h"
 
17
#include "common/config.h"
18
18
 
19
19
 
20
20
 
91
91
      << get_num_osds() << " osds: "
92
92
      << get_num_up_osds() << " up, " 
93
93
      << get_num_in_osds() << " in";
 
94
  if (test_flag(CEPH_OSDMAP_FULL))
 
95
    out << " full";
 
96
  else if (test_flag(CEPH_OSDMAP_NEARFULL))
 
97
    out << " nearfull";
94
98
}
95
99
 
96
100
 
97
101
void OSDMap::build_simple(epoch_t e, ceph_fsid_t &fsid,
98
 
                          int num_osd, int num_dom, int pg_bits, int lpg_bits,
99
 
                          int mds_local_osd)
 
102
                          int num_osd, int num_dom, int pg_bits, int pgp_bits, int lpg_bits)
100
103
{
101
104
  dout(10) << "build_simple on " << num_osd
102
105
           << " osds with " << pg_bits << " pg bits per osd, "
106
109
  created = modified = g_clock.now();
107
110
 
108
111
  set_max_osd(num_osd);
 
112
 
 
113
  // pgp_num <= pg_num
 
114
  if (pgp_bits > pg_bits)
 
115
    pgp_bits = pg_bits; 
109
116
  
110
117
  // crush map
111
118
  map<int, const char*> rulesets;
121
128
    pools[pool].v.crush_ruleset = p->first;
122
129
    pools[pool].v.object_hash = CEPH_STR_HASH_RJENKINS;
123
130
    pools[pool].v.pg_num = num_osd << pg_bits;
124
 
    pools[pool].v.pgp_num = num_osd << pg_bits;
 
131
    pools[pool].v.pgp_num = num_osd << pgp_bits;
125
132
    pools[pool].v.lpg_num = lpg_bits ? (1 << (lpg_bits-1)) : 0;
126
133
    pools[pool].v.lpgp_num = lpg_bits ? (1 << (lpg_bits-1)) : 0;
127
134
    pools[pool].v.last_change = epoch;
134
141
    set_state(i, 0);
135
142
    set_weight(i, CEPH_OSD_OUT);
136
143
  }
137
 
  
138
 
  if (mds_local_osd) {
139
 
    set_max_osd(mds_local_osd+num_osd);
140
 
 
141
 
    // add mds local osds, but don't put them in the crush mapping func
142
 
    for (int i=0; i<mds_local_osd; i++) {
143
 
      set_state(i+num_osd, 0);
144
 
      set_weight(i+num_osd, CEPH_OSD_OUT);
145
 
    }
146
 
  }
147
144
}
148
145
 
149
146
void OSDMap::build_simple_crush_map(CrushWrapper& crush, map<int, const char*>& rulesets, int num_osd,
168
165
    int rweights[ndom];
169
166
 
170
167
    int nper = ((num_osd - 1) / ndom) + 1;
171
 
    derr(0) << ndom << " failure domains, " << nper << " osds each" << dendl;
 
168
    dout(0) << ndom << " failure domains, " << nper << " osds each" << dendl;
172
169
    
173
170
    int o = 0;
174
171
    for (int i=0; i<ndom; i++) {