Motr  M0
process_foms.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-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 
26 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_SSS
27 #include "lib/trace.h"
28 
29 #include "lib/assert.h"
30 #include "lib/finject.h" /* M0_FI_ENABLED */
31 #include "lib/misc.h"
32 #include "lib/memory.h"
33 #include "be/domain.h" /* m0_be_domain */
34 #include "be/alloc.h" /* m0_be_alloc_stats */
35 #include "module/instance.h" /* m0_get */
36 #include "cob/cob.h" /* m0_cob_bckey, m0_cob_bcrec */
37 #include "conf/helpers.h"
38 #include "fop/fop.h"
39 #include "fop/fom_generic.h"
40 #include "reqh/reqh_service.h"
41 #include "spiel/spiel.h"
42 #include "rm/rm_service.h" /* m0_rms_type */
43 #include "sss/process_fops.h"
44 #include "sss/process_foms.h"
45 #include "sss/ss_svc.h"
46 #include "ioservice/io_service.h" /* m0_ios_cdom_get */
47 #ifndef __KERNEL__
48  #include "module/instance.h"
49  #include <unistd.h>
50  #include <dlfcn.h> /* dlopen, dlsym */
51  #include "motr/process_attr.h"
52  #include "motr/setup.h" /* m0_cs_storage_devs_get */
53  #include "pool/pool_machine.h" /* m0_pool_machine_state */
54  #include "pool/pool.h" /* m0_pooldev */
55  #include "ioservice/storage_dev.h" /* m0_storage_dev_space */
56 #endif
57 
58 static int ss_process_fom_create(struct m0_fop *fop,
59  struct m0_fom **out,
60  struct m0_reqh *reqh);
61 static int ss_process_fom_tick(struct m0_fom *fom);
62 static int ss_process_fom_tick__init(struct m0_fom *fom,
63  const struct m0_reqh *reqh);
64 static void ss_process_fom_fini(struct m0_fom *fom);
65 static void ss_process_fom_fini(struct m0_fom *fom);
66 static size_t ss_process_fom_home_locality(const struct m0_fom *fom);
67 
79 };
80 
81 static struct m0_fom_ops ss_process_fom_ops = {
83  .fo_home_locality = ss_process_fom_home_locality,
84  .fo_fini = ss_process_fom_fini
85 };
86 
89 };
90 
94  .sd_name = "SS_FOM_INIT",
95  .sd_allowed = M0_BITS(SS_PROCESS_FOM_STOP,
103  },
105  .sd_name = "SS_PROCESS_FOM_STOP",
106  .sd_allowed = M0_BITS(M0_FOPH_SUCCESS, M0_FOPH_FAILURE),
107  },
109  .sd_name = "SS_PROCESS_FOM_RECONFIG_GET_DATA",
112  },
114  .sd_name = "SS_PROCESS_FOM_RECONFIG_DATA_WAIT",
115  .sd_allowed = M0_BITS(SS_PROCESS_FOM_RECONFIG),
116  },
118  .sd_name = "SS_PROCESS_FOM_RECONFIG",
119  .sd_allowed = M0_BITS(M0_FOPH_SUCCESS, M0_FOPH_FAILURE),
120  },
122  .sd_name = "SS_PROCESS_FOM_HEALTH",
123  .sd_allowed = M0_BITS(M0_FOPH_SUCCESS, M0_FOPH_FAILURE),
124  },
126  .sd_name = "SS_PROCESS_FOM_COUNTER",
127  .sd_allowed = M0_BITS(M0_FOPH_SUCCESS, M0_FOPH_FAILURE),
128  },
130  .sd_name = "SS_PROCESS_FOM_QUIESCE",
131  .sd_allowed = M0_BITS(M0_FOPH_SUCCESS, M0_FOPH_FAILURE),
132  },
134  .sd_name = "SS_PROCESS_FOM_RUNNING_LIST",
135  .sd_allowed = M0_BITS(M0_FOPH_SUCCESS, M0_FOPH_FAILURE),
136  },
138  .sd_name = "SS_PROCESS_FOM_LIB_LOAD",
139  .sd_allowed = M0_BITS(M0_FOPH_SUCCESS, M0_FOPH_FAILURE),
140  }
141 };
142 
144  .scf_name = "ss-process-fom-sm",
145  .scf_nr_states = ARRAY_SIZE(ss_process_fom_phases),
146  .scf_state = ss_process_fom_phases
147 };
148 
150  struct m0_fom spm_fom;
152 };
153 
154 static int ss_process_fom_create(struct m0_fop *fop,
155  struct m0_fom **out,
156  struct m0_reqh *reqh)
157 {
158  int rc;
159  struct m0_sss_process_fom *process_fom = NULL;
160  struct m0_ss_process_req *process_fop;
161  struct m0_fop *rfop = NULL;
162  int cmd;
163 
164  M0_ENTRY();
165  M0_PRE(fop != NULL);
166  M0_PRE(out != NULL);
168 
169  process_fop = m0_ss_fop_process_req(fop);
170  cmd = process_fop->ssp_cmd;
171 
172  if (!M0_FI_ENABLED("fom_alloc_fail"))
173  M0_ALLOC_PTR(process_fom);
174  if (!M0_FI_ENABLED("fop_alloc_fail"))
175  M0_ALLOC_PTR(rfop);
176  if (process_fom == NULL || rfop == NULL)
177  goto err;
178 
179  switch(cmd){
180  case M0_PROCESS_STOP:
183  break;
187  break;
188  default:
191  }
192 
193  rc = M0_FI_ENABLED("fop_data_alloc_fail") ? M0_ERR(-ENOMEM) :
194  m0_fop_data_alloc(rfop);
195  if (rc != 0)
196  goto err;
197 
199 
200  m0_fom_init(&process_fom->spm_fom, &fop->f_type->ft_fom_type,
201  &ss_process_fom_ops, fop, rfop, reqh);
202 
203  *out = &process_fom->spm_fom;
204  M0_LOG(M0_DEBUG, "fom %p", process_fom);
205  return M0_RC(0);
206 
207 err:
208  m0_free(process_fom);
209  m0_free(rfop);
210  return M0_ERR(-ENOMEM);
211 }
212 
213 static void ss_process_fom_fini(struct m0_fom *fom)
214 {
215  struct m0_sss_process_fom *process_fom;
216 
217  M0_ENTRY();
218 
219  M0_LOG(M0_DEBUG, "fom %p", fom);
220  m0_fom_fini(fom);
221  process_fom = M0_AMB(process_fom, fom, spm_fom);
222  m0_free(process_fom);
223 
224  M0_LEAVE();
225 }
226 
228  const struct m0_reqh *reqh)
229 {
230  static enum ss_fom_phases next_phase[] = {
238  };
239  int cmd;
240 
241  M0_ENTRY("fom %p, state %d", fom, m0_fom_phase(fom));
242  M0_PRE(fom != NULL);
243 
244  cmd = m0_ss_fop_process_req(fom->fo_fop)->ssp_cmd;
245  if (!IS_IN_ARRAY(cmd, next_phase))
246  return M0_ERR(-ENOENT);
247  m0_fom_phase_set(fom, next_phase[cmd]);
248  return M0_RC(0);
249 }
250 
251 static int ss_process_health(struct m0_reqh *reqh, int32_t *h)
252 {
253  /* Do nothing special here for now.
254  * Maybe in future some checks will be added */
255 
256  M0_PRE(h != NULL);
257  *h = M0_HEALTH_GOOD;
258  return 0;
259 }
260 
261 #ifdef __KERNEL__
262 static int ss_process_stats(struct m0_reqh *reqh M0_UNUSED,
264 {
265  return M0_ERR(-ENOSYS);
266 }
267 
268 static int ss_process_counter(struct m0_reqh *reqh M0_UNUSED,
270 {
271  return M0_ERR(-ENOSYS);
272 }
273 #else
274 extern struct m0_reqh_service_type m0_ios_type;
275 
277 {
278  struct m0_reqh_service_type *iot;
279 
280  M0_PRE(reqh != NULL);
282  if (iot != NULL)
283  return m0_reqh_service_find(iot, reqh);
284  return NULL;
285 }
286 
287 M0_TL_DESCR_DECLARE(seg, M0_EXTERN);
288 
290  struct m0_ss_process_rep *rep)
291 {
292  struct m0_tl *segs = &dom->bd_segs;
293  struct m0_be_seg *bs;
294 
295  /* collect be segments stats */
296  m0_tl_for(seg, segs, bs) {
297  struct m0_be_allocator_stats stats = {0};
298 
300  if (m0_addu64_will_overflow(rep->sspr_total_seg,
301  stats.bas_space_total))
302  return M0_ERR(-EOVERFLOW);
303  rep->sspr_total_seg += stats.bas_space_total;
304  if (m0_addu64_will_overflow(rep->sspr_free_seg,
305  stats.bas_space_free))
306  return M0_ERR(-EOVERFLOW);
307  rep->sspr_free_seg += stats.bas_space_free;
308  } m0_tl_endfor;
309 
310  return M0_RC(0);
311 }
312 
314 {
315  struct m0_storage_devs *sds = m0_cs_storage_devs_get();
316  struct m0_storage_dev *dev;
317  struct m0_storage_space sp;
318 
319  /* XXX Remove this block when storage_dev supports linuxstobs. */
320  if (sds == NULL)
321  return M0_RC(0);
322 
323  /* collect sdevs stats */
324  m0_tl_for(storage_dev, &sds->sds_devices, dev) {
325  M0_SET0(&sp);
326  /* Collect device stats for devices attached under dummy
327  * services in UT
328  */
329  if (M0_FI_ENABLED("take_dsx_in_effect") &&
330  M0_IN(dev->isd_srv_type, (M0_CST_DS1, M0_CST_DS2)))
331  goto consider_DS_in_ut;
332  /* Skip device if it does not belong to ios. */
333  if (dev->isd_srv_type != M0_CST_IOS)
334  continue;
335 consider_DS_in_ut:
336  m0_storage_dev_space(dev, &sp);
337  /* any storage device must update total stats */
338  if (m0_addu64_will_overflow(rep->sspr_total_disk,
339  sp.sds_total_size))
340  return M0_ERR(-EOVERFLOW);
341  rep->sspr_total_disk += sp.sds_total_size;
342  /*
343  * skip the device that's not online.
344  * TODO: EOS-5495 - Device status is not recieved from hare,
345  * isd_ha_state is default value(M0_NC_UNKNOWN) because not
346  * updated by hare, ignore the device check if blocksize is
347  * non zero.
348  * 'sp.sds_block_size == 0' will be removed once hare updates
349  * the device status.
350  */
351  if (sp.sds_block_size == 0 && dev->isd_ha_state != M0_NC_ONLINE)
352  continue;
353  m0_bcount_t free_space;
354  if (~((m0_bcount_t)0) / sp.sds_block_size <
355  sp.sds_free_blocks)
356  return M0_ERR(-EOVERFLOW);
357  free_space = sp.sds_free_blocks * sp.sds_block_size;
358  if (m0_addu64_will_overflow(rep->sspr_free_disk, free_space))
359  return M0_ERR(-EOVERFLOW);
360  rep->sspr_free_disk += free_space;
361  m0_bcount_t avail_space = sp.sds_avail_blocks *
362  sp.sds_block_size;
363  if (m0_addu64_will_overflow(rep->sspr_avail_disk, avail_space))
364  return M0_ERR(-EOVERFLOW);
365  rep->sspr_avail_disk += avail_space;
366  } m0_tl_endfor;
367 
368  return M0_RC(0);
369 }
370 
371 static int ss_process_stats(struct m0_reqh *reqh,
372  struct m0_ss_process_rep *rep)
373 {
374  int rc;
375 
376  M0_ENTRY();
378  /* see if ioservice is up and running */
379  if (rc == 0 && ss_ioservice_find(reqh) != NULL)
381  return M0_RC(rc);
382 }
383 
385  struct m0_ss_process_rep *rep)
386 {
387  int rc;
388  struct m0_buf *key_buf = NULL;
389  struct m0_buf *rec_buf = NULL;
390 
391  /* DUMMY values */
392  if (M0_FI_ENABLED("dummy_bytecount_data")) {
393  struct m0_cob_bckey key;
394  struct m0_cob_bcrec rec;
395 
396  key.cbk_pfid = M0_FID_TINIT('v', 1, 8);
397  key.cbk_user_id = 8881212;
398  rec.cbr_bytecount = 10240000;
399  rec.cbr_cob_objects = 10000;
400  rep->sspr_kv_count = 1;
401  m0_buf_new_aligned(&rep->sspr_bckey, &key, sizeof(key), 0);
402  m0_buf_new_aligned(&rep->sspr_bcrec, &rec, sizeof(rec), 0);
403 
404  return 0;
405  }
406 
407  rc = m0_cob_bc_entries_dump(cdom, &key_buf, &rec_buf, &rep->sspr_kv_count);
408  if (rc == 0) {
409  m0_buf_init(&rep->sspr_bckey, key_buf->b_addr, key_buf->b_nob);
410  m0_buf_init(&rep->sspr_bcrec, rec_buf->b_addr, rec_buf->b_nob);
411  }
412 
413  return rc;
414 }
415 static int ss_process_counter(struct m0_reqh *reqh,
416  struct m0_ss_process_rep *rep)
417 {
418  struct m0_cob_domain *cdom;
419  int rc;
420 
421  M0_ENTRY();
422  if (ss_ioservice_find(reqh) != NULL) {
425  } else
426  rc = -ESRCH;
427  return M0_RC(rc);
428 }
429 #endif
430 
432 
443 static int ss_process_quiesce(struct m0_reqh *reqh)
444 {
445  struct m0_reqh_service *svc;
446 
447  M0_PRE(reqh != NULL);
451 
452  m0_tl_for(m0_reqh_svc, &reqh->rh_services, svc) {
453  M0_LOG(M0_DEBUG, "type:%d level:%d [%s] name:%s",
454  svc->rs_type->rst_typecode, svc->rs_type->rst_level,
455  svc->rs_type->rst_keep_alive ? "+" : "-",
456  svc->rs_type->rst_name);
457  /* Do not stop vital services like SSS, RPC, HA link, etc. */
458  if (svc->rs_type->rst_keep_alive)
459  continue;
462  } m0_tl_endfor;
463 
464  return M0_RC(0);
465 }
466 
467 #ifndef __KERNEL__
469  struct m0_buf *buf)
470 {
471  struct m0_ss_process_svc_item *reply_svc;
472 
473  buf->b_nob = sizeof(struct m0_fid) + strlen(svc->rs_type->rst_name) + 1;
474  buf->b_addr = m0_alloc(buf->b_nob);
475  if (buf->b_addr == NULL)
476  return M0_ERR(-ENOMEM);
477 
478  reply_svc = (struct m0_ss_process_svc_item *)buf->b_addr;
479  reply_svc->ssps_fid = svc->rs_service_fid;
480  strcpy(reply_svc->ssps_name, svc->rs_type->rst_name);
481 
482  return M0_RC(0);
483 }
484 
485 static int
487  struct m0_reqh *reqh)
488 {
489  struct m0_reqh_service *svc;
490  int i;
491  int rc;
492 
493  M0_PRE(reqh != NULL);
498  i = m0_tl_reduce(m0_reqh_svc, svc, &reqh->rh_services, 0,
500 
501  fop->sspr_services.ab_count = i;
502  M0_ALLOC_ARR(fop->sspr_services.ab_elems, i);
503  if (fop->sspr_services.ab_elems == NULL)
504  return M0_RC(-ENOMEM);
505 
506  i = 0;
507  rc = 0;
508  m0_tl_for(m0_reqh_svc, &reqh->rh_services, svc) {
511  &fop->sspr_services.ab_elems[i]);
512  if (rc != 0)
513  break;
514  i++;
515  }
516  } m0_tl_endfor;
518  return M0_RC(rc);
519 }
520 #else
521 static int
523  struct m0_reqh *reqh)
524 {
525  return M0_RC(0);
526 }
527 #endif /* __KERNEL__ */
528 
530 {
531  struct m0_chan *chan;
532 
535  m0_fom_wait_on(&pfom->spm_fom, chan, &pfom->spm_fom.fo_cb);
537 }
538 
540 {
541  struct m0_sss_process_fom *pfom;
542 
543  pfom = M0_AMB(pfom, fom, spm_fom);
546  return false;
547  }
548  return true;
549 }
550 
552 {
553  struct m0_sss_process_fom *pfom = M0_AMB(pfom, fom, spm_fom);
554  struct m0_reqh *reqh = m0_fom_reqh(fom);
555  struct m0_ss_process_req *req;
556  int rc;
557 
558  M0_ENTRY();
559 
561  if (rc == 0) {
563  req = m0_ss_fop_process_req(fom->fo_fop);
564  m0_confc_open_by_fid(&pfom->spm_confc_ctx, &req->ssp_id);
565  }
566  return M0_RC(rc);
567 }
568 
569 static int ss_process_reconfig(struct m0_fom *fom)
570 {
571 #ifndef __KERNEL__
572  int rc;
573  struct m0_sss_process_fom *pfom;
574  struct m0_conf_process *process;
575  int pid = getpid();
576  struct m0_proc_attr *proc_attr;
577  struct m0_confc_ctx *confc_ctx;
578 
579  M0_ENTRY();
580 
581  proc_attr = &m0_get()->i_proc_attr;
582  pfom = M0_AMB(pfom, fom, spm_fom);
583  confc_ctx = &pfom->spm_confc_ctx;
584  rc = m0_confc_ctx_error_lock(confc_ctx);
585  if (rc == 0)
586  process = M0_CONF_CAST(m0_confc_ctx_result(confc_ctx),
589 
590  if (rc != 0)
591  return M0_ERR(rc);
592 
593  if (process != NULL) {
594  *proc_attr = (struct m0_proc_attr){
595  .pca_memlimit_as = process->pc_memlimit_as,
596  .pca_memlimit_rss = process->pc_memlimit_rss,
597  .pca_memlimit_stack = process->pc_memlimit_stack,
598  .pca_memlimit_memlock = process->pc_memlimit_memlock,
599  };
600  rc = m0_bitmap_init(&proc_attr->pca_core_mask,
601  process->pc_cores.b_nr);
602  if (rc == 0)
603  m0_bitmap_copy(&proc_attr->pca_core_mask,
604  &process->pc_cores);
605  } else {
606  M0_SET0(proc_attr);
607  }
608 
609  m0_confc_close(&process->pc_obj);
610 
611  if (!M0_FI_ENABLED("unit_test"))
612  kill(pid, SIGUSR1);
613 
614  return M0_RC(rc);
615 #else
616  return M0_ERR(-ENOENT);
617 #endif
618 }
619 
620 static int ss_process_lib_load(struct m0_fom *fom)
621 {
622 #if !defined(__KERNEL__)
623  struct m0_sss_process_fom *pfom = M0_AMB(pfom, fom, spm_fom);
624  struct m0_ss_process_req *req = m0_ss_fop_process_req(fom->fo_fop);
625  char *libname = req->ssp_param.b_addr;
626  char *last = &libname[req->ssp_param.b_nob - 1];
627  void *handle;
628 
629  M0_ENTRY();
630  /*
631  * Space-terminated strings are allowed, because m0console is called
632  * from a shell and a typical shell cannot handle NUL character.
633  */
634  if (*last == ' ')
635  *last = 0;
636  /* Check that the libname is NUL-terminated. */
637  if (*last != 0)
638  return M0_ERR(-EPROTO);
639  handle = dlopen(libname, RTLD_NOW | RTLD_GLOBAL);
640  if (handle != NULL) {
641  void (*initcall)(void) = dlsym(handle, "motr_lib_init");
642  if (initcall != NULL)
643  (*initcall)();
644  return M0_RC(0);
645  } else
646  return M0_ERR_INFO(-EINVAL, "libname: %s: %s", libname,
647  dlerror());
648 #else
649 
650  return M0_ERR(-ENOSYS);
651 #endif
652 }
653 
654 static int ss_process_fom_tail(struct m0_fom *fom, int rc)
655 {
656  /*
657  * fop data can be m0_ss_process_rep or m0_ss_process_svc_list_rep, but
658  * we only care that the first field is the error code, which is always
659  * the case for replies, see the assertion in m0_fop_type_init().
660  */
661  struct m0_ss_process_rep *rep = m0_fop_data(fom->fo_rep_fop);
662 
663  rep->sspr_rc = rc;
665  return M0_FSO_AGAIN;
666 }
667 
668 static int ss_process_fom_tick(struct m0_fom *fom)
669 {
670  struct m0_reqh *reqh;
671  struct m0_ss_process_rep *rep;
672  struct m0_ss_process_svc_list_rep *rep_list;
673  int rc;
674 
675  M0_ENTRY("fom %p, state %d", fom, m0_fom_phase(fom));
676  M0_PRE(fom != NULL);
677 
678  if (m0_fom_phase(fom) < M0_FOPH_NR)
679  return m0_fom_tick_generic(fom);
680 
681  reqh = m0_fom_reqh(fom);
682  rep = m0_fop_data(fom->fo_rep_fop);
683  switch (m0_fom_phase(fom)) {
684  case SS_PROCESS_FOM_INIT:
686  if (rc != 0)
687  return ss_process_fom_tail(fom, rc);
688  else
689  return M0_FSO_AGAIN;
690  case SS_PROCESS_FOM_STOP:
696  return ss_process_fom_tail(fom,
697 #ifndef __KERNEL__
698  0
699 #else
700  M0_ERR(-ENOSYS)
701 #endif
702  );
704  return ss_process_fom_tail(fom,
705  ss_process_health(reqh, &rep->sspr_health) ?:
707 
709  return ss_process_fom_tail(fom,
710  ss_process_health(reqh, &rep->sspr_health) ?:
716  m0_fom_phase_moveif(fom, rep->sspr_rc,
719  return rep->sspr_rc == 0 ? M0_FSO_WAIT : M0_FSO_AGAIN;
723  return M0_FSO_AGAIN;
724  }
725  return M0_FSO_WAIT;
729  rep_list = m0_ss_fop_process_svc_list_rep(fom->fo_rep_fop);
730  return ss_process_fom_tail(fom,
732  reqh));
735  default:
736  M0_IMPOSSIBLE("Invalid phase");
737  }
738  return M0_FSO_AGAIN;
739 }
740 
741 static size_t ss_process_fom_home_locality(const struct m0_fom *fom)
742 {
743  return 1;
744 }
745 
746 
747 #undef M0_TRACE_SUBSYSTEM
748 
749 /*
750  * Local variables:
751  * c-indentation-style: "K&R"
752  * c-basic-offset: 8
753  * tab-width: 8
754  * fill-column: 80
755  * scroll-step: 1
756  * End:
757  */
M0_INTERNAL int m0_reqh_service_state_get(const struct m0_reqh_service *s)
Definition: reqh_service.c:560
void m0_fom_phase_moveif(struct m0_fom *fom, int32_t rc, int phase0, int phase1)
Definition: fom.c:1710
const struct m0_fom_type_ops ss_process_fom_type_ops
Definition: process_foms.c:87
M0_INTERNAL int m0_buf_new_aligned(struct m0_buf *buf, const void *data, uint32_t nob, unsigned shift)
Definition: buf.c:61
struct m0_be_domain * bs_domain
Definition: seg.h:82
#define M0_PRE(cond)
ss_process_fom_phases
Definition: process_foms.c:68
#define M0_ALLOC_ARR(arr, nr)
Definition: memory.h:84
M0_INTERNAL int m0_bitmap_init(struct m0_bitmap *map, size_t nr)
Definition: bitmap.c:86
static int ss_bytecount_stats_ingest(struct m0_cob_domain *cdom, struct m0_ss_process_rep *rep)
Definition: process_foms.c:384
#define NULL
Definition: misc.h:38
struct m0_fid ssps_fid
Definition: process_fops.h:137
static struct m0_reqh_service * ss_ioservice_find(struct m0_reqh *reqh)
Definition: process_foms.c:276
m0_bcount_t sds_free_blocks
Definition: storage_dev.h:273
static int ss_fop_process_svc_list_fill(struct m0_ss_process_svc_list_rep *fop, struct m0_reqh *reqh)
Definition: process_foms.c:486
M0_INTERNAL struct m0_conf_obj * m0_confc_ctx_result(struct m0_confc_ctx *ctx)
Definition: confc.c:771
Definition: sm.h:350
void * b_addr
Definition: buf.h:39
ss_fom_phases
Definition: ss_svc.h:118
static struct io_request req
Definition: file.c:100
static int ss_ios_stats_ingest(struct m0_ss_process_rep *rep)
Definition: process_foms.c:313
int(* fo_tick)(struct m0_fom *fom)
Definition: fom.h:663
uint64_t pc_memlimit_memlock
Definition: obj.h:588
M0_INTERNAL void m0_fop_init(struct m0_fop *fop, struct m0_fop_type *fopt, void *data, void(*fop_release)(struct m0_ref *))
Definition: fop.c:79
struct m0_be_allocator bs_allocator
Definition: seg.h:81
struct m0_sm_conf ss_process_fom_conf
Definition: process_foms.c:143
#define M0_LOG(level,...)
Definition: trace.h:167
M0_LEAVE()
M0_INTERNAL void m0_reqh_service_prepare_to_stop(struct m0_reqh_service *service)
Definition: reqh_service.c:375
struct m0_sm fc_mach
Definition: confc.h:538
M0_INTERNAL bool m0_ss_fop_is_process_req(const struct m0_fop *fop)
Definition: process_fops.c:177
static int ss_process_reconfig_data_get(struct m0_fom *fom)
Definition: process_foms.c:551
int(* fto_create)(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
Definition: fom.h:650
M0_INTERNAL void m0_ios_cdom_get(struct m0_reqh *reqh, struct m0_cob_domain **out)
Definition: io_service.c:463
static m0_bcount_t segs[NR *IT]
Definition: vec.c:45
M0_INTERNAL void m0_buf_init(struct m0_buf *buf, void *data, uint32_t nob)
Definition: buf.c:37
M0_INTERNAL void m0_be_alloc_stats(struct m0_be_allocator *a, struct m0_be_allocator_stats *out)
Definition: alloc.c:1159
static void ss_process_fom_fini(struct m0_fom *fom)
Definition: process_foms.c:213
enum m0_ha_obj_state isd_ha_state
Definition: storage_dev.h:92
void * m0_fop_data(const struct m0_fop *fop)
Definition: fop.c:220
Allocator statistics.
Definition: alloc.h:114
static bool m0_addu64_will_overflow(uint64_t a, uint64_t b)
Definition: arith.h:235
M0_INTERNAL int32_t m0_confc_ctx_error_lock(const struct m0_confc_ctx *ctx)
Definition: confc.c:765
M0_INTERNAL void m0_fom_wait_on(struct m0_fom *fom, struct m0_chan *chan, struct m0_fom_callback *cb)
Definition: fom.c:1490
#define M0_BITS(...)
Definition: misc.h:236
uint64_t m0_bcount_t
Definition: types.h:77
struct m0_tl rh_services
Definition: reqh.h:127
M0_INTERNAL struct m0 * m0_get(void)
Definition: instance.c:41
M0_INTERNAL void m0_chan_lock(struct m0_chan *ch)
Definition: chan.c:68
M0_INTERNAL void m0_confc_open_by_fid(struct m0_confc_ctx *ctx, const struct m0_fid *fid)
Definition: confc.c:930
static int ss_process_counter(struct m0_reqh *reqh, struct m0_ss_process_rep *rep)
Definition: process_foms.c:415
#define M0_SET0(obj)
Definition: misc.h:64
static int ss_process_fom_tail(struct m0_fom *fom, int rc)
Definition: process_foms.c:654
static int ss_process_quiesce(struct m0_reqh *reqh)
Definition: process_foms.c:443
struct m0_rwlock rh_rwlock
Definition: reqh.h:143
struct m0_fop_getxattr_rep * rep
Definition: dir.c:455
static struct m0_cob_domain * cdom
Definition: xform.c:55
m0_fom_phase
Definition: fom.h:372
Definition: sock.c:887
struct m0_fom_type ft_fom_type
Definition: fop.h:232
M0_INTERNAL struct m0_reqh_service_type * m0_reqh_service_type_find(const char *sname)
Definition: reqh_service.c:168
static int ss_process_stats(struct m0_reqh *reqh, struct m0_ss_process_rep *rep)
Definition: process_foms.c:371
#define m0_tl_endfor
Definition: tlist.h:700
uint64_t pc_memlimit_as
Definition: obj.h:585
return M0_RC(rc)
struct m0_tl sds_devices
Definition: storage_dev.h:132
static bool ss_process_confc_ctx_completed(struct m0_fom *fom)
Definition: process_foms.c:539
#define M0_ENTRY(...)
Definition: trace.h:170
Definition: buf.h:37
void m0_fom_init(struct m0_fom *fom, const struct m0_fom_type *fom_type, const struct m0_fom_ops *ops, struct m0_fop *fop, struct m0_fop *reply, struct m0_reqh *reqh)
Definition: fom.c:1372
int i
Definition: dir.c:1033
static int ss_process_fom_tick(struct m0_fom *fom)
Definition: process_foms.c:668
struct m0_fop_type * f_type
Definition: fop.h:81
uint64_t pc_memlimit_stack
Definition: obj.h:587
struct m0_rpc_machine * m0_fop_rpc_machine(const struct m0_fop *fop)
Definition: fop.c:360
#define M0_ERR_INFO(rc, fmt,...)
Definition: trace.h:215
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL struct m0_confc * m0_reqh2confc(struct m0_reqh *reqh)
Definition: reqh.c:753
#define M0_FID_TINIT(type, container, key)
Definition: fid.h:90
#define M0_AMB(obj, ptr, field)
Definition: misc.h:320
M0_INTERNAL void m0_confc_ctx_fini(struct m0_confc_ctx *ctx)
Definition: confc.c:716
int m0_fom_tick_generic(struct m0_fom *fom)
Definition: fom_generic.c:848
static int ss_fop_process_svc_to_buf(struct m0_reqh_service *svc, struct m0_buf *buf)
Definition: process_foms.c:468
static struct m0_fom_ops ss_process_fom_ops
Definition: process_foms.c:81
void m0_fom_fini(struct m0_fom *fom)
Definition: fom.c:1324
m0_bcount_t b_nob
Definition: buf.h:38
M0_TL_DESCR_DECLARE(seg, M0_EXTERN)
const char * scf_name
Definition: sm.h:352
const char * rst_name
Definition: reqh_service.h:447
Definition: tlist.h:251
struct m0_reqh_service_type m0_ios_type
Definition: io_service.c:112
static struct m0_stob_domain * dom
Definition: storage.c:38
struct m0_fop_type m0_fop_process_rep_fopt
Definition: process_fops.c:43
struct m0_fop_type m0_fop_process_svc_list_rep_fopt
Definition: process_fops.c:44
M0_INTERNAL int m0_confc_ctx_init(struct m0_confc_ctx *ctx, struct m0_confc *confc)
Definition: confc.c:643
M0_INTERNAL struct m0_ss_process_req * m0_ss_fop_process_req(struct m0_fop *fop)
Definition: process_fops.c:183
M0_INTERNAL bool m0_confc_ctx_is_completed_lock(const struct m0_confc_ctx *ctx)
Definition: confc.c:749
void * m0_alloc(size_t size)
Definition: memory.c:126
Definition: reqh.h:94
struct m0_bitmap pc_cores
Definition: obj.h:584
enum m0_conf_service_type isd_srv_type
Definition: storage_dev.h:94
Definition: dump.c:103
Definition: chan.h:229
M0_INTERNAL int m0_fop_data_alloc(struct m0_fop *fop)
Definition: fop.c:71
#define M0_CONF_CAST(ptr, type)
Definition: obj.h:780
Definition: seg.h:66
M0_INTERNAL struct m0_storage_devs * m0_cs_storage_devs_get(void)
Definition: setup.c:1783
M0_INTERNAL void m0_chan_unlock(struct m0_chan *ch)
Definition: chan.c:73
M0_INTERNAL void m0_bitmap_copy(struct m0_bitmap *dst, const struct m0_bitmap *src)
Definition: bitmap.c:158
M0_INTERNAL int m0_reqh_state_get(struct m0_reqh *reqh)
Definition: reqh.c:398
uint32_t sd_flags
Definition: sm.h:378
static int ss_be_segs_stats_ingest(struct m0_be_domain *dom, struct m0_ss_process_rep *rep)
Definition: process_foms.c:289
Definition: fom.h:481
struct m0_conf_obj pc_obj
Definition: obj.h:581
M0_INTERNAL struct m0_reqh_service * m0_reqh_service_find(const struct m0_reqh_service_type *st, const struct m0_reqh *reqh)
Definition: reqh_service.c:538
m0_bcount_t sds_block_size
Definition: storage_dev.h:274
struct m0_reqh reqh
Definition: rm_foms.c:48
struct m0_reqh_service_type m0_rpc_service_type
Definition: service.c:120
struct m0_bitmap pca_core_mask
Definition: process_attr.h:54
static struct m0_chan chan[RDWR_REQUEST_MAX]
#define M0_FI_ENABLED(tag)
Definition: finject.h:231
Definition: fid.h:38
M0_INTERNAL void m0_storage_dev_space(struct m0_storage_dev *dev, struct m0_storage_space *space)
Definition: storage_dev.c:674
uint64_t cbr_bytecount
Definition: cob.h:522
M0_INTERNAL void m0_fop_release(struct m0_ref *ref)
Definition: fop.c:148
#define M0_ALLOC_PTR(ptr)
Definition: memory.h:86
struct m0_chan sm_chan
Definition: sm.h:331
Definition: beck.c:130
static struct m0_net_test_service svc
Definition: service.c:34
static int ss_process_reconfig(struct m0_fom *fom)
Definition: process_foms.c:569
struct m0_confc_ctx spm_confc_ctx
Definition: process_foms.c:151
m0_bcount_t sds_avail_blocks
Definition: storage_dev.h:275
M0_INTERNAL void m0_rwlock_read_lock(struct m0_rwlock *lock)
Definition: rwlock.c:52
static struct m0_fop * fop
Definition: item.c:57
#define IS_IN_ARRAY(idx, array)
Definition: misc.h:311
struct m0_be_seg * rh_beseg
Definition: reqh.h:112
struct m0_proc_attr i_proc_attr
Definition: instance.h:143
static struct m0_be_seg * seg
Definition: btree.c:40
M0_INTERNAL void m0_confc_close(struct m0_conf_obj *obj)
Definition: confc.c:921
static void ss_process_confc_ctx_arm(struct m0_sss_process_fom *pfom)
Definition: process_foms.c:529
uint64_t cbr_cob_objects
Definition: cob.h:523
M0_INTERNAL void m0_rwlock_read_unlock(struct m0_rwlock *lock)
Definition: rwlock.c:57
M0_INTERNAL void m0_ss_process_stop_fop_release(struct m0_ref *ref)
Definition: process_fops.c:137
M0_INTERNAL int m0_cob_bc_entries_dump(struct m0_cob_domain *cdom, struct m0_buf **out_keys, struct m0_buf **out_recs, uint32_t *out_count)
Definition: cob.c:496
#define out(...)
Definition: gen.c:41
void m0_fom_phase_set(struct m0_fom *fom, int phase)
Definition: fom.c:1688
size_t b_nr
Definition: bitmap.h:44
m0_bcount_t sds_total_size
Definition: storage_dev.h:276
struct m0_rpc_machine * ri_rmachine
Definition: item.h:160
#define m0_tl_for(name, head, obj)
Definition: tlist.h:695
void m0_free(void *data)
Definition: memory.c:146
M0_INTERNAL struct m0_ss_process_svc_list_rep * m0_ss_fop_process_svc_list_rep(struct m0_fop *fop)
Definition: process_fops.c:200
uint64_t pc_memlimit_rss
Definition: obj.h:586
struct m0_rpc_item f_item
Definition: fop.h:83
int32_t rc
Definition: trigger_fop.h:47
struct m0_fom spm_fom
Definition: process_foms.c:150
#define ARRAY_SIZE(a)
Definition: misc.h:45
struct m0_fom_callback fo_cb
Definition: fom.h:488
static int ss_process_fom_create(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
Definition: process_foms.c:154
static int ss_process_health(struct m0_reqh *reqh, int32_t *h)
Definition: process_foms.c:251
Definition: fop.h:79
static struct m0_addb2_frame_header last
Definition: storage.c:93
static int ss_process_lib_load(struct m0_fom *fom)
Definition: process_foms.c:620
uint64_t pca_memlimit_as
Definition: process_attr.h:56
M0_INTERNAL struct m0_reqh * m0_fom_reqh(const struct m0_fom *fom)
Definition: fom.c:283
Definition: idx_mock.c:47
#define M0_IMPOSSIBLE(fmt,...)
static int ss_process_fom_tick__init(struct m0_fom *fom, const struct m0_reqh *reqh)
Definition: process_foms.c:227
static size_t ss_process_fom_home_locality(const struct m0_fom *fom)
Definition: process_foms.c:741
#define M0_UNUSED
Definition: misc.h:380