Lines Matching refs:entry
121 bdev_rbd_cluster_free(struct bdev_rbd_cluster *entry) in bdev_rbd_cluster_free() argument
123 assert(entry != NULL); in bdev_rbd_cluster_free()
125 bdev_rbd_free_config(entry->config_param); in bdev_rbd_cluster_free()
126 free(entry->config_file); in bdev_rbd_cluster_free()
127 free(entry->key_file); in bdev_rbd_cluster_free()
128 free(entry->user_id); in bdev_rbd_cluster_free()
129 free(entry->name); in bdev_rbd_cluster_free()
130 free(entry->core_mask); in bdev_rbd_cluster_free()
131 free(entry); in bdev_rbd_cluster_free()
137 struct bdev_rbd_cluster *entry; in bdev_rbd_put_cluster() local
147 STAILQ_FOREACH(entry, &g_map_bdev_rbd_cluster, link) { in bdev_rbd_put_cluster()
148 if (*cluster != &entry->cluster) { in bdev_rbd_put_cluster()
152 assert(entry->ref > 0); in bdev_rbd_put_cluster()
153 entry->ref--; in bdev_rbd_put_cluster()
164 bdev_rbd_put_pool_ctx(struct bdev_rbd_pool_ctx *entry) in bdev_rbd_put_pool_ctx() argument
168 assert(entry != NULL); in bdev_rbd_put_pool_ctx()
169 assert(entry->ref > 0); in bdev_rbd_put_pool_ctx()
170 entry->ref--; in bdev_rbd_put_pool_ctx()
171 if (entry->ref == 0) { in bdev_rbd_put_pool_ctx()
172 STAILQ_REMOVE(&g_map_bdev_rbd_pool_ctx, entry, bdev_rbd_pool_ctx, link); in bdev_rbd_put_pool_ctx()
173 rados_ioctx_destroy(entry->io_ctx); in bdev_rbd_put_pool_ctx()
174 free(entry->name); in bdev_rbd_put_pool_ctx()
175 free(entry); in bdev_rbd_put_pool_ctx()
222 char **entry; in bdev_rbd_free_config() local
225 for (entry = config; *entry; entry++) { in bdev_rbd_free_config()
226 free(*entry); in bdev_rbd_free_config()
268 const char *const *entry = config; in bdev_rados_cluster_init() local
269 while (*entry) { in bdev_rados_cluster_init()
270 ret = rados_conf_set(*cluster, entry[0], entry[1]); in bdev_rados_cluster_init()
272 SPDK_ERRLOG("Failed to set %s = %s\n", entry[0], entry[1]); in bdev_rados_cluster_init()
277 entry += 2; in bdev_rados_cluster_init()
303 struct bdev_rbd_cluster *entry; in bdev_rbd_get_cluster() local
311 STAILQ_FOREACH(entry, &g_map_bdev_rbd_cluster, link) { in bdev_rbd_get_cluster()
312 if (strcmp(cluster_name, entry->name) == 0) { in bdev_rbd_get_cluster()
313 entry->ref++; in bdev_rbd_get_cluster()
314 *cluster = &entry->cluster; in bdev_rbd_get_cluster()
359 struct bdev_rbd_pool_ctx *entry; in bdev_rbd_get_pool_ctx() local
367 STAILQ_FOREACH(entry, &g_map_bdev_rbd_pool_ctx, link) { in bdev_rbd_get_pool_ctx()
368 if (strcmp(name, entry->name) == 0 && cluster_p == entry->cluster_p) { in bdev_rbd_get_pool_ctx()
369 entry->ref++; in bdev_rbd_get_pool_ctx()
370 *ctx = entry; in bdev_rbd_get_pool_ctx()
375 entry = calloc(1, sizeof(*entry)); in bdev_rbd_get_pool_ctx()
376 if (!entry) { in bdev_rbd_get_pool_ctx()
381 entry->name = strdup(name); in bdev_rbd_get_pool_ctx()
382 if (entry->name == NULL) { in bdev_rbd_get_pool_ctx()
383 SPDK_ERRLOG("Failed to allocate the name =%s space on entry =%p\n", name, entry); in bdev_rbd_get_pool_ctx()
387 if (rados_ioctx_create(*cluster_p, name, &entry->io_ctx) < 0) { in bdev_rbd_get_pool_ctx()
391 entry->cluster_p = cluster_p; in bdev_rbd_get_pool_ctx()
392 entry->ref = 1; in bdev_rbd_get_pool_ctx()
393 *ctx = entry; in bdev_rbd_get_pool_ctx()
394 STAILQ_INSERT_TAIL(&g_map_bdev_rbd_pool_ctx, entry, link); in bdev_rbd_get_pool_ctx()
399 free(entry->name); in bdev_rbd_get_pool_ctx()
401 free(entry); in bdev_rbd_get_pool_ctx()
846 struct bdev_rbd_cluster *entry; in bdev_rbd_cluster_dump_entry() local
849 STAILQ_FOREACH(entry, &g_map_bdev_rbd_cluster, link) { in bdev_rbd_cluster_dump_entry()
850 if (strcmp(cluster_name, entry->name)) { in bdev_rbd_cluster_dump_entry()
853 if (entry->user_id) { in bdev_rbd_cluster_dump_entry()
854 spdk_json_write_named_string(w, "user_id", entry->user_id); in bdev_rbd_cluster_dump_entry()
857 if (entry->config_param) { in bdev_rbd_cluster_dump_entry()
858 char **config_entry = entry->config_param; in bdev_rbd_cluster_dump_entry()
867 if (entry->config_file) { in bdev_rbd_cluster_dump_entry()
868 spdk_json_write_named_string(w, "config_file", entry->config_file); in bdev_rbd_cluster_dump_entry()
870 if (entry->key_file) { in bdev_rbd_cluster_dump_entry()
871 spdk_json_write_named_string(w, "key_file", entry->key_file); in bdev_rbd_cluster_dump_entry()
902 char **entry = rbd_bdev->config; in bdev_rbd_dump_info_json() local
905 while (*entry) { in bdev_rbd_dump_info_json()
906 spdk_json_write_named_string(w, entry[0], entry[1]); in bdev_rbd_dump_info_json()
907 entry += 2; in bdev_rbd_dump_info_json()
937 char **entry = rbd->config; in bdev_rbd_write_config_json() local
940 while (*entry) { in bdev_rbd_write_config_json()
941 spdk_json_write_named_string(w, entry[0], entry[1]); in bdev_rbd_write_config_json()
942 entry += 2; in bdev_rbd_write_config_json()
955 dump_single_cluster_entry(struct bdev_rbd_cluster *entry, struct spdk_json_write_ctx *w) in dump_single_cluster_entry() argument
957 assert(entry != NULL); in dump_single_cluster_entry()
960 spdk_json_write_named_string(w, "cluster_name", entry->name); in dump_single_cluster_entry()
962 if (entry->user_id) { in dump_single_cluster_entry()
963 spdk_json_write_named_string(w, "user_id", entry->user_id); in dump_single_cluster_entry()
966 if (entry->config_param) { in dump_single_cluster_entry()
967 char **config_entry = entry->config_param; in dump_single_cluster_entry()
976 if (entry->config_file) { in dump_single_cluster_entry()
977 spdk_json_write_named_string(w, "config_file", entry->config_file); in dump_single_cluster_entry()
979 if (entry->key_file) { in dump_single_cluster_entry()
980 spdk_json_write_named_string(w, "key_file", entry->key_file); in dump_single_cluster_entry()
983 if (entry->core_mask) { in dump_single_cluster_entry()
984 spdk_json_write_named_string(w, "core_mask", entry->core_mask); in dump_single_cluster_entry()
993 struct bdev_rbd_cluster *entry; in bdev_rbd_get_clusters_info() local
1005 STAILQ_FOREACH(entry, &g_map_bdev_rbd_cluster, link) { in bdev_rbd_get_clusters_info()
1006 if (strcmp(name, entry->name) == 0) { in bdev_rbd_get_clusters_info()
1008 dump_single_cluster_entry(entry, w); in bdev_rbd_get_clusters_info()
1022 STAILQ_FOREACH(entry, &g_map_bdev_rbd_cluster, link) { in bdev_rbd_get_clusters_info()
1023 dump_single_cluster_entry(entry, w); in bdev_rbd_get_clusters_info()
1076 struct bdev_rbd_cluster *entry; in rbd_register_cluster() local
1081 STAILQ_FOREACH(entry, &g_map_bdev_rbd_cluster, link) { in rbd_register_cluster()
1082 if (strcmp(name, entry->name) == 0) { in rbd_register_cluster()
1089 entry = calloc(1, sizeof(*entry)); in rbd_register_cluster()
1090 if (!entry) { in rbd_register_cluster()
1096 entry->name = strdup(name); in rbd_register_cluster()
1097 if (entry->name == NULL) { in rbd_register_cluster()
1098 SPDK_ERRLOG("Failed to save the name =%s on entry =%p\n", name, entry); in rbd_register_cluster()
1103 entry->user_id = strdup(user_id); in rbd_register_cluster()
1104 if (entry->user_id == NULL) { in rbd_register_cluster()
1105 SPDK_ERRLOG("Failed to save the str =%s on entry =%p\n", user_id, entry); in rbd_register_cluster()
1112 entry->config_param = bdev_rbd_dup_config(config_param); in rbd_register_cluster()
1113 if (entry->config_param == NULL) { in rbd_register_cluster()
1114 SPDK_ERRLOG("Failed to save the config_param=%p on entry = %p\n", config_param, entry); in rbd_register_cluster()
1120 entry->config_file = strdup(config_file); in rbd_register_cluster()
1121 if (entry->config_file == NULL) { in rbd_register_cluster()
1122 SPDK_ERRLOG("Failed to save the config_file=%s on entry = %p\n", config_file, entry); in rbd_register_cluster()
1128 entry->key_file = strdup(key_file); in rbd_register_cluster()
1129 if (entry->key_file == NULL) { in rbd_register_cluster()
1130 SPDK_ERRLOG("Failed to save the key_file=%s on entry = %p\n", key_file, entry); in rbd_register_cluster()
1136 entry->core_mask = strdup(core_mask); in rbd_register_cluster()
1137 if (entry->core_mask == NULL) { in rbd_register_cluster()
1138 SPDK_ERRLOG("Core_mask=%s allocation failed on entry = %p\n", core_mask, entry); in rbd_register_cluster()
1142 if (spdk_cpuset_parse(&rbd_core_mask, entry->core_mask) < 0) { in rbd_register_cluster()
1143 SPDK_ERRLOG("Invalid cpumask=%s on entry = %p\n", entry->core_mask, entry); in rbd_register_cluster()
1148 SPDK_ERRLOG("Failed to change rbd threads to core_mask %s on entry = %p\n", core_mask, entry); in rbd_register_cluster()
1158 rc = rados_create(&entry->cluster, user_id); in rbd_register_cluster()
1165 rc = rados_conf_read_file(entry->cluster, entry->config_file); in rbd_register_cluster()
1166 if (entry->config_file && rc < 0) { in rbd_register_cluster()
1167 SPDK_ERRLOG("Failed to read conf file %s\n", entry->config_file); in rbd_register_cluster()
1168 rados_shutdown(entry->cluster); in rbd_register_cluster()
1175 rc = rados_conf_set(entry->cluster, config_entry[0], config_entry[1]); in rbd_register_cluster()
1178 rados_shutdown(entry->cluster); in rbd_register_cluster()
1186 rc = rados_conf_set(entry->cluster, "keyring", key_file); in rbd_register_cluster()
1189 rados_shutdown(entry->cluster); in rbd_register_cluster()
1194 rc = rados_connect(entry->cluster); in rbd_register_cluster()
1196 SPDK_ERRLOG("Failed to connect to rbd_pool on cluster=%p\n", entry->cluster); in rbd_register_cluster()
1197 rados_shutdown(entry->cluster); in rbd_register_cluster()
1201 STAILQ_INSERT_TAIL(&g_map_bdev_rbd_cluster, entry, link); in rbd_register_cluster()
1207 bdev_rbd_cluster_free(entry); in rbd_register_cluster()
1215 struct bdev_rbd_cluster *entry; in bdev_rbd_unregister_cluster() local
1223 STAILQ_FOREACH(entry, &g_map_bdev_rbd_cluster, link) { in bdev_rbd_unregister_cluster()
1224 if (strcmp(name, entry->name) == 0) { in bdev_rbd_unregister_cluster()
1225 if (entry->ref == 0) { in bdev_rbd_unregister_cluster()
1226 STAILQ_REMOVE(&g_map_bdev_rbd_cluster, entry, bdev_rbd_cluster, link); in bdev_rbd_unregister_cluster()
1227 rados_shutdown(entry->cluster); in bdev_rbd_unregister_cluster()
1228 bdev_rbd_cluster_free(entry); in bdev_rbd_unregister_cluster()
1231 entry->name); in bdev_rbd_unregister_cluster()