aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2012-05-07 18:37:23 -0400
committerSage Weil <sage@inktank.com>2012-05-07 18:39:37 -0400
commit8b393269008411a612ca549b733b4296e819f2fb (patch)
tree0c6977cd34d1d818234765c48f0b6ce31ca39707 /net
parent6eb43f4b5a2a74599b4ff17a97c03a342327ca65 (diff)
crush: warn on do_rule failure
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>
Diffstat (limited to 'net')
-rw-r--r--net/ceph/osdmap.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
index dac448ba68e4..2592f3cca987 100644
--- a/net/ceph/osdmap.c
+++ b/net/ceph/osdmap.c
@@ -1027,7 +1027,7 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
1027 struct ceph_pg_mapping *pg; 1027 struct ceph_pg_mapping *pg;
1028 struct ceph_pg_pool_info *pool; 1028 struct ceph_pg_pool_info *pool;
1029 int ruleno; 1029 int ruleno;
1030 unsigned poolid, ps, pps, t; 1030 unsigned poolid, ps, pps, t, r;
1031 1031
1032 poolid = le32_to_cpu(pgid.pool); 1032 poolid = le32_to_cpu(pgid.pool);
1033 ps = le16_to_cpu(pgid.ps); 1033 ps = le16_to_cpu(pgid.ps);
@@ -1060,9 +1060,16 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
1060 le32_to_cpu(pool->v.pgp_num), 1060 le32_to_cpu(pool->v.pgp_num),
1061 pool->pgp_num_mask); 1061 pool->pgp_num_mask);
1062 pps += poolid; 1062 pps += poolid;
1063 *num = crush_do_rule(osdmap->crush, ruleno, pps, osds, 1063 r = crush_do_rule(osdmap->crush, ruleno, pps, osds,
1064 min_t(int, pool->v.size, *num), 1064 min_t(int, pool->v.size, *num),
1065 osdmap->osd_weight); 1065 osdmap->osd_weight);
1066 if (r < 0) {
1067 pr_err("error %d from crush rule: pool %d ruleset %d type %d"
1068 " size %d\n", r, poolid, pool->v.crush_ruleset,
1069 pool->v.type, pool->v.size);
1070 return NULL;
1071 }
1072 *num = r;
1066 return osds; 1073 return osds;
1067} 1074}
1068 1075