Skip to content

Commit

Permalink
crush: warn on do_rule failure
Browse files Browse the repository at this point in the history
If we get an error code from crush_do_rule(), print an error to the
console.

Reviewed-by: Alex Elder <elder@inktank.com>
Signed-off-by: Sage Weil <sage@inktank.com>
  • Loading branch information
Sage Weil committed May 7, 2012
1 parent 6eb43f4 commit 8b39326
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions net/ceph/osdmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
struct ceph_pg_mapping *pg;
struct ceph_pg_pool_info *pool;
int ruleno;
unsigned poolid, ps, pps, t;
unsigned poolid, ps, pps, t, r;

poolid = le32_to_cpu(pgid.pool);
ps = le16_to_cpu(pgid.ps);
Expand Down Expand Up @@ -1060,9 +1060,16 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
le32_to_cpu(pool->v.pgp_num),
pool->pgp_num_mask);
pps += poolid;
*num = crush_do_rule(osdmap->crush, ruleno, pps, osds,
min_t(int, pool->v.size, *num),
osdmap->osd_weight);
r = crush_do_rule(osdmap->crush, ruleno, pps, osds,
min_t(int, pool->v.size, *num),
osdmap->osd_weight);
if (r < 0) {
pr_err("error %d from crush rule: pool %d ruleset %d type %d"
" size %d\n", r, poolid, pool->v.crush_ruleset,
pool->v.type, pool->v.size);
return NULL;
}
*num = r;
return osds;
}

Expand Down

0 comments on commit 8b39326

Please sign in to comment.