Motr  M0
helpers.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2020 Seagate Technology LLC and/or its Affiliates
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * For any questions about this software or licensing,
17  * please email opensource@seagate.com or cortx-questions@seagate.com.
18  *
19  */
20 
21 
22 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_CONF
23 #include "lib/trace.h"
24 
25 #include "conf/helpers.h"
26 #include "conf/obj_ops.h" /* m0_conf_obj_find_lock */
27 #include "conf/confc.h" /* m0_confc_open_sync */
28 #include "conf/dir.h" /* m0_conf_dir_len */
29 #include "conf/diter.h" /* m0_conf_diter_next_sync */
30 #include "conf/pvers.h" /* m0_conf_pver_find */
31 #include "ha/note.h" /* m0_ha_nvec */
32 #include "reqh/reqh.h" /* m0_reqh2confc */
33 #include "lib/string.h" /* m0_strdup */
34 #include "lib/memory.h" /* M0_ALLOC_ARR */
35 #include "lib/finject.h" /* M0_FI_ENABLED */
36 #include "fis/fi_service.h" /* FI_SERVICE_NAME */
37 
38 enum { CACHE_LOCALITY = 1 };
39 
40 static int confc_obj_get(struct m0_confc *confc,
41  const struct m0_fid *fid,
42  struct m0_conf_obj **result)
43 {
44  return M0_RC(m0_conf_obj_find_lock(&confc->cc_cache, fid, result) ?:
45  m0_confc_open_sync(result, *result, M0_FID0));
46 }
47 
48 #define X(type) \
49 M0_INTERNAL int type ## _get(struct m0_confc *confc, \
50  const struct m0_fid *fid, \
51  struct type **out) \
52 { \
53  struct m0_conf_obj *obj; \
54  int rc; \
55  \
56  rc = confc_obj_get(confc, fid, &obj); \
57  if (rc == 0) \
58  *out = M0_CONF_CAST(obj, type); \
59  return M0_RC(rc); \
60 } \
61 struct __ ## type ## _semicolon_catcher
62 
64 #undef X
65 
66 M0_INTERNAL bool m0_conf_obj_is_pool(const struct m0_conf_obj *obj)
67 {
69 }
70 
71 M0_INTERNAL int m0_conf_pver_get(struct m0_confc *confc,
72  const struct m0_fid *pool,
73  struct m0_conf_pver **out)
74 {
75  int rc;
76  struct m0_conf_root *root = NULL;
77  struct m0_conf_obj *pool_obj = NULL;
78 
80 
82  m0_confc_open_sync(&pool_obj, confc->cc_root,
83  M0_CONF_ROOT_POOLS_FID, *pool) ?:
86  if (rc == 0) {
87  M0_ASSERT(*out != NULL);
88  m0_conf_obj_get_lock(&(*out)->pv_obj);
89  }
90  m0_confc_close(pool_obj);
92  return M0_RC(rc);
93 }
94 
95 static bool conf_obj_is_sdev(const struct m0_conf_obj *obj)
96 {
98 }
99 
100 M0_INTERNAL int m0_conf_device_cid_to_fid(struct m0_confc *confc, uint64_t cid,
101  struct m0_fid *fid)
102 {
103  int rc;
104  struct m0_conf_root *root;
105  struct m0_conf_sdev *sdev;
106  struct m0_conf_obj *obj;
107  struct m0_conf_diter it;
108 
110  if (rc != 0)
111  return M0_ERR(rc);
112 
114  &root->rt_obj,
115  M0_CONF_ROOT_NODES_FID,
116  M0_CONF_NODE_PROCESSES_FID,
117  M0_CONF_PROCESS_SERVICES_FID,
118  M0_CONF_SERVICE_SDEVS_FID);
119  if (rc != 0) {
121  return M0_ERR(rc);
122  }
125  ; /* Skip over non-sdev objects. */
129  sdev = M0_CONF_CAST(obj, m0_conf_sdev);
130  if (sdev->sd_dev_idx == cid) {
131  *fid = sdev->sd_obj.co_id;
132  break;
133  }
134  }
137 
138  return rc == M0_CONF_DIREND ? -ENOENT : 0;
139 }
140 
141 static int _conf_load(struct m0_conf_root *root,
142  const struct m0_fid *path,
143  uint32_t nr_levels)
144 {
145  struct m0_conf_diter it;
146  int rc;
147 
148  M0_PRE(path != NULL);
149 
151  &root->rt_obj, nr_levels, path);
152  if (rc != 0)
153  return M0_ERR(rc);
154 
156  /*
157  * Traverse configuration DAG in order to cache conf objects.
158  */
159  ;
161 
162  return M0_RC(rc);
163 }
164 
165 M0_INTERNAL int m0_conf_full_load(struct m0_conf_root *r)
166 {
167  int rc;
168  const struct m0_fid to_sdevs[] = {M0_CONF_ROOT_NODES_FID,
169  M0_CONF_NODE_PROCESSES_FID,
170  M0_CONF_PROCESS_SERVICES_FID,
171  M0_CONF_SERVICE_SDEVS_FID};
172  const struct m0_fid to_drives[] = {M0_CONF_ROOT_SITES_FID,
173  M0_CONF_SITE_RACKS_FID,
174  M0_CONF_RACK_ENCLS_FID,
175  M0_CONF_ENCLOSURE_CTRLS_FID,
176  M0_CONF_CONTROLLER_DRIVES_FID};
177  const struct m0_fid to_drvsvs[] = {M0_CONF_ROOT_POOLS_FID,
178  M0_CONF_POOL_PVERS_FID,
179  M0_CONF_PVER_SITEVS_FID,
180  M0_CONF_SITEV_RACKVS_FID,
181  M0_CONF_RACKV_ENCLVS_FID,
182  M0_CONF_ENCLV_CTRLVS_FID,
183  M0_CONF_CTRLV_DRIVEVS_FID};
184  const struct m0_fid to_profs[] = {M0_CONF_ROOT_PROFILES_FID};
185  const struct m0_fid to_fdmifs[] = {M0_CONF_ROOT_FDMI_FLT_GRPS_FID,
186  M0_CONF_FDMI_FGRP_FILTERS_FID};
187 
188  rc = _conf_load(r, to_sdevs, ARRAY_SIZE(to_sdevs)) ?:
189  _conf_load(r, to_drives, ARRAY_SIZE(to_drives)) ?:
190  _conf_load(r, to_drvsvs, ARRAY_SIZE(to_drvsvs)) ?:
191  _conf_load(r, to_profs, ARRAY_SIZE(to_profs)) ?:
192  _conf_load(r, to_fdmifs, ARRAY_SIZE(to_fdmifs));
193 
194  return M0_RC(rc);
195 }
196 
197 M0_INTERNAL bool m0_conf_service_ep_is_known(const struct m0_conf_obj *svc_obj,
198  const char *ep_addr)
199 {
200  struct m0_conf_service *svc;
201  const char **eps;
202  bool rv = false;
203 
204  M0_ENTRY("svc_obj = "FID_F", ep_addr = %s", FID_P(&svc_obj->co_id),
205  ep_addr);
207 
208  svc = M0_CONF_CAST(svc_obj, m0_conf_service);
209  for (eps = svc->cs_endpoints; *eps != NULL; eps++) {
210  if (m0_streq(ep_addr, *eps)) {
211  rv = true;
212  break;
213  }
214  }
215  M0_LEAVE("rv = %s", m0_bool_to_str(rv));
216  return rv;
217 }
218 
219 M0_INTERNAL int m0_confc_root_open(struct m0_confc *confc,
220  struct m0_conf_root **root)
221 {
222  struct m0_conf_obj *root_obj;
223  int rc;
224 
225  M0_ENTRY();
226  M0_PRE(confc->cc_root != NULL);
227 
228  rc = m0_confc_open_sync(&root_obj, confc->cc_root, M0_FID0);
229  if (rc == 0 && root != NULL)
230  *root = M0_CONF_CAST(root_obj, m0_conf_root);
231  return M0_RC(rc);
232 }
233 
234 M0_INTERNAL int m0_confc_profile_open(struct m0_confc *confc,
235  const struct m0_fid *fid,
236  struct m0_conf_profile **out)
237 {
238  struct m0_conf_obj *obj;
239  int rc;
240 
241  M0_ENTRY();
243  M0_CONF_ROOT_PROFILES_FID, *fid);
244  if (rc == 0)
246  return M0_RC(rc);
247 }
248 
249 static bool conf_obj_is_service(const struct m0_conf_obj *obj)
250 {
252 }
253 
255 static int confc_service_find(struct m0_confc *confc,
257  const char *ep,
258  struct m0_conf_obj **result)
259 {
260  struct m0_conf_diter it;
261  struct m0_conf_obj *obj;
262  struct m0_conf_service *svc;
263  struct m0_conf_root *root = NULL;
264  int rc;
265 
266  M0_ENTRY("stype=%s ep=%s", m0_conf_service_type2str(stype), ep);
269  M0_PRE(ep != NULL && *ep != '\0'); /* not empty */
270  M0_PRE(result != NULL && *result == NULL);
271 
274  M0_CONF_ROOT_NODES_FID,
275  M0_CONF_NODE_PROCESSES_FID,
276  M0_CONF_PROCESS_SERVICES_FID);
277  if (rc != 0)
278  goto end;
279 
280  while ((rc = m0_conf_diter_next_sync(&it, conf_obj_is_service)) > 0) {
283  if (svc->cs_type == stype &&
285  *result = obj;
286  rc = 0;
287  break;
288  }
289  }
291 
292  if (rc == 0 && *result == NULL)
293  M0_LOG(M0_NOTICE, "No such service: stype=%s ep=%s",
295 end:
296  if (root != NULL)
298  M0_POST(ergo(rc == 0,
299  *result == NULL ||
300  m0_conf_obj_type(*result) == &M0_CONF_SERVICE_TYPE));
301  return M0_RC(rc);
302 }
303 
304 M0_INTERNAL int m0_confc_service_find(struct m0_confc *confc,
306  const char *ep,
307  struct m0_conf_obj **result)
308 {
309  M0_ENTRY("stype=%s ep=%s", m0_conf_service_type2str(stype), ep);
310  M0_PRE(result != NULL);
311 
312  *result = NULL;
314  return M0_RC(confc_service_find(confc, stype, ep, result));
315  return M0_RC_INFO(0,
316  "Confc is not ready. Called by a dummy rpc client?");
317 }
318 
319 M0_INTERNAL bool m0_conf_service_is_top_rms(const struct m0_conf_service *svc)
320 {
321  int rc;
322  bool ret;
323  struct m0_conf_obj *obj = NULL;
324 
325  M0_ENTRY("svc="FID_F, FID_P(&svc->cs_obj.co_id));
326  M0_PRE(svc->cs_type == M0_CST_RMS);
327 
328  /* look up for confd on the same endpoint */
330  M0_CST_CONFD, svc->cs_endpoints[0], &obj);
331  ret = rc == 0 && obj != NULL;
332  M0_LEAVE("retval=%s", m0_bool_to_str(ret));
333  return ret;
334 }
335 
336 static struct m0_confc *conf_obj2confc(const struct m0_conf_obj *obj)
337 {
338  M0_PRE(obj != NULL && obj->co_cache != NULL);
339  return container_of(obj->co_cache, struct m0_confc, cc_cache);
340 }
341 
342 M0_INTERNAL struct m0_reqh *m0_confc2reqh(const struct m0_confc *confc)
343 {
344  struct m0_rconfc *rconfc;
345 
346  M0_PRE(confc != NULL);
348  return container_of(rconfc, struct m0_reqh, rh_rconfc);
349 }
350 
351 M0_INTERNAL struct m0_reqh *m0_conf_obj2reqh(const struct m0_conf_obj *obj)
352 {
354 }
355 
356 static int conf__objs_count(struct m0_confc *confc,
357  bool (*filter)(const struct m0_conf_obj *obj,
358  void *arg),
359  void *arg,
360  uint32_t *count,
361  int level,
362  const struct m0_fid *path)
363 {
364  int rc;
365  struct m0_conf_root *root;
366  struct m0_conf_diter it;
367 
369  if (rc != 0)
370  return M0_ERR(rc);
371 
372  rc = m0_conf__diter_init(&it, confc, &root->rt_obj, level, path);
373  if (rc != 0)
374  goto end;
375 
376  while ((rc = m0_conf_diter_next_sync(&it, NULL)) == M0_CONF_DIRNEXT) {
377  if (filter(m0_conf_diter_result(&it), arg))
378  M0_CNT_INC(*count);
379  }
381 end:
383 
384  return M0_RC(rc);
385 }
386 
395 #define conf_objs_count(confc, filter, arg, count, ...) \
396  conf__objs_count(confc, filter, arg, count, \
397  M0_COUNT_PARAMS(__VA_ARGS__) + 1, \
398  (const struct m0_fid []){ __VA_ARGS__, M0_FID0 })
399 
400 M0_INTERNAL struct m0_conf_pver **m0_conf_pvers(const struct m0_conf_obj *obj)
401 {
402  const struct m0_conf_obj_type *t = m0_conf_obj_type(obj);
403 
404  if (t == &M0_CONF_SITE_TYPE)
405  return M0_CONF_CAST(obj, m0_conf_site)->ct_pvers;
406  else if (t == &M0_CONF_RACK_TYPE)
407  return M0_CONF_CAST(obj, m0_conf_rack)->cr_pvers;
408  else if (t == &M0_CONF_ENCLOSURE_TYPE)
409  return M0_CONF_CAST(obj, m0_conf_enclosure)->ce_pvers;
410  else if (t == &M0_CONF_CONTROLLER_TYPE)
411  return M0_CONF_CAST(obj, m0_conf_controller)->cc_pvers;
412  else if (t == &M0_CONF_DRIVE_TYPE)
413  return M0_CONF_CAST(obj, m0_conf_drive)->ck_pvers;
414  else
415  M0_IMPOSSIBLE("");
416 }
417 
418 M0_INTERNAL bool m0_disk_is_of_type(const struct m0_conf_obj *obj,
419  uint64_t svc_types)
420 {
421  M0_CASSERT(M0_CST_NR <= sizeof svc_types * 8);
423  ({
424  const struct m0_conf_drive *disk =
427 
428  type = M0_CONF_CAST(
430  m0_conf_service)->cs_type;
431  M0_BITS(type) & svc_types;
432  });
433 }
434 
435 M0_INTERNAL bool m0_is_ios_disk(const struct m0_conf_obj *obj)
436 {
437  return m0_disk_is_of_type(obj, M0_BITS(M0_CST_IOS));
438 }
439 
440 M0_INTERNAL bool m0_is_cas_disk(const struct m0_conf_obj *obj)
441 {
442  return m0_disk_is_of_type(obj, M0_BITS(M0_CST_CAS));
443 }
444 
445 static bool dev_has_type(const struct m0_conf_obj *obj, void *arg)
446 {
447  return m0_disk_is_of_type(obj, (uint64_t)arg);
448 }
449 
450 M0_INTERNAL int m0_conf_devices_count(struct m0_confc *confc,
451  uint64_t svc_types,
452  uint32_t *nr_devices)
453 {
454  M0_CASSERT(sizeof(void *) >= sizeof svc_types);
455  return M0_FI_ENABLED("diter_fail") ? -ENOMEM :
457  (void *)svc_types, nr_devices,
458  M0_CONF_ROOT_SITES_FID,
459  M0_CONF_SITE_RACKS_FID,
460  M0_CONF_RACK_ENCLS_FID,
461  M0_CONF_ENCLOSURE_CTRLS_FID,
462  M0_CONF_CONTROLLER_DRIVES_FID);
463 }
464 
465 M0_INTERNAL void m0_confc_expired_cb(struct m0_rconfc *rconfc)
466 {
467  struct m0_reqh *reqh = container_of(rconfc, struct m0_reqh, rh_rconfc);
468 
469  M0_ENTRY("rconfc %p, reqh %p", rconfc, reqh);
471  M0_LEAVE();
472 }
473 
479  struct m0_sm_ast *ast)
480 {
481  struct m0_reqh *reqh = ast->sa_datum;
482 
483  M0_ENTRY("reqh %p", reqh);
485  M0_LEAVE();
486 }
487 
488 M0_INTERNAL void m0_confc_ready_cb(struct m0_rconfc *rconfc)
489 {
490  struct m0_reqh *reqh = container_of(rconfc, struct m0_reqh, rh_rconfc);
491 
492  M0_ENTRY("rconfc %p, reqh %p", rconfc, reqh);
493  /*
494  * Step 1. Running synchronous part:
495  *
496  * Broadcast on m0_reqh::rh_conf_cache_ready channel executed by rconfc
497  * in the context of thread where m0_rconfc::rc_ready_cb is called,
498  * i.e. locality0 AST thread or consumer's thread in case of local conf.
499  */
501  /*
502  * Step 2. Launching asynchronous part:
503  *
504  * Broadcast on m0_reqh::rh_conf_cache_ready_async channel executed in
505  * the context of a standalone AST to prevent locking locality0.
506  */
509  /*
510  * Clink callbacks are going to use m0_rconfc::rc_confc for reading the
511  * updated conf. Therefore, the locality where reading conf occurs must
512  * be other than locality0 used with m0_reqh::rh_rconfc::rc_confc.
513  */
515  M0_LEAVE();
516 }
517 
519  const struct m0_fid *process_fid,
521  struct m0_fid *sfid)
522 {
523  struct m0_conf_obj *pobj;
524  struct m0_conf_obj *sobj;
525  struct m0_conf_diter it;
526  int rc;
527 
528  M0_ENTRY("Process fid: "FID_F", service type: %d", FID_P(process_fid), stype);
529 
530  rc = confc_obj_get(confc, process_fid, &pobj);
531  if (rc != 0)
532  return M0_ERR_INFO(rc, "process="FID_F, FID_P(process_fid));
533  rc = M0_FI_ENABLED("diter_fail") ? -ENOMEM :
534  m0_conf_diter_init(&it, confc, pobj,
535  M0_CONF_PROCESS_SERVICES_FID);
536  if (rc != 0) {
537  m0_confc_close(pobj);
538  return M0_ERR(rc);
539  }
540  *sfid = M0_FID0;
541  while ((rc = m0_conf_diter_next_sync(&it, NULL)) == M0_CONF_DIRNEXT) {
542  sobj = m0_conf_diter_result(&it);
544  if (M0_CONF_CAST(sobj, m0_conf_service)->cs_type == stype) {
545  rc = 0;
546  *sfid = sobj->co_id;
547  break;
548  }
549  }
551  m0_confc_close(pobj);
552  return m0_fid_is_set(sfid) ? M0_RC(rc) : M0_ERR(-ENOENT);
553 }
554 
555 /* --------------------------------- >8 --------------------------------- */
556 
557 M0_INTERNAL int m0_conf_objs_ha_update(struct m0_ha_nvec *nvec)
558 {
559  struct m0_mutex chan_lock;
560  struct m0_chan chan;
561  struct m0_clink clink;
562  int rc;
563 
569 
570  rc = m0_ha_state_get(nvec, &chan);
571  if (rc == 0) {
572  /*
573  * m0_ha_state_get() sends a fop to HA service caller.
574  * We need to wait for reply fop.
575  */
577  }
581  m0_chan_fini(&chan);
584  return M0_RC(rc);
585 }
586 
587 M0_INTERNAL int m0_conf_obj_ha_update(const struct m0_fid *obj_fid)
588 {
589  struct m0_ha_note note = {
590  .no_id = *obj_fid,
591  .no_state = M0_NC_UNKNOWN
592  };
593  struct m0_ha_nvec nvec = { 1, &note };
594 
595  return M0_RC(m0_conf_objs_ha_update(&nvec));
596 }
597 
598 static void __ha_nvec_reset(struct m0_ha_nvec *nvec, int32_t total)
599 {
600  int i;
601  for(i = 0; i < nvec->nv_nr; i++)
602  nvec->nv_note[i] = (struct m0_ha_note){ M0_FID0, 0 };
604 }
605 
607  struct m0_ha_nvec *nvec,
608  struct m0_chan *chan)
609 {
610  struct m0_conf_cache *cache = &confc->cc_cache;
611  struct m0_conf_obj *obj;
612  int32_t total;
613  int rc = 0;
614  int i = 0;
615 
616  total = m0_tl_reduce(m0_conf_cache, obj, &cache->ca_registry, 0,
617  + (m0_fid_tget(&obj->co_id) ==
618  M0_CONF_DIR_TYPE.cot_ftype.ft_id ? 0 : 1));
619  if (total == 0)
620  return M0_ERR(-ENOENT);
621 
623  return M0_ERR(-EINVAL);
624 
626  M0_ALLOC_ARR(nvec->nv_note, nvec->nv_nr);
627  if (nvec->nv_note == NULL)
628  return M0_ERR(-ENOMEM);
629 
630  m0_tl_for(m0_conf_cache, &cache->ca_registry, obj) {
631  /*
632  * Skip directories - they're only used in Motr internal
633  * representation and HA knows nothing about them.
634  */
635  if (m0_fid_tget(&obj->co_id) ==
637  continue;
638  nvec->nv_note[i].no_id = obj->co_id;
639  nvec->nv_note[i++].no_state = M0_NC_UNKNOWN;
640  if (nvec->nv_nr == i) {
641  if (chan == NULL)
642  rc = m0_conf_objs_ha_update(nvec);
643  else
644  rc = m0_ha_state_get(nvec, chan);
645  if (rc != 0)
646  break;
647  total -= nvec->nv_nr;
648  if (total <= 0)
649  break;
650  __ha_nvec_reset(nvec, total);
651  i = 0;
652  }
653  } m0_tlist_endfor;
654 
655  return M0_RC(rc);
656 }
657 
658 M0_INTERNAL int m0_conf_confc_ha_update(struct m0_confc *confc)
659 {
660  struct m0_ha_nvec nvec;
661  int rc;
662 
664  if (rc == 0)
665  m0_free(nvec.nv_note);
666  return rc;
667 }
668 
669 #undef M0_TRACE_SUBSYSTEM
const struct m0_conf_obj_type * m0_conf_obj_type(const struct m0_conf_obj *obj)
Definition: obj.c:363
struct m0_fid co_id
Definition: obj.h:208
Definition: beck.c:235
M0_INTERNAL int m0_ha_state_get(struct m0_ha_nvec *note, struct m0_chan *chan)
Definition: note.c:74
M0_INTERNAL void m0_chan_wait(struct m0_clink *link)
Definition: chan.c:336
struct m0_conf_obj * cc_root
Definition: confc.h:404
#define M0_PRE(cond)
#define M0_ALLOC_ARR(arr, nr)
Definition: memory.h:84
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
Definition: mutex.c:66
M0_INTERNAL void m0_chan_broadcast_lock(struct m0_chan *chan)
Definition: chan.c:178
static int _conf_load(struct m0_conf_root *root, const struct m0_fid *path, uint32_t nr_levels)
Definition: helpers.c:141
M0_INTERNAL struct m0_locality * m0_locality_get(uint64_t value)
Definition: locality.c:156
M0_CONF_OBJ_GETTERS
Definition: helpers.c:63
#define NULL
Definition: misc.h:38
M0_INTERNAL void m0_clink_init(struct m0_clink *link, m0_chan_cb_t cb)
Definition: chan.c:201
m0_conf_service_type
Definition: schema.h:194
M0_INTERNAL void m0_clink_del_lock(struct m0_clink *link)
Definition: chan.c:293
static int confc_service_find(struct m0_confc *confc, enum m0_conf_service_type stype, const char *ep, struct m0_conf_obj **result)
Definition: helpers.c:255
static struct m0_mutex chan_lock
Definition: note.c:96
M0_INTERNAL int m0_confc_profile_open(struct m0_confc *confc, const struct m0_fid *fid, struct m0_conf_profile **out)
Definition: helpers.c:234
#define ergo(a, b)
Definition: misc.h:293
M0_INTERNAL int m0_conf_full_load(struct m0_conf_root *r)
Definition: helpers.c:165
static const char * ep_addr
Definition: rpc_machine.c:35
void(* sa_cb)(struct m0_sm_group *grp, struct m0_sm_ast *)
Definition: sm.h:506
const struct m0_conf_obj_type M0_CONF_SITE_TYPE
Definition: site.c:121
struct m0_chan rh_conf_cache_ready_async
Definition: reqh.h:227
static struct m0_sm_group * grp
Definition: bytecount.c:38
struct m0_conf_obj rt_obj
Definition: obj.h:372
#define M0_LOG(level,...)
Definition: trace.h:167
M0_LEAVE()
const struct m0_conf_obj_type * m0_conf_fid_type(const struct m0_fid *fid)
Definition: obj.c:368
static bool conf_obj_is_service(const struct m0_conf_obj *obj)
Definition: helpers.c:249
enum m0_trace_level level
Definition: trace.c:111
uint8_t ft_id
Definition: fid.h:101
const struct m0_conf_obj_type M0_CONF_SERVICE_TYPE
Definition: service.c:156
M0_INTERNAL void m0_sm_ast_post(struct m0_sm_group *grp, struct m0_sm_ast *ast)
Definition: sm.c:135
#define M0_CASSERT(cond)
#define conf_objs_count(confc, filter, arg, count,...)
Definition: helpers.c:395
static int confc_obj_get(struct m0_confc *confc, const struct m0_fid *fid, struct m0_conf_obj **result)
Definition: helpers.c:40
const struct m0_conf_obj_type M0_CONF_SDEV_TYPE
Definition: sdev.c:122
M0_INTERNAL int m0_conf_diter_next_sync(struct m0_conf_diter *it, bool(*filter)(const struct m0_conf_obj *obj))
Definition: diter.c:555
M0_INTERNAL bool m0_is_cas_disk(const struct m0_conf_obj *obj)
Definition: helpers.c:440
struct m0_chan rh_conf_cache_ready
Definition: reqh.h:205
M0_INTERNAL uint8_t m0_fid_tget(const struct m0_fid *fid)
Definition: fid.c:133
static struct m0_be_emap_cursor it
Definition: extmap.c:46
const struct m0_conf_obj_type M0_CONF_POOL_TYPE
Definition: pool.c:249
#define M0_BITS(...)
Definition: misc.h:236
Definition: sm.h:504
#define container_of(ptr, type, member)
Definition: misc.h:33
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
Definition: mutex.c:49
M0_INTERNAL struct m0_conf_pver ** m0_conf_pvers(const struct m0_conf_obj *obj)
Definition: helpers.c:400
M0_INTERNAL bool m0_fid_is_set(const struct m0_fid *fid)
Definition: fid.c:106
static struct foo * obj
Definition: tlist.c:302
static m0_bcount_t count
Definition: xcode.c:167
const struct m0_conf_obj_type M0_CONF_CONTROLLER_TYPE
Definition: controller.c:131
struct m0_fid fid
Definition: di.c:46
M0_INTERNAL int m0_confc_root_open(struct m0_confc *confc, struct m0_conf_root **root)
Definition: helpers.c:219
return M0_RC(rc)
Definition: sock.c:754
#define M0_ENTRY(...)
Definition: trace.h:170
M0_INTERNAL int m0_conf_pver_get(struct m0_confc *confc, const struct m0_fid *pool, struct m0_conf_pver **out)
Definition: helpers.c:71
M0_INTERNAL int m0_confc_service_find(struct m0_confc *confc, enum m0_conf_service_type stype, const char *ep, struct m0_conf_obj **result)
Definition: helpers.c:304
static struct m0_sm_ast ast[NR]
Definition: locality.c:44
Definition: filter.py:1
uint32_t sd_dev_idx
Definition: obj.h:635
int i
Definition: dir.c:1033
#define M0_RC_INFO(rc, fmt,...)
Definition: trace.h:209
static int conf__objs_count(struct m0_confc *confc, bool(*filter)(const struct m0_conf_obj *obj, void *arg), void *arg, uint32_t *count, int level, const struct m0_fid *path)
Definition: helpers.c:356
#define M0_ERR_INFO(rc, fmt,...)
Definition: trace.h:215
struct m0_conf_root * root
Definition: note.c:50
int32_t nv_nr
Definition: note.h:196
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL bool m0_is_ios_disk(const struct m0_conf_obj *obj)
Definition: helpers.c:435
static bool dev_has_type(const struct m0_conf_obj *obj, void *arg)
Definition: helpers.c:445
void * sa_datum
Definition: sm.h:508
static bool m0_conf_service_type_is_valid(enum m0_conf_service_type t)
Definition: schema.h:204
const struct m0_conf_obj_type M0_CONF_ENCLOSURE_TYPE
Definition: enclosure.c:140
static const struct socktype stype[]
Definition: sock.c:1156
struct m0_fid rt_imeta_pver
Definition: obj.h:403
M0_INTERNAL int m0_conf_devices_count(struct m0_confc *confc, uint64_t svc_types, uint32_t *nr_devices)
Definition: helpers.c:450
const struct m0_fid_type cot_ftype
Definition: obj.h:314
M0_INTERNAL void m0_chan_init(struct m0_chan *chan, struct m0_mutex *ch_guard)
Definition: chan.c:96
#define M0_ASSERT(cond)
M0_INTERNAL const char * m0_bool_to_str(bool b)
Definition: misc.c:207
M0_INTERNAL const char * m0_conf_service_type2str(enum m0_conf_service_type type)
Definition: service.c:169
static struct m0_confc * confc
Definition: file.c:94
struct m0_conf_obj * m0_conf_obj_grandparent(const struct m0_conf_obj *obj)
Definition: obj.c:384
static bool conf_obj_is_sdev(const struct m0_conf_obj *obj)
Definition: helpers.c:95
static struct m0_thread t[8]
Definition: service_ut.c:1230
M0_INTERNAL int m0_conf_obj_ha_update(const struct m0_fid *obj_fid)
Definition: helpers.c:587
#define m0_streq(a, b)
Definition: string.h:34
struct m0_conf_cache cc_cache
Definition: confc.h:394
M0_INTERNAL struct m0_reqh * m0_conf_obj2reqh(const struct m0_conf_obj *obj)
Definition: helpers.c:351
M0_INTERNAL bool m0_disk_is_of_type(const struct m0_conf_obj *obj, uint64_t svc_types)
Definition: helpers.c:418
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
Definition: mutex.c:35
M0_INTERNAL int m0_conf_confc_ha_update(struct m0_confc *confc)
Definition: helpers.c:658
M0_INTERNAL int m0_conf_obj_find_lock(struct m0_conf_cache *cache, const struct m0_fid *id, struct m0_conf_obj **out)
Definition: obj_ops.c:154
#define M0_POST(cond)
const struct m0_conf_obj_type M0_CONF_DRIVE_TYPE
Definition: drive.c:108
Definition: reqh.h:94
M0_INTERNAL int m0_conf_confc_ha_update_async(struct m0_confc *confc, struct m0_ha_nvec *nvec, struct m0_chan *chan)
Definition: helpers.c:606
Definition: chan.h:229
#define M0_CONF_CAST(ptr, type)
Definition: obj.h:780
struct m0_conf_sdev * ck_sdev
Definition: obj.h:710
M0_INTERNAL bool m0_confc_is_inited(const struct m0_confc *confc)
Definition: confc.c:448
static struct m0_clink clink[RDWR_REQUEST_MAX]
#define m0_confc_open_sync(result, origin,...)
Definition: confc.h:707
#define FID_P(f)
Definition: fid.h:77
struct m0_fid no_id
Definition: note.h:180
M0_INTERNAL void m0_conf_obj_get_lock(struct m0_conf_obj *obj)
Definition: obj_ops.c:198
struct m0_sm_ast rh_conf_cache_ast
Definition: reqh.h:230
M0_INTERNAL struct m0_reqh * m0_confc2reqh(const struct m0_confc *confc)
Definition: helpers.c:342
static struct m0_pool pool
Definition: iter_ut.c:58
M0_INTERNAL int m0_conf_device_cid_to_fid(struct m0_confc *confc, uint64_t cid, struct m0_fid *fid)
Definition: helpers.c:100
void m0_clink_add_lock(struct m0_chan *chan, struct m0_clink *link)
Definition: chan.c:255
static struct m0_confc * conf_obj2confc(const struct m0_conf_obj *obj)
Definition: helpers.c:336
M0_INTERNAL int m0_conf_process2service_get(struct m0_confc *confc, const struct m0_fid *process_fid, enum m0_conf_service_type stype, struct m0_fid *sfid)
Definition: helpers.c:518
M0_INTERNAL struct m0_conf_obj * m0_conf_diter_result(const struct m0_conf_diter *it)
Definition: diter.c:576
#define m0_conf_diter_init(iter, confc, origin,...)
Definition: diter.h:235
struct m0_reqh reqh
Definition: rm_foms.c:48
#define M0_CNT_INC(cnt)
Definition: arith.h:226
static struct m0_chan chan[RDWR_REQUEST_MAX]
#define M0_FI_ENABLED(tag)
Definition: finject.h:231
Definition: fid.h:38
struct m0_confc rc_confc
Definition: rconfc.h:235
struct m0_chan rh_conf_cache_exp
Definition: reqh.h:194
static int r[NR]
Definition: thread.c:46
M0_INTERNAL void m0_conf_diter_fini(struct m0_conf_diter *it)
Definition: diter.c:313
static struct m0_net_test_service svc
Definition: service.c:34
struct m0_conf_obj sd_obj
Definition: obj.h:616
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
Definition: mutex.c:42
M0_INTERNAL void m0_clink_fini(struct m0_clink *link)
Definition: chan.c:208
#define m0_tlist_endfor
Definition: tlist.h:448
M0_INTERNAL int m0_conf_objs_ha_update(struct m0_ha_nvec *nvec)
Definition: helpers.c:557
M0_INTERNAL struct m0_confc * m0_confc_from_obj(const struct m0_conf_obj *obj)
Definition: confc.c:592
static struct m0_rconfc * rconfc(struct m0_client *m0c)
Definition: client_init.c:310
M0_INTERNAL void m0_confc_close(struct m0_conf_obj *obj)
Definition: confc.c:921
M0_INTERNAL void m0_chan_fini(struct m0_chan *chan)
Definition: chan.c:104
struct m0_rconfc rh_rconfc
Definition: reqh.h:166
M0_INTERNAL void m0_confc_ready_cb(struct m0_rconfc *rconfc)
Definition: helpers.c:488
#define likely(x)
Definition: assert.h:70
static void confc_ready_async_ast(struct m0_sm_group *grp, struct m0_sm_ast *ast)
Definition: helpers.c:478
def filter(argv)
Definition: filter.py:27
M0_INTERNAL bool m0_conf_obj_is_pool(const struct m0_conf_obj *obj)
Definition: helpers.c:66
static int total
Definition: base.c:302
#define out(...)
Definition: gen.c:41
M0_INTERNAL void m0_confc_expired_cb(struct m0_rconfc *rconfc)
Definition: helpers.c:465
int type
Definition: dir.c:1031
#define M0_FID0
Definition: fid.h:93
struct m0_ha_note * nv_note
Definition: note.h:197
static int32_t min32(int32_t a, int32_t b)
Definition: arith.h:36
M0_INTERNAL int m0_conf_pver_find(const struct m0_conf_pool *pool, const struct m0_fid *pver_to_skip, struct m0_conf_pver **out)
Definition: pvers.c:207
static void __ha_nvec_reset(struct m0_ha_nvec *nvec, int32_t total)
Definition: helpers.c:598
M0_INTERNAL bool m0_conf_service_is_top_rms(const struct m0_conf_service *svc)
Definition: helpers.c:319
const struct m0_conf_obj_type M0_CONF_DIR_TYPE
Definition: dir.c:206
#define m0_tl_for(name, head, obj)
Definition: tlist.h:695
void m0_free(void *data)
Definition: memory.c:146
Definition: mutex.h:47
M0_INTERNAL bool m0_conf_service_ep_is_known(const struct m0_conf_obj *svc_obj, const char *ep_addr)
Definition: helpers.c:197
M0_INTERNAL int m0_conf__diter_init(struct m0_conf_diter *it, struct m0_confc *confc, struct m0_conf_obj *origin, uint32_t nr_lvls, const struct m0_fid *path)
Definition: diter.c:282
int32_t rc
Definition: trigger_fop.h:47
#define ARRAY_SIZE(a)
Definition: misc.h:45
const struct m0_conf_obj_type M0_CONF_RACK_TYPE
Definition: rack.c:124
static const char * process_fid
Definition: idx_dix.c:73
#define FID_F
Definition: fid.h:75
#define M0_IMPOSSIBLE(fmt,...)
uint32_t no_state
Definition: note.h:182