Commit 4f6a7e5e authored by Sage Weil's avatar Sage Weil

ceph: update support for PGID64, PGPOOL3, OSDENC protocol features

Support (and require) the PGID64, PGPOOL3, and OSDENC protocol features.
These have been present in ceph.git since v0.42, Feb 2012.  Require these
features to simplify support; nobody is running older userspace.

Note that the new request and reply encoding is still not in place, so the new
code is not yet functional.
Signed-off-by: default avatarSage Weil <sage@inktank.com>
Reviewed-by: default avatarAlex Elder <elder@inktank.com>
parent ec73a754
...@@ -59,6 +59,10 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end) ...@@ -59,6 +59,10 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
ceph_decode_16_safe(p, end, version, bad); ceph_decode_16_safe(p, end, version, bad);
if (version > 3) {
pr_warning("got mdsmap version %d > 3, failing", version);
goto bad;
}
ceph_decode_need(p, end, 8*sizeof(u32) + sizeof(u64), bad); ceph_decode_need(p, end, 8*sizeof(u32) + sizeof(u64), bad);
m->m_epoch = ceph_decode_32(p); m->m_epoch = ceph_decode_32(p);
...@@ -144,13 +148,13 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end) ...@@ -144,13 +148,13 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
/* pg_pools */ /* pg_pools */
ceph_decode_32_safe(p, end, n, bad); ceph_decode_32_safe(p, end, n, bad);
m->m_num_data_pg_pools = n; m->m_num_data_pg_pools = n;
m->m_data_pg_pools = kcalloc(n, sizeof(u32), GFP_NOFS); m->m_data_pg_pools = kcalloc(n, sizeof(u64), GFP_NOFS);
if (!m->m_data_pg_pools) if (!m->m_data_pg_pools)
goto badmem; goto badmem;
ceph_decode_need(p, end, sizeof(u32)*(n+1), bad); ceph_decode_need(p, end, sizeof(u64)*(n+1), bad);
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
m->m_data_pg_pools[i] = ceph_decode_32(p); m->m_data_pg_pools[i] = ceph_decode_64(p);
m->m_cas_pg_pool = ceph_decode_32(p); m->m_cas_pg_pool = ceph_decode_64(p);
/* ok, we don't care about the rest. */ /* ok, we don't care about the rest. */
dout("mdsmap_decode success epoch %u\n", m->m_epoch); dout("mdsmap_decode success epoch %u\n", m->m_epoch);
......
...@@ -40,10 +40,16 @@ ...@@ -40,10 +40,16 @@
*/ */
#define CEPH_FEATURES_SUPPORTED_DEFAULT \ #define CEPH_FEATURES_SUPPORTED_DEFAULT \
(CEPH_FEATURE_NOSRCADDR | \ (CEPH_FEATURE_NOSRCADDR | \
CEPH_FEATURE_PGID64 | \
CEPH_FEATURE_PGPOOL3 | \
CEPH_FEATURE_OSDENC | \
CEPH_FEATURE_CRUSH_TUNABLES | \ CEPH_FEATURE_CRUSH_TUNABLES | \
CEPH_FEATURE_CRUSH_TUNABLES2 | \ CEPH_FEATURE_CRUSH_TUNABLES2 | \
CEPH_FEATURE_REPLY_CREATE_INODE) CEPH_FEATURE_REPLY_CREATE_INODE)
#define CEPH_FEATURES_REQUIRED_DEFAULT \ #define CEPH_FEATURES_REQUIRED_DEFAULT \
(CEPH_FEATURE_NOSRCADDR) (CEPH_FEATURE_NOSRCADDR | \
CEPH_FEATURE_PGID64 | \
CEPH_FEATURE_PGPOOL3 | \
CEPH_FEATURE_OSDENC)
#endif #endif
...@@ -29,8 +29,8 @@ struct ceph_mdsmap { ...@@ -29,8 +29,8 @@ struct ceph_mdsmap {
/* which object pools file data can be stored in */ /* which object pools file data can be stored in */
int m_num_data_pg_pools; int m_num_data_pg_pools;
u32 *m_data_pg_pools; u64 *m_data_pg_pools;
u32 m_cas_pg_pool; u64 m_cas_pg_pool;
}; };
static inline struct ceph_entity_addr * static inline struct ceph_entity_addr *
......
...@@ -25,12 +25,22 @@ struct ceph_pg { ...@@ -25,12 +25,22 @@ struct ceph_pg {
struct ceph_pg_pool_info { struct ceph_pg_pool_info {
struct rb_node node; struct rb_node node;
int id; s64 id;
struct ceph_pg_pool v; u8 type;
int pg_num_mask, pgp_num_mask, lpg_num_mask, lpgp_num_mask; u8 size;
u8 crush_ruleset;
u8 object_hash;
u32 pg_num, pgp_num;
int pg_num_mask, pgp_num_mask;
u64 flags;
char *name; char *name;
}; };
struct ceph_object_locator {
uint64_t pool;
char *key;
};
struct ceph_pg_mapping { struct ceph_pg_mapping {
struct rb_node node; struct rb_node node;
struct ceph_pg pgid; struct ceph_pg pgid;
......
...@@ -8,14 +8,6 @@ ...@@ -8,14 +8,6 @@
#include <linux/ceph/msgr.h> #include <linux/ceph/msgr.h>
/*
* osdmap encoding versions
*/
#define CEPH_OSDMAP_INC_VERSION 5
#define CEPH_OSDMAP_INC_VERSION_EXT 6
#define CEPH_OSDMAP_VERSION 5
#define CEPH_OSDMAP_VERSION_EXT 6
/* /*
* fs id * fs id
*/ */
...@@ -91,21 +83,6 @@ struct ceph_pg_v1 { ...@@ -91,21 +83,6 @@ struct ceph_pg_v1 {
#define CEPH_PG_TYPE_REP 1 #define CEPH_PG_TYPE_REP 1
#define CEPH_PG_TYPE_RAID4 2 #define CEPH_PG_TYPE_RAID4 2
#define CEPH_PG_POOL_VERSION 2
struct ceph_pg_pool {
__u8 type; /* CEPH_PG_TYPE_* */
__u8 size; /* number of osds in each pg */
__u8 crush_ruleset; /* crush placement rule */
__u8 object_hash; /* hash mapping object name to ps */
__le32 pg_num, pgp_num; /* number of pg's */
__le32 lpg_num, lpgp_num; /* number of localized pg's */
__le32 last_change; /* most recent epoch changed */
__le64 snap_seq; /* seq for per-pool snapshot */
__le32 snap_epoch; /* epoch of last snap */
__le32 num_snaps;
__le32 num_removed_snap_intervals; /* if non-empty, NO per-pool snaps */
__le64 auid; /* who owns the pg */
} __attribute__ ((packed));
/* /*
* stable_mod func is used to control number of placement groups. * stable_mod func is used to control number of placement groups.
......
...@@ -601,10 +601,8 @@ static int __init init_ceph_lib(void) ...@@ -601,10 +601,8 @@ static int __init init_ceph_lib(void)
if (ret < 0) if (ret < 0)
goto out_crypto; goto out_crypto;
pr_info("loaded (mon/osd proto %d/%d, osdmap %d/%d %d/%d)\n", pr_info("loaded (mon/osd proto %d/%d)\n",
CEPH_MONC_PROTOCOL, CEPH_OSDC_PROTOCOL, CEPH_MONC_PROTOCOL, CEPH_OSDC_PROTOCOL);
CEPH_OSDMAP_VERSION, CEPH_OSDMAP_VERSION_EXT,
CEPH_OSDMAP_INC_VERSION, CEPH_OSDMAP_INC_VERSION_EXT);
return 0; return 0;
......
...@@ -66,9 +66,9 @@ static int osdmap_show(struct seq_file *s, void *p) ...@@ -66,9 +66,9 @@ static int osdmap_show(struct seq_file *s, void *p)
for (n = rb_first(&client->osdc.osdmap->pg_pools); n; n = rb_next(n)) { for (n = rb_first(&client->osdc.osdmap->pg_pools); n; n = rb_next(n)) {
struct ceph_pg_pool_info *pool = struct ceph_pg_pool_info *pool =
rb_entry(n, struct ceph_pg_pool_info, node); rb_entry(n, struct ceph_pg_pool_info, node);
seq_printf(s, "pg_pool %d pg_num %d / %d, lpg_num %d / %d\n", seq_printf(s, "pg_pool %llu pg_num %d / %d\n",
pool->id, pool->v.pg_num, pool->pg_num_mask, (unsigned long long)pool->id, pool->pg_num,
pool->v.lpg_num, pool->lpg_num_mask); pool->pg_num_mask);
} }
for (i = 0; i < client->osdc.osdmap->max_osd; i++) { for (i = 0; i < client->osdc.osdmap->max_osd; i++) {
struct ceph_entity_addr *addr = struct ceph_entity_addr *addr =
......
...@@ -45,13 +45,8 @@ static int calc_bits_of(unsigned int t) ...@@ -45,13 +45,8 @@ static int calc_bits_of(unsigned int t)
*/ */
static void calc_pg_masks(struct ceph_pg_pool_info *pi) static void calc_pg_masks(struct ceph_pg_pool_info *pi)
{ {
pi->pg_num_mask = (1 << calc_bits_of(le32_to_cpu(pi->v.pg_num)-1)) - 1; pi->pg_num_mask = (1 << calc_bits_of(pi->pg_num-1)) - 1;
pi->pgp_num_mask = pi->pgp_num_mask = (1 << calc_bits_of(pi->pgp_num-1)) - 1;
(1 << calc_bits_of(le32_to_cpu(pi->v.pgp_num)-1)) - 1;
pi->lpg_num_mask =
(1 << calc_bits_of(le32_to_cpu(pi->v.lpg_num)-1)) - 1;
pi->lpgp_num_mask =
(1 << calc_bits_of(le32_to_cpu(pi->v.lpgp_num)-1)) - 1;
} }
/* /*
...@@ -452,7 +447,7 @@ static int __insert_pg_pool(struct rb_root *root, struct ceph_pg_pool_info *new) ...@@ -452,7 +447,7 @@ static int __insert_pg_pool(struct rb_root *root, struct ceph_pg_pool_info *new)
return 0; return 0;
} }
static struct ceph_pg_pool_info *__lookup_pg_pool(struct rb_root *root, int id) static struct ceph_pg_pool_info *__lookup_pg_pool(struct rb_root *root, u64 id)
{ {
struct ceph_pg_pool_info *pi; struct ceph_pg_pool_info *pi;
struct rb_node *n = root->rb_node; struct rb_node *n = root->rb_node;
...@@ -508,24 +503,57 @@ static void __remove_pg_pool(struct rb_root *root, struct ceph_pg_pool_info *pi) ...@@ -508,24 +503,57 @@ static void __remove_pg_pool(struct rb_root *root, struct ceph_pg_pool_info *pi)
static int __decode_pool(void **p, void *end, struct ceph_pg_pool_info *pi) static int __decode_pool(void **p, void *end, struct ceph_pg_pool_info *pi)
{ {
unsigned int n, m; u8 ev, cv;
unsigned len, num;
void *pool_end;
ceph_decode_copy(p, &pi->v, sizeof(pi->v)); ceph_decode_need(p, end, 2 + 4, bad);
calc_pg_masks(pi); ev = ceph_decode_8(p); /* encoding version */
cv = ceph_decode_8(p); /* compat version */
if (ev < 5) {
pr_warning("got v %d < 5 cv %d of ceph_pg_pool\n", ev, cv);
return -EINVAL;
}
if (cv > 7) {
pr_warning("got v %d cv %d > 7 of ceph_pg_pool\n", ev, cv);
return -EINVAL;
}
len = ceph_decode_32(p);
ceph_decode_need(p, end, len, bad);
pool_end = *p + len;
pi->type = ceph_decode_8(p);
pi->size = ceph_decode_8(p);
pi->crush_ruleset = ceph_decode_8(p);
pi->object_hash = ceph_decode_8(p);
/* num_snaps * snap_info_t */ pi->pg_num = ceph_decode_32(p);
n = le32_to_cpu(pi->v.num_snaps); pi->pgp_num = ceph_decode_32(p);
while (n--) {
ceph_decode_need(p, end, sizeof(u64) + 1 + sizeof(u64) + *p += 4 + 4; /* skip lpg* */
sizeof(struct ceph_timespec), bad); *p += 4; /* skip last_change */
*p += sizeof(u64) + /* key */ *p += 8 + 4; /* skip snap_seq, snap_epoch */
1 + sizeof(u64) + /* u8, snapid */
sizeof(struct ceph_timespec); /* skip snaps */
m = ceph_decode_32(p); /* snap name */ num = ceph_decode_32(p);
*p += m; while (num--) {
*p += 8; /* snapid key */
*p += 1 + 1; /* versions */
len = ceph_decode_32(p);
*p += len;
} }
*p += le32_to_cpu(pi->v.num_removed_snap_intervals) * sizeof(u64) * 2; /* skip removed snaps */
num = ceph_decode_32(p);
*p += num * (8 + 8);
*p += 8; /* skip auid */
pi->flags = ceph_decode_64(p);
/* ignore the rest */
*p = pool_end;
calc_pg_masks(pi);
return 0; return 0;
bad: bad:
...@@ -535,14 +563,15 @@ static int __decode_pool(void **p, void *end, struct ceph_pg_pool_info *pi) ...@@ -535,14 +563,15 @@ static int __decode_pool(void **p, void *end, struct ceph_pg_pool_info *pi)
static int __decode_pool_names(void **p, void *end, struct ceph_osdmap *map) static int __decode_pool_names(void **p, void *end, struct ceph_osdmap *map)
{ {
struct ceph_pg_pool_info *pi; struct ceph_pg_pool_info *pi;
u32 num, len, pool; u32 num, len;
u64 pool;
ceph_decode_32_safe(p, end, num, bad); ceph_decode_32_safe(p, end, num, bad);
dout(" %d pool names\n", num); dout(" %d pool names\n", num);
while (num--) { while (num--) {
ceph_decode_32_safe(p, end, pool, bad); ceph_decode_64_safe(p, end, pool, bad);
ceph_decode_32_safe(p, end, len, bad); ceph_decode_32_safe(p, end, len, bad);
dout(" pool %d len %d\n", pool, len); dout(" pool %llu len %d\n", pool, len);
ceph_decode_need(p, end, len, bad); ceph_decode_need(p, end, len, bad);
pi = __lookup_pg_pool(&map->pg_pools, pool); pi = __lookup_pg_pool(&map->pg_pools, pool);
if (pi) { if (pi) {
...@@ -633,7 +662,6 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end) ...@@ -633,7 +662,6 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end)
struct ceph_osdmap *map; struct ceph_osdmap *map;
u16 version; u16 version;
u32 len, max, i; u32 len, max, i;
u8 ev;
int err = -EINVAL; int err = -EINVAL;
void *start = *p; void *start = *p;
struct ceph_pg_pool_info *pi; struct ceph_pg_pool_info *pi;
...@@ -646,9 +674,12 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end) ...@@ -646,9 +674,12 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end)
map->pg_temp = RB_ROOT; map->pg_temp = RB_ROOT;
ceph_decode_16_safe(p, end, version, bad); ceph_decode_16_safe(p, end, version, bad);
if (version > CEPH_OSDMAP_VERSION) { if (version > 6) {
pr_warning("got unknown v %d > %d of osdmap\n", version, pr_warning("got unknown v %d > 6 of osdmap\n", version);
CEPH_OSDMAP_VERSION); goto bad;
}
if (version < 6) {
pr_warning("got old v %d < 6 of osdmap\n", version);
goto bad; goto bad;
} }
...@@ -660,20 +691,12 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end) ...@@ -660,20 +691,12 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end)
ceph_decode_32_safe(p, end, max, bad); ceph_decode_32_safe(p, end, max, bad);
while (max--) { while (max--) {
ceph_decode_need(p, end, 4 + 1 + sizeof(pi->v), bad); ceph_decode_need(p, end, 8 + 2, bad);
err = -ENOMEM; err = -ENOMEM;
pi = kzalloc(sizeof(*pi), GFP_NOFS); pi = kzalloc(sizeof(*pi), GFP_NOFS);
if (!pi) if (!pi)
goto bad; goto bad;
pi->id = ceph_decode_32(p); pi->id = ceph_decode_64(p);
err = -EINVAL;
ev = ceph_decode_8(p); /* encoding version */
if (ev > CEPH_PG_POOL_VERSION) {
pr_warning("got unknown v %d > %d of ceph_pg_pool\n",
ev, CEPH_PG_POOL_VERSION);
kfree(pi);
goto bad;
}
err = __decode_pool(p, end, pi); err = __decode_pool(p, end, pi);
if (err < 0) { if (err < 0) {
kfree(pi); kfree(pi);
...@@ -682,13 +705,11 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end) ...@@ -682,13 +705,11 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end)
__insert_pg_pool(&map->pg_pools, pi); __insert_pg_pool(&map->pg_pools, pi);
} }
if (version >= 5) {
err = __decode_pool_names(p, end, map); err = __decode_pool_names(p, end, map);
if (err < 0) { if (err < 0) {
dout("fail to decode pool names"); dout("fail to decode pool names");
goto bad; goto bad;
} }
}
ceph_decode_32_safe(p, end, map->pool_max, bad); ceph_decode_32_safe(p, end, map->pool_max, bad);
...@@ -788,16 +809,17 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, ...@@ -788,16 +809,17 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
struct ceph_fsid fsid; struct ceph_fsid fsid;
u32 epoch = 0; u32 epoch = 0;
struct ceph_timespec modified; struct ceph_timespec modified;
u32 len, pool; s32 len;
__s32 new_pool_max, new_flags, max; u64 pool;
__s64 new_pool_max;
__s32 new_flags, max;
void *start = *p; void *start = *p;
int err = -EINVAL; int err = -EINVAL;
u16 version; u16 version;
ceph_decode_16_safe(p, end, version, bad); ceph_decode_16_safe(p, end, version, bad);
if (version > CEPH_OSDMAP_INC_VERSION) { if (version > 6) {
pr_warning("got unknown v %d > %d of inc osdmap\n", version, pr_warning("got unknown v %d > %d of inc osdmap\n", version, 6);
CEPH_OSDMAP_INC_VERSION);
goto bad; goto bad;
} }
...@@ -807,7 +829,7 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, ...@@ -807,7 +829,7 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
epoch = ceph_decode_32(p); epoch = ceph_decode_32(p);
BUG_ON(epoch != map->epoch+1); BUG_ON(epoch != map->epoch+1);
ceph_decode_copy(p, &modified, sizeof(modified)); ceph_decode_copy(p, &modified, sizeof(modified));
new_pool_max = ceph_decode_32(p); new_pool_max = ceph_decode_64(p);
new_flags = ceph_decode_32(p); new_flags = ceph_decode_32(p);
/* full map? */ /* full map? */
...@@ -857,18 +879,9 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, ...@@ -857,18 +879,9 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
/* new_pool */ /* new_pool */
ceph_decode_32_safe(p, end, len, bad); ceph_decode_32_safe(p, end, len, bad);
while (len--) { while (len--) {
__u8 ev;
struct ceph_pg_pool_info *pi; struct ceph_pg_pool_info *pi;
ceph_decode_32_safe(p, end, pool, bad); ceph_decode_64_safe(p, end, pool, bad);
ceph_decode_need(p, end, 1 + sizeof(pi->v), bad);
ev = ceph_decode_8(p); /* encoding version */
if (ev > CEPH_PG_POOL_VERSION) {
pr_warning("got unknown v %d > %d of ceph_pg_pool\n",
ev, CEPH_PG_POOL_VERSION);
err = -EINVAL;
goto bad;
}
pi = __lookup_pg_pool(&map->pg_pools, pool); pi = __lookup_pg_pool(&map->pg_pools, pool);
if (!pi) { if (!pi) {
pi = kzalloc(sizeof(*pi), GFP_NOFS); pi = kzalloc(sizeof(*pi), GFP_NOFS);
...@@ -894,7 +907,7 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, ...@@ -894,7 +907,7 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
while (len--) { while (len--) {
struct ceph_pg_pool_info *pi; struct ceph_pg_pool_info *pi;
ceph_decode_32_safe(p, end, pool, bad); ceph_decode_64_safe(p, end, pool, bad);
pi = __lookup_pg_pool(&map->pg_pools, pool); pi = __lookup_pg_pool(&map->pg_pools, pool);
if (pi) if (pi)
__remove_pg_pool(&map->pg_pools, pi); __remove_pg_pool(&map->pg_pools, pi);
...@@ -1097,8 +1110,8 @@ int ceph_calc_object_layout(struct ceph_object_layout *ol, ...@@ -1097,8 +1110,8 @@ int ceph_calc_object_layout(struct ceph_object_layout *ol,
pool = __lookup_pg_pool(&osdmap->pg_pools, pgid.pool); pool = __lookup_pg_pool(&osdmap->pg_pools, pgid.pool);
if (!pool) if (!pool)
return -EIO; return -EIO;
pgid.seed = ceph_str_hash(pool->v.object_hash, oid, strlen(oid)); pgid.seed = ceph_str_hash(pool->object_hash, oid, strlen(oid));
num = le32_to_cpu(pool->v.pg_num); num = pool->pg_num;
num_mask = pool->pg_num_mask; num_mask = pool->pg_num_mask;
dout("calc_object_layout '%s' pgid %lld.%x\n", oid, pgid.pool, dout("calc_object_layout '%s' pgid %lld.%x\n", oid, pgid.pool,
...@@ -1132,8 +1145,7 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid, ...@@ -1132,8 +1145,7 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
return NULL; return NULL;
/* pg_temp? */ /* pg_temp? */
t = ceph_stable_mod(ps, le32_to_cpu(pool->v.pg_num), t = ceph_stable_mod(ps, pool->pg_num, pool->pgp_num_mask);
pool->pgp_num_mask);
pgid.seed = t; pgid.seed = t;
pg = __lookup_pg_mapping(&osdmap->pg_temp, pgid); pg = __lookup_pg_mapping(&osdmap->pg_temp, pgid);
if (pg) { if (pg) {
...@@ -1142,26 +1154,24 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid, ...@@ -1142,26 +1154,24 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
} }
/* crush */ /* crush */
ruleno = crush_find_rule(osdmap->crush, pool->v.crush_ruleset, ruleno = crush_find_rule(osdmap->crush, pool->crush_ruleset,
pool->v.type, pool->v.size); pool->type, pool->size);
if (ruleno < 0) { if (ruleno < 0) {
pr_err("no crush rule pool %d ruleset %d type %d size %d\n", pr_err("no crush rule pool %d ruleset %d type %d size %d\n",
poolid, pool->v.crush_ruleset, pool->v.type, poolid, pool->crush_ruleset, pool->type,
pool->v.size); pool->size);
return NULL; return NULL;
} }
pps = ceph_stable_mod(ps, pps = ceph_stable_mod(ps, pool->pgp_num, pool->pgp_num_mask);
le32_to_cpu(pool->v.pgp_num),
pool->pgp_num_mask);
pps += poolid; pps += poolid;
r = crush_do_rule(osdmap->crush, ruleno, pps, osds, r = crush_do_rule(osdmap->crush, ruleno, pps, osds,
min_t(int, pool->v.size, *num), min_t(int, pool->size, *num),
osdmap->osd_weight); osdmap->osd_weight);
if (r < 0) { if (r < 0) {
pr_err("error %d from crush rule: pool %d ruleset %d type %d" pr_err("error %d from crush rule: pool %d ruleset %d type %d"
" size %d\n", r, poolid, pool->v.crush_ruleset, " size %d\n", r, poolid, pool->crush_ruleset,
pool->v.type, pool->v.size); pool->type, pool->size);
return NULL; return NULL;
} }
*num = r; *num = r;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment