• Home
  • Raw
  • Download

Lines Matching refs:map

15 void osdmap_info(const struct ceph_osdmap *map, const char *fmt, ...)  in osdmap_info()  argument
24 printk(KERN_INFO "%s (%pU e%u): %pV", KBUILD_MODNAME, &map->fsid, in osdmap_info()
25 map->epoch, &vaf); in osdmap_info()
738 struct ceph_pg_pool_info *ceph_pg_pool_by_id(struct ceph_osdmap *map, u64 id) in DEFINE_RB_FUNCS2()
740 return lookup_pg_pool(&map->pg_pools, id); in DEFINE_RB_FUNCS2()
743 const char *ceph_pg_pool_name_by_id(struct ceph_osdmap *map, u64 id) in ceph_pg_pool_name_by_id() argument
753 pi = lookup_pg_pool(&map->pg_pools, id); in ceph_pg_pool_name_by_id()
758 int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name) in ceph_pg_poolid_by_name() argument
762 for (rbp = rb_first(&map->pg_pools); rbp; rbp = rb_next(rbp)) { in ceph_pg_poolid_by_name()
772 u64 ceph_pg_pool_flags(struct ceph_osdmap *map, u64 id) in ceph_pg_pool_flags() argument
776 pi = lookup_pg_pool(&map->pg_pools, id); in ceph_pg_pool_flags()
952 static int decode_pool_names(void **p, void *end, struct ceph_osdmap *map) in decode_pool_names() argument
965 pi = lookup_pg_pool(&map->pg_pools, pool); in decode_pool_names()
1125 struct ceph_osdmap *map; in ceph_osdmap_alloc() local
1127 map = kzalloc(sizeof(*map), GFP_NOIO); in ceph_osdmap_alloc()
1128 if (!map) in ceph_osdmap_alloc()
1131 map->pg_pools = RB_ROOT; in ceph_osdmap_alloc()
1132 map->pool_max = -1; in ceph_osdmap_alloc()
1133 map->pg_temp = RB_ROOT; in ceph_osdmap_alloc()
1134 map->primary_temp = RB_ROOT; in ceph_osdmap_alloc()
1135 map->pg_upmap = RB_ROOT; in ceph_osdmap_alloc()
1136 map->pg_upmap_items = RB_ROOT; in ceph_osdmap_alloc()
1138 init_workspace_manager(&map->crush_wsm); in ceph_osdmap_alloc()
1140 return map; in ceph_osdmap_alloc()
1143 void ceph_osdmap_destroy(struct ceph_osdmap *map) in ceph_osdmap_destroy() argument
1145 dout("osdmap_destroy %p\n", map); in ceph_osdmap_destroy()
1147 if (map->crush) in ceph_osdmap_destroy()
1148 crush_destroy(map->crush); in ceph_osdmap_destroy()
1149 cleanup_workspace_manager(&map->crush_wsm); in ceph_osdmap_destroy()
1151 while (!RB_EMPTY_ROOT(&map->pg_temp)) { in ceph_osdmap_destroy()
1153 rb_entry(rb_first(&map->pg_temp), in ceph_osdmap_destroy()
1155 erase_pg_mapping(&map->pg_temp, pg); in ceph_osdmap_destroy()
1158 while (!RB_EMPTY_ROOT(&map->primary_temp)) { in ceph_osdmap_destroy()
1160 rb_entry(rb_first(&map->primary_temp), in ceph_osdmap_destroy()
1162 erase_pg_mapping(&map->primary_temp, pg); in ceph_osdmap_destroy()
1165 while (!RB_EMPTY_ROOT(&map->pg_upmap)) { in ceph_osdmap_destroy()
1167 rb_entry(rb_first(&map->pg_upmap), in ceph_osdmap_destroy()
1169 rb_erase(&pg->node, &map->pg_upmap); in ceph_osdmap_destroy()
1172 while (!RB_EMPTY_ROOT(&map->pg_upmap_items)) { in ceph_osdmap_destroy()
1174 rb_entry(rb_first(&map->pg_upmap_items), in ceph_osdmap_destroy()
1176 rb_erase(&pg->node, &map->pg_upmap_items); in ceph_osdmap_destroy()
1179 while (!RB_EMPTY_ROOT(&map->pg_pools)) { in ceph_osdmap_destroy()
1181 rb_entry(rb_first(&map->pg_pools), in ceph_osdmap_destroy()
1183 __remove_pg_pool(&map->pg_pools, pi); in ceph_osdmap_destroy()
1185 kvfree(map->osd_state); in ceph_osdmap_destroy()
1186 kvfree(map->osd_weight); in ceph_osdmap_destroy()
1187 kvfree(map->osd_addr); in ceph_osdmap_destroy()
1188 kvfree(map->osd_primary_affinity); in ceph_osdmap_destroy()
1189 kfree(map); in ceph_osdmap_destroy()
1197 static int osdmap_set_max_osd(struct ceph_osdmap *map, u32 max) in osdmap_set_max_osd() argument
1205 dout("%s old %u new %u\n", __func__, map->max_osd, max); in osdmap_set_max_osd()
1206 if (max == map->max_osd) in osdmap_set_max_osd()
1219 to_copy = min(map->max_osd, max); in osdmap_set_max_osd()
1220 if (map->osd_state) { in osdmap_set_max_osd()
1221 memcpy(state, map->osd_state, to_copy * sizeof(*state)); in osdmap_set_max_osd()
1222 memcpy(weight, map->osd_weight, to_copy * sizeof(*weight)); in osdmap_set_max_osd()
1223 memcpy(addr, map->osd_addr, to_copy * sizeof(*addr)); in osdmap_set_max_osd()
1224 kvfree(map->osd_state); in osdmap_set_max_osd()
1225 kvfree(map->osd_weight); in osdmap_set_max_osd()
1226 kvfree(map->osd_addr); in osdmap_set_max_osd()
1229 map->osd_state = state; in osdmap_set_max_osd()
1230 map->osd_weight = weight; in osdmap_set_max_osd()
1231 map->osd_addr = addr; in osdmap_set_max_osd()
1232 for (i = map->max_osd; i < max; i++) { in osdmap_set_max_osd()
1233 map->osd_state[i] = 0; in osdmap_set_max_osd()
1234 map->osd_weight[i] = CEPH_OSD_OUT; in osdmap_set_max_osd()
1235 memset(map->osd_addr + i, 0, sizeof(*map->osd_addr)); in osdmap_set_max_osd()
1238 if (map->osd_primary_affinity) { in osdmap_set_max_osd()
1246 memcpy(affinity, map->osd_primary_affinity, in osdmap_set_max_osd()
1248 kvfree(map->osd_primary_affinity); in osdmap_set_max_osd()
1250 map->osd_primary_affinity = affinity; in osdmap_set_max_osd()
1251 for (i = map->max_osd; i < max; i++) in osdmap_set_max_osd()
1252 map->osd_primary_affinity[i] = in osdmap_set_max_osd()
1256 map->max_osd = max; in osdmap_set_max_osd()
1261 static int osdmap_set_crush(struct ceph_osdmap *map, struct crush_map *crush) in osdmap_set_crush() argument
1274 if (map->crush) in osdmap_set_crush()
1275 crush_destroy(map->crush); in osdmap_set_crush()
1276 cleanup_workspace_manager(&map->crush_wsm); in osdmap_set_crush()
1277 map->crush = crush; in osdmap_set_crush()
1278 add_initial_workspace(&map->crush_wsm, work); in osdmap_set_crush()
1339 static int __decode_pools(void **p, void *end, struct ceph_osdmap *map, in __decode_pools() argument
1352 pi = lookup_pg_pool(&map->pg_pools, pool); in __decode_pools()
1361 if (!__insert_pg_pool(&map->pg_pools, pi)) { in __decode_pools()
1378 static int decode_pools(void **p, void *end, struct ceph_osdmap *map) in decode_pools() argument
1380 return __decode_pools(p, end, map, false); in decode_pools()
1383 static int decode_new_pools(void **p, void *end, struct ceph_osdmap *map) in decode_new_pools() argument
1385 return __decode_pools(p, end, map, true); in decode_new_pools()
1459 static int decode_pg_temp(void **p, void *end, struct ceph_osdmap *map) in decode_pg_temp() argument
1461 return decode_pg_mapping(p, end, &map->pg_temp, __decode_pg_temp, in decode_pg_temp()
1465 static int decode_new_pg_temp(void **p, void *end, struct ceph_osdmap *map) in decode_new_pg_temp() argument
1467 return decode_pg_mapping(p, end, &map->pg_temp, __decode_pg_temp, in decode_new_pg_temp()
1492 static int decode_primary_temp(void **p, void *end, struct ceph_osdmap *map) in decode_primary_temp() argument
1494 return decode_pg_mapping(p, end, &map->primary_temp, in decode_primary_temp()
1499 struct ceph_osdmap *map) in decode_new_primary_temp() argument
1501 return decode_pg_mapping(p, end, &map->primary_temp, in decode_new_primary_temp()
1505 u32 ceph_get_primary_affinity(struct ceph_osdmap *map, int osd) in ceph_get_primary_affinity() argument
1507 BUG_ON(osd >= map->max_osd); in ceph_get_primary_affinity()
1509 if (!map->osd_primary_affinity) in ceph_get_primary_affinity()
1512 return map->osd_primary_affinity[osd]; in ceph_get_primary_affinity()
1515 static int set_primary_affinity(struct ceph_osdmap *map, int osd, u32 aff) in set_primary_affinity() argument
1517 BUG_ON(osd >= map->max_osd); in set_primary_affinity()
1519 if (!map->osd_primary_affinity) { in set_primary_affinity()
1522 map->osd_primary_affinity = kvmalloc( in set_primary_affinity()
1523 array_size(map->max_osd, sizeof(*map->osd_primary_affinity)), in set_primary_affinity()
1525 if (!map->osd_primary_affinity) in set_primary_affinity()
1528 for (i = 0; i < map->max_osd; i++) in set_primary_affinity()
1529 map->osd_primary_affinity[i] = in set_primary_affinity()
1533 map->osd_primary_affinity[osd] = aff; in set_primary_affinity()
1539 struct ceph_osdmap *map) in decode_primary_affinity() argument
1545 kvfree(map->osd_primary_affinity); in decode_primary_affinity()
1546 map->osd_primary_affinity = NULL; in decode_primary_affinity()
1549 if (len != map->max_osd) in decode_primary_affinity()
1552 ceph_decode_need(p, end, map->max_osd*sizeof(u32), e_inval); in decode_primary_affinity()
1554 for (i = 0; i < map->max_osd; i++) { in decode_primary_affinity()
1557 ret = set_primary_affinity(map, i, ceph_decode_32(p)); in decode_primary_affinity()
1569 struct ceph_osdmap *map) in decode_new_primary_affinity() argument
1581 ret = set_primary_affinity(map, osd, aff); in decode_new_primary_affinity()
1585 osdmap_info(map, "osd%d primary-affinity 0x%x\n", osd, aff); in decode_new_primary_affinity()
1600 static int decode_pg_upmap(void **p, void *end, struct ceph_osdmap *map) in decode_pg_upmap() argument
1602 return decode_pg_mapping(p, end, &map->pg_upmap, __decode_pg_upmap, in decode_pg_upmap()
1606 static int decode_new_pg_upmap(void **p, void *end, struct ceph_osdmap *map) in decode_new_pg_upmap() argument
1608 return decode_pg_mapping(p, end, &map->pg_upmap, __decode_pg_upmap, in decode_new_pg_upmap()
1612 static int decode_old_pg_upmap(void **p, void *end, struct ceph_osdmap *map) in decode_old_pg_upmap() argument
1614 return decode_pg_mapping(p, end, &map->pg_upmap, NULL, true); in decode_old_pg_upmap()
1644 static int decode_pg_upmap_items(void **p, void *end, struct ceph_osdmap *map) in decode_pg_upmap_items() argument
1646 return decode_pg_mapping(p, end, &map->pg_upmap_items, in decode_pg_upmap_items()
1651 struct ceph_osdmap *map) in decode_new_pg_upmap_items() argument
1653 return decode_pg_mapping(p, end, &map->pg_upmap_items, in decode_new_pg_upmap_items()
1658 struct ceph_osdmap *map) in decode_old_pg_upmap_items() argument
1660 return decode_pg_mapping(p, end, &map->pg_upmap_items, NULL, true); in decode_old_pg_upmap_items()
1667 struct ceph_osdmap *map) in osdmap_decode() argument
1683 ceph_decode_need(p, end, sizeof(map->fsid) + sizeof(u32) + in osdmap_decode()
1684 sizeof(map->created) + sizeof(map->modified), e_inval); in osdmap_decode()
1685 ceph_decode_copy(p, &map->fsid, sizeof(map->fsid)); in osdmap_decode()
1686 epoch = map->epoch = ceph_decode_32(p); in osdmap_decode()
1687 ceph_decode_copy(p, &map->created, sizeof(map->created)); in osdmap_decode()
1688 ceph_decode_copy(p, &map->modified, sizeof(map->modified)); in osdmap_decode()
1691 err = decode_pools(p, end, map); in osdmap_decode()
1696 err = decode_pool_names(p, end, map); in osdmap_decode()
1700 ceph_decode_32_safe(p, end, map->pool_max, e_inval); in osdmap_decode()
1702 ceph_decode_32_safe(p, end, map->flags, e_inval); in osdmap_decode()
1708 err = osdmap_set_max_osd(map, max); in osdmap_decode()
1714 map->max_osd*(struct_v >= 5 ? sizeof(u32) : in osdmap_decode()
1716 sizeof(*map->osd_weight), e_inval); in osdmap_decode()
1717 if (ceph_decode_32(p) != map->max_osd) in osdmap_decode()
1721 for (i = 0; i < map->max_osd; i++) in osdmap_decode()
1722 map->osd_state[i] = ceph_decode_32(p); in osdmap_decode()
1724 for (i = 0; i < map->max_osd; i++) in osdmap_decode()
1725 map->osd_state[i] = ceph_decode_8(p); in osdmap_decode()
1728 if (ceph_decode_32(p) != map->max_osd) in osdmap_decode()
1731 for (i = 0; i < map->max_osd; i++) in osdmap_decode()
1732 map->osd_weight[i] = ceph_decode_32(p); in osdmap_decode()
1734 if (ceph_decode_32(p) != map->max_osd) in osdmap_decode()
1737 for (i = 0; i < map->max_osd; i++) { in osdmap_decode()
1738 struct ceph_entity_addr *addr = &map->osd_addr[i]; in osdmap_decode()
1751 err = decode_pg_temp(p, end, map); in osdmap_decode()
1757 err = decode_primary_temp(p, end, map); in osdmap_decode()
1764 err = decode_primary_affinity(p, end, map); in osdmap_decode()
1768 WARN_ON(map->osd_primary_affinity); in osdmap_decode()
1773 err = osdmap_set_crush(map, crush_decode(*p, min(*p + len, end))); in osdmap_decode()
1785 err = decode_pg_upmap(p, end, map); in osdmap_decode()
1789 err = decode_pg_upmap_items(p, end, map); in osdmap_decode()
1793 WARN_ON(!RB_EMPTY_ROOT(&map->pg_upmap)); in osdmap_decode()
1794 WARN_ON(!RB_EMPTY_ROOT(&map->pg_upmap_items)); in osdmap_decode()
1800 dout("full osdmap epoch %d max_osd %d\n", map->epoch, map->max_osd); in osdmap_decode()
1819 struct ceph_osdmap *map; in ceph_osdmap_decode() local
1822 map = ceph_osdmap_alloc(); in ceph_osdmap_decode()
1823 if (!map) in ceph_osdmap_decode()
1826 ret = osdmap_decode(p, end, msgr2, map); in ceph_osdmap_decode()
1828 ceph_osdmap_destroy(map); in ceph_osdmap_decode()
1832 return map; in ceph_osdmap_decode()
1844 bool msgr2, struct ceph_osdmap *map) in decode_new_up_state_weight() argument
1882 BUG_ON(osd >= map->max_osd); in decode_new_up_state_weight()
1883 osdmap_info(map, "osd%d weight 0x%x %s\n", osd, w, in decode_new_up_state_weight()
1886 map->osd_weight[osd] = w; in decode_new_up_state_weight()
1893 map->osd_state[osd] |= CEPH_OSD_EXISTS; in decode_new_up_state_weight()
1894 map->osd_state[osd] &= ~(CEPH_OSD_AUTOOUT | in decode_new_up_state_weight()
1914 BUG_ON(osd >= map->max_osd); in decode_new_up_state_weight()
1915 if ((map->osd_state[osd] & CEPH_OSD_UP) && in decode_new_up_state_weight()
1917 osdmap_info(map, "osd%d down\n", osd); in decode_new_up_state_weight()
1918 if ((map->osd_state[osd] & CEPH_OSD_EXISTS) && in decode_new_up_state_weight()
1920 osdmap_info(map, "osd%d does not exist\n", osd); in decode_new_up_state_weight()
1921 ret = set_primary_affinity(map, osd, in decode_new_up_state_weight()
1925 memset(map->osd_addr + osd, 0, sizeof(*map->osd_addr)); in decode_new_up_state_weight()
1926 map->osd_state[osd] = 0; in decode_new_up_state_weight()
1928 map->osd_state[osd] ^= xorstate; in decode_new_up_state_weight()
1940 BUG_ON(osd >= map->max_osd); in decode_new_up_state_weight()
1950 osdmap_info(map, "osd%d up\n", osd); in decode_new_up_state_weight()
1951 map->osd_state[osd] |= CEPH_OSD_EXISTS | CEPH_OSD_UP; in decode_new_up_state_weight()
1952 map->osd_addr[osd] = addr; in decode_new_up_state_weight()
1966 struct ceph_osdmap *map) in osdmap_apply_incremental() argument
1990 BUG_ON(epoch != map->epoch+1); in osdmap_apply_incremental()
2006 err = osdmap_set_crush(map, in osdmap_apply_incremental()
2015 map->flags = new_flags; in osdmap_apply_incremental()
2017 map->pool_max = new_pool_max; in osdmap_apply_incremental()
2022 err = osdmap_set_max_osd(map, max); in osdmap_apply_incremental()
2027 map->epoch++; in osdmap_apply_incremental()
2028 map->modified = modified; in osdmap_apply_incremental()
2031 err = decode_new_pools(p, end, map); in osdmap_apply_incremental()
2036 err = decode_pool_names(p, end, map); in osdmap_apply_incremental()
2046 pi = lookup_pg_pool(&map->pg_pools, pool); in osdmap_apply_incremental()
2048 __remove_pg_pool(&map->pg_pools, pi); in osdmap_apply_incremental()
2052 err = decode_new_up_state_weight(p, end, struct_v, msgr2, map); in osdmap_apply_incremental()
2057 err = decode_new_pg_temp(p, end, map); in osdmap_apply_incremental()
2063 err = decode_new_primary_temp(p, end, map); in osdmap_apply_incremental()
2070 err = decode_new_primary_affinity(p, end, map); in osdmap_apply_incremental()
2084 err = decode_new_pg_upmap(p, end, map); in osdmap_apply_incremental()
2088 err = decode_old_pg_upmap(p, end, map); in osdmap_apply_incremental()
2092 err = decode_new_pg_upmap_items(p, end, map); in osdmap_apply_incremental()
2096 err = decode_old_pg_upmap_items(p, end, map); in osdmap_apply_incremental()
2104 dout("inc osdmap epoch %d max_osd %d\n", map->epoch, map->max_osd); in osdmap_apply_incremental()
2105 return map; in osdmap_apply_incremental()
2490 static int do_crush(struct ceph_osdmap *map, int ruleno, int x, in do_crush() argument
2501 arg_map = lookup_choose_arg_map(&map->crush->choose_args, in do_crush()
2504 arg_map = lookup_choose_arg_map(&map->crush->choose_args, in do_crush()
2507 work = get_workspace(&map->crush_wsm, map->crush); in do_crush()
2508 r = crush_do_rule(map->crush, ruleno, x, result, result_max, in do_crush()
2511 put_workspace(&map->crush_wsm, work); in do_crush()