diff options
| -rw-r--r-- | include/linux/crush/crush.h | 2 | ||||
| -rw-r--r-- | net/ceph/osdmap.c | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/include/linux/crush/crush.h b/include/linux/crush/crush.h index 92e165d417a6..07eed95e10c7 100644 --- a/include/linux/crush/crush.h +++ b/include/linux/crush/crush.h | |||
| @@ -193,7 +193,7 @@ struct crush_choose_arg { | |||
| 193 | struct crush_choose_arg_map { | 193 | struct crush_choose_arg_map { |
| 194 | #ifdef __KERNEL__ | 194 | #ifdef __KERNEL__ |
| 195 | struct rb_node node; | 195 | struct rb_node node; |
| 196 | u64 choose_args_index; | 196 | s64 choose_args_index; |
| 197 | #endif | 197 | #endif |
| 198 | struct crush_choose_arg *args; /*!< replacement for each bucket | 198 | struct crush_choose_arg *args; /*!< replacement for each bucket |
| 199 | in the crushmap */ | 199 | in the crushmap */ |
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index 64ae9f89773a..eb57a06373ca 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c | |||
| @@ -2301,10 +2301,17 @@ static u32 raw_pg_to_pps(struct ceph_pg_pool_info *pi, | |||
| 2301 | } | 2301 | } |
| 2302 | } | 2302 | } |
| 2303 | 2303 | ||
| 2304 | /* | ||
| 2305 | * Magic value used for a "default" fallback choose_args, used if the | ||
| 2306 | * crush_choose_arg_map passed to do_crush() does not exist. If this | ||
| 2307 | * also doesn't exist, fall back to canonical weights. | ||
| 2308 | */ | ||
| 2309 | #define CEPH_DEFAULT_CHOOSE_ARGS -1 | ||
| 2310 | |||
| 2304 | static int do_crush(struct ceph_osdmap *map, int ruleno, int x, | 2311 | static int do_crush(struct ceph_osdmap *map, int ruleno, int x, |
| 2305 | int *result, int result_max, | 2312 | int *result, int result_max, |
| 2306 | const __u32 *weight, int weight_max, | 2313 | const __u32 *weight, int weight_max, |
| 2307 | u64 choose_args_index) | 2314 | s64 choose_args_index) |
| 2308 | { | 2315 | { |
| 2309 | struct crush_choose_arg_map *arg_map; | 2316 | struct crush_choose_arg_map *arg_map; |
| 2310 | int r; | 2317 | int r; |
| @@ -2313,6 +2320,9 @@ static int do_crush(struct ceph_osdmap *map, int ruleno, int x, | |||
| 2313 | 2320 | ||
| 2314 | arg_map = lookup_choose_arg_map(&map->crush->choose_args, | 2321 | arg_map = lookup_choose_arg_map(&map->crush->choose_args, |
| 2315 | choose_args_index); | 2322 | choose_args_index); |
| 2323 | if (!arg_map) | ||
| 2324 | arg_map = lookup_choose_arg_map(&map->crush->choose_args, | ||
| 2325 | CEPH_DEFAULT_CHOOSE_ARGS); | ||
| 2316 | 2326 | ||
| 2317 | mutex_lock(&map->crush_workspace_mutex); | 2327 | mutex_lock(&map->crush_workspace_mutex); |
| 2318 | r = crush_do_rule(map->crush, ruleno, x, result, result_max, | 2328 | r = crush_do_rule(map->crush, ruleno, x, result, result_max, |
