Motr  M0
isc.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_ISCS
24 #include "lib/trace.h"
25 
26 #include "lib/hash.h"
27 #include "lib/memory.h"
28 #include "lib/chan.h"
29 #include "lib/finject.h"
30 #include "fop/fom.h"
31 #include "fop/fom_generic.h"
32 #include "reqh/reqh.h"
33 #include "reqh/reqh_service.h"
34 #include "rpc/rpc_opcodes.h"
35 #include "rpc/rpc_machine.h"
36 #ifndef __KERNEL__
37 #include "ioservice/fid_convert.h" /* m0_fid_convert_cob2stob */
38 #include "ioservice/storage_dev.h" /* m0_storage_dev_stob_find */
39 #include "motr/setup.h" /* m0_cs_storage_devs_get */
40 #endif
41 #include "conf/helpers.h" /* m0_confc_root_open */
42 #include "conf/diter.h" /* m0_conf_diter_next_sync */
43 #include "conf/obj_ops.h" /* M0_CONF_DIRNEXT */
44 #include "spiel/spiel.h" /* m0_spiel_process_lib_load */
45 #include "iscservice/isc.h"
46 #include "iscservice/isc_service.h"
47 
48 static void isc_comp_cleanup(struct m0_fom *fom, int rc, int next_phase);
49 static int comp_ref_get(struct m0_htable *comp_ht, struct m0_isc_comp_req *req);
50 static void comp_ref_put(struct m0_htable *comp_ht, struct m0_isc_comp *comp);
51 
52 /*
53  * Represents phases associated with a fom associated with
54  * the remote invocation of a registered computation.
55  */
71 };
72 
74  [ISC_PREPARE] = {
75  .sd_name = "prepare",
76  .sd_allowed = M0_BITS(ISC_LOAD_ARGS, M0_FOPH_FAILURE)
77  },
78  [ISC_LOAD_ARGS] = {
79  .sd_name = "load-arguments",
80  .sd_allowed = M0_BITS(ISC_ARGS_LOAD_DONE)
81  },
82  [ISC_ARGS_LOAD_DONE] = {
83  .sd_name = "args-load-done",
85  },
86  [ISC_COMP_LAUNCH] = {
87  .sd_name = "comp-launch",
88  .sd_allowed = M0_BITS(ISC_RET_VAL, M0_FOPH_FAILURE)
89  },
90  [ISC_RET_VAL] = {
91  .sd_name = "ret-val",
92  .sd_allowed = M0_BITS(ISC_RET_VAL_DONE)
93  },
94  [ISC_RET_VAL_DONE] = {
95  .sd_name = "ret-val-done",
96  .sd_allowed = M0_BITS(ISC_DONE, M0_FOPH_FAILURE)
97  },
98  [ISC_DONE] = {
99  .sd_name = "done",
100  .sd_allowed = M0_BITS(M0_FOPH_SUCCESS)
101  }
102 };
103 
104 static size_t fom_home_locality(const struct m0_fom *fom)
105 {
106  static int cnt = 0;
107 
108  /* Distribute all reqs evenly among all available localities. */
109  return cnt++;
110 }
111 
112 static struct m0_rpc_machine *fom_rmach(const struct m0_fom *fom)
113 {
114  return fom->fo_fop->f_item.ri_session->s_conn->c_rpc_machine;
115 }
116 
117 static bool is_alignment_required(struct m0_isc_comp_req *comp_req)
118 {
119  struct m0_fop_isc *fop_isc;
120  struct m0_rpc_machine *rmach;
121 
122  if (comp_req->icr_req_type == M0_ICRT_LOCAL)
123  return false;
124 
125  fop_isc = m0_fop_data(comp_req->icr_fom.fo_fop);
126  rmach = fom_rmach(&comp_req->icr_fom);
127  /* Caller is expecting bulk-io. */
128  return (fop_isc->fi_ret.ab_type == M0_RPC_AT_BULK_RECV ||
129  /* Reply size is too large for inline buffer. */
130  comp_req->icr_result.b_nob > rmach->rm_bulk_cutoff) &&
131  !m0_is_aligned((uint64_t)comp_req->icr_result.b_addr,
132  M0_0VEC_ALIGN);
133 }
134 
135 static int isc_comp_launch(struct m0_isc_comp_req *comp_req, struct m0_fom *fom,
136  int next_phase)
137 {
138  struct m0_isc_comp *comp;
139  struct m0_buf buf;
140  int result;
141  int rc;
142 
143  comp = m0_cookie_of(&comp_req->icr_cookie, struct m0_isc_comp, ic_gen);
144  /* Launching is expected only after initialisation of the cookie. */
145  M0_ASSERT(comp != NULL);
146  result = comp->ic_op(&comp_req->icr_args, &comp_req->icr_result,
147  &comp_req->icr_comp_data, &rc);
148  M0_ASSERT(M0_IN(result, (M0_FSO_AGAIN, M0_FSO_WAIT)));
149  M0_LOG(M0_DEBUG, "ic_op(): rc=%d", rc);
150  /*
151  * In case a re-invocation of a computation is necessary, phase
152  * is not changed.
153  */
154  if (rc == -EAGAIN)
155  return result;
156 
157  if (rc != 0)
158  goto err;
159 
160  /*
161  * In case result is conveyed using rpc bulk adjust the
162  * memory alignment of result.
163  */
164  if (is_alignment_required(comp_req)) {
165  M0_SET0(&buf);
166  rc = m0_buf_copy_aligned(&buf, &comp_req->icr_result,
167  M0_0VEC_SHIFT);
168  m0_buf_free(&comp_req->icr_result);
169  if (rc == 0)
170  comp_req->icr_result = buf;
171  }
172 
173  if (M0_FI_ENABLED("oom")) {
174  rc = M0_ERR(-ENOMEM);
175  goto err;
176  }
177  m0_fom_phase_set(fom, next_phase);
178  /* Override only if computation was successful. */
179  comp_req->icr_rc = comp_req->icr_rc ?: rc;
180 
181  return result;
182  err:
183  if (comp_req->icr_result.b_nob > 0)
184  m0_buf_free(&comp_req->icr_result);
185  comp_req->icr_rc = rc;
186  return M0_FSO_AGAIN;
187 }
188 
189 static void isc_comp_prepare(struct m0_isc_comp_req *comp_req,
190  struct m0_fom *fom,
191  int next_phase0, int next_phase1)
192 {
193  struct m0_htable *comp_ht = m0_isc_htable_get();
194  int rc;
195 
196  m0_hbucket_lock(comp_ht, &comp_req->icr_comp_fid);
197  rc = comp_ref_get(comp_ht, comp_req);
198  m0_hbucket_unlock(comp_ht, &comp_req->icr_comp_fid);
199 
200  if (rc == 0)
201  m0_fom_phase_set(fom, next_phase0);
202  else {
203  m0_fom_phase_move(fom, M0_ERR(rc), next_phase1);
204  comp_req->icr_rc = rc;
205  }
206 }
207 
208 static int isc_fom_tick(struct m0_fom *fom)
209 {
210  struct m0_isc_comp_req *comp_req = M0_AMB(comp_req, fom, icr_fom);
211  struct m0_fop_isc *fop_isc = m0_fop_data(fom->fo_fop);
212  struct m0_fop_isc_rep *reply_isc = m0_fop_data(fom->fo_rep_fop);
213  struct m0_buf *comp_args = &comp_req->icr_args;
214  struct m0_buf *comp_res = &comp_req->icr_result;
215  int phase = m0_fom_phase(fom);
216  int rc = 0;
217  int result = M0_FSO_AGAIN;
218 
219  M0_ENTRY("fom %p phase %d", fom, m0_fom_phase(fom));
220 
221  switch (phase) {
222  case M0_FOPH_INIT ... M0_FOPH_NR - 1:
223  result = m0_fom_tick_generic(fom);
224  break;
225  case ISC_PREPARE:
227  reply_isc->fir_rc = comp_req->icr_rc;
228  break;
229  case ISC_LOAD_ARGS:
230  result = m0_rpc_at_load(&fop_isc->fi_args, fom,
232  reply_isc->fir_comp_cookie = comp_req->icr_cookie;
233  break;
234  case ISC_ARGS_LOAD_DONE:
235  rc = m0_rpc_at_get(&fop_isc->fi_args, comp_args);
236  if (rc == 0)
238  else
240  break;
241  case ISC_COMP_LAUNCH:
242  result = isc_comp_launch(comp_req, fom, ISC_RET_VAL);
243  reply_isc->fir_rc = comp_req->icr_rc;
244  if (comp_req->icr_rc != 0)
245  isc_comp_cleanup(fom, M0_ERR(comp_req->icr_rc),
247  break;
248  case ISC_RET_VAL:
249  m0_rpc_at_init(&reply_isc->fir_ret);
250  result = m0_rpc_at_reply(&fop_isc->fi_ret, &reply_isc->fir_ret,
251  comp_res, fom, ISC_RET_VAL_DONE);
252  break;
253  case ISC_RET_VAL_DONE:
254  rc = m0_rpc_at_reply_rc(&reply_isc->fir_ret);
255  /*
256  * Ignore the case when a successful computation does not
257  * have a buffer to send.
258  */
259  if (M0_IN(rc, (0, -ENODATA)))
261  else
263  break;
264  case ISC_DONE:
266  break;
267  }
268  return result;
269 }
270 
271 static void isc_fom_fini(struct m0_fom *fom)
272 {
273  struct m0_isc_comp_req *comp_req = M0_AMB(comp_req, fom, icr_fom);
274  struct m0_fop_isc *fop_isc = m0_fop_data(fom->fo_fop);
275 
276  m0_rpc_at_fini(&fop_isc->fi_args);
277  m0_fom_fini(fom);
278  m0_free(comp_req);
279 }
280 
281 static const struct m0_fom_ops isc_fom_ops = {
282  .fo_tick = &isc_fom_tick,
283  .fo_home_locality = &fom_home_locality,
284  .fo_fini = &isc_fom_fini
285 };
286 
287 static int isc_fom_create(struct m0_fop *fop, struct m0_fom **out,
288  struct m0_reqh *reqh)
289 {
290  struct m0_isc_comp_req *comp_req;
291  struct m0_fom *fom;
292  struct m0_fop_isc *fop_isc = m0_fop_data(fop);
293  struct m0_fop *reply_isc;
294  struct m0_buf in_buf;
295 
296  M0_PRE(fop != NULL && fop->f_type != NULL && out != NULL);
297 
298  M0_ALLOC_PTR(comp_req);
299  if (comp_req == NULL)
300  return M0_ERR(-ENOMEM);
302  if (reply_isc == NULL) {
303  m0_free(comp_req);
304  return M0_ERR(-ENOMEM);
305  }
306  m0_buf_init(&in_buf, NULL, 0);
307  m0_isc_comp_req_init(comp_req, &in_buf, &fop_isc->fi_comp_id,
308  &fop_isc->fi_comp_cookie, M0_ICRT_REMOTE, reqh);
309  fom = &comp_req->icr_fom;
310  *out = fom;
312  reply_isc, reqh);
313  return M0_RC(0);
314 }
315 
316 static void isc_comp_cleanup(struct m0_fom *fom, int rc, int next_phase)
317 {
318  struct m0_isc_comp_req *comp_req = M0_AMB(comp_req, fom, icr_fom);
319  struct m0_htable *comp_ht = m0_isc_htable_get();
320  struct m0_isc_comp *comp;
321  struct m0_fop_isc_rep *reply_isc;
322 
323  comp = m0_cookie_of(&comp_req->icr_cookie, struct m0_isc_comp, ic_gen);
324  M0_ASSERT(comp != NULL);
325  m0_hbucket_lock(comp_ht, &comp_req->icr_comp_fid);
326  comp_ref_put(comp_ht, comp);
327  m0_hbucket_unlock(comp_ht, &comp_req->icr_comp_fid);
328  /*
329  * Override the result of computation only if
330  * it has completed successfully.
331  */
332  comp_req->icr_rc = comp_req->icr_rc ?: rc;
333  if (comp_req->icr_req_type == M0_ICRT_REMOTE) {
334  reply_isc = m0_fop_data(fom->fo_rep_fop);
335  reply_isc->fir_rc = comp_req->icr_rc;
336  }
337  m0_fom_phase_move(fom, rc, next_phase);
338 }
339 
340 static int comp_ref_get(struct m0_htable *comp_ht,
341  struct m0_isc_comp_req *comp_req)
342 {
343  struct m0_cookie *cookie = &comp_req->icr_cookie;
344  struct m0_fid *fid = &comp_req->icr_comp_fid;
345  struct m0_isc_comp *comp;
346 
347  comp = m0_cookie_of(cookie, struct m0_isc_comp, ic_gen);
348  if (comp == NULL)
349  comp = m0_isc_htable_lookup(comp_ht, fid);
350  if (comp == NULL) {
351  *cookie = M0_COOKIE_NULL;
352  return M0_ERR_INFO(-ENOENT, "Computation not found");
353  }
354  if (comp->ic_reg_state == M0_ICS_UNREGISTERED ||
355  M0_FI_ENABLED("unregister")) {
356  *cookie = M0_COOKIE_NULL;
357  return M0_ERR_INFO(-EINVAL, "Computation is already"
358  "unregistered");
359  }
360  m0_cookie_init(cookie, &comp->ic_gen);
361  M0_CNT_INC(comp->ic_ref_count);
362 
363  return 0;
364 }
365 
366 static void comp_cleanup(struct m0_htable *comp_ht, struct m0_isc_comp *comp)
367 {
368  m0_isc_htable_del(comp_ht, comp);
369  m0_isc_tlink_fini(comp);
370  m0_free(comp->ic_name);
371  m0_free(comp);
372 }
373 
374 static void comp_ref_put(struct m0_htable *comp_ht, struct m0_isc_comp *comp)
375 {
376  M0_CNT_DEC(comp->ic_ref_count);
377  if (comp->ic_ref_count == 0 &&
379  comp_cleanup(comp_ht, comp);
380 }
381 
384 };
385 
387  .scf_name = "isc-fom",
388  .scf_nr_states = ARRAY_SIZE(isc_fom_phases),
389  .scf_state = isc_fom_phases,
390 };
391 
398 };
399 
401  [EP_PREPARE] = {
403  .sd_name = "prepare",
404  .sd_allowed = M0_BITS(EP_EXEC, EP_FAIL, EP_COMPLETE)
405  },
406  [EP_EXEC] = {
407  .sd_name = "launch-computation",
408  .sd_allowed = M0_BITS(EP_COMPLETE, EP_FAIL)
409  },
410  [EP_COMPLETE] = {
411  .sd_name = "computation-completes",
412  .sd_allowed = M0_BITS(EP_FINI)
413  },
414  [EP_FAIL] = {
415  .sd_flags = M0_SDF_FAILURE,
416  .sd_name = "failure-in-launch",
417  .sd_allowed = M0_BITS(EP_FINI),
418  },
419  [EP_FINI] = {
420  .sd_flags = M0_SDF_TERMINAL,
421  .sd_name = "computation-finalize",
422  .sd_allowed = 0
423  }
424 };
425 
426 static const struct m0_sm_conf comp_exec_fom_states_conf = {
427  .scf_name = "computation-execution-fom",
428  .scf_nr_states = ARRAY_SIZE(comp_exec_fom_states),
429  .scf_state = comp_exec_fom_states,
430 };
431 
434  .fto_create = NULL,
435 };
436 
437 static int ce_fom_tick(struct m0_fom *fom)
438 {
439  struct m0_isc_comp_req *comp_req = M0_AMB(comp_req, fom, icr_fom);
440  int phase = m0_fom_phase(fom);
441  int result = M0_FSO_AGAIN;
442 
443  switch (phase) {
444  case EP_PREPARE:
445  isc_comp_prepare(comp_req, fom, EP_EXEC, EP_FAIL);
446  break;
447  case EP_EXEC:
448  result = isc_comp_launch(comp_req, fom, EP_COMPLETE);
449  if (comp_req->icr_rc != 0)
450  isc_comp_cleanup(fom, M0_ERR(comp_req->icr_rc),
451  EP_FAIL);
452  break;
453  case EP_FAIL:
455  result = M0_FSO_WAIT;
456  break;
457  case EP_COMPLETE:
459  result = M0_FSO_WAIT;
460  break;
461  }
462  return result;
463 }
464 
465 static void ce_fom_fini(struct m0_fom *fom)
466 {
467  struct m0_isc_comp_req *comp_req;
468 
469  comp_req = M0_AMB(comp_req, fom, icr_fom);
470  m0_fom_fini(fom);
471  m0_chan_broadcast_lock(&comp_req->icr_chan);
472 }
473 
474 static const struct m0_fom_ops comp_exec_fom_ops = {
476  .fo_tick = ce_fom_tick,
477  .fo_fini = ce_fom_fini
478 };
479 
480 M0_INTERNAL void m0_isc_fom_type_init(void)
481 {
485 }
486 
487 static bool isc_comp_req_invariant(const struct m0_isc_comp_req *comp_req)
488 {
489  return _0C(comp_req != NULL) &&
490  _0C(m0_fid_is_set(&comp_req->icr_comp_fid)) &&
491  _0C(comp_req->icr_reqh != NULL) &&
492  _0C(M0_IN(comp_req->icr_req_type, (M0_ICRT_LOCAL,
493  M0_ICRT_REMOTE)));
494 
495 }
496 
497 M0_INTERNAL int m0_isc_comp_req_exec(struct m0_isc_comp_req *comp_req)
498 {
499  struct m0_reqh_service *svc_isc;
500  int rc = 0;
501 
502  M0_ENTRY();
503 
504  M0_PRE(isc_comp_req_invariant(comp_req));
505 
506  svc_isc = m0_reqh_service_find(&m0_iscs_type, comp_req->icr_reqh);
507  if (svc_isc == NULL)
508  return M0_ERR_INFO(-EINVAL, "Service does not exist");
510  NULL, NULL, comp_req->icr_reqh);
511  m0_fom_queue(&comp_req->icr_fom);
512 
513  M0_LEAVE();
514  return M0_RC(rc);
515 }
516 
517 M0_INTERNAL int m0_isc_comp_req_exec_sync(struct m0_isc_comp_req *comp_req)
518 {
519  struct m0_clink waiter;
520  int rc;
521 
522  M0_ENTRY();
523 
524  m0_clink_init(&waiter, NULL);
525  m0_clink_add_lock(&comp_req->icr_chan, &waiter);
526  waiter.cl_is_oneshot = true;
527  rc = m0_isc_comp_req_exec(comp_req);
528  if (rc != 0) {
529  m0_clink_del_lock(&waiter);
530  return M0_RC(rc);
531  }
532  m0_chan_wait(&waiter);
533  M0_LEAVE();
534  return M0_RC(rc);
535 }
536 
537 M0_INTERNAL void m0_isc_comp_req_init(struct m0_isc_comp_req *comp_req,
538  const struct m0_buf *comp_args,
539  const struct m0_fid *comp_fid,
540  const struct m0_cookie *comp_cookie,
541  enum m0_isc_comp_req_type comp_req_type,
542  struct m0_reqh *reqh)
543 {
544  M0_PRE(comp_req != NULL && comp_args != NULL && comp_fid != NULL &&
545  comp_cookie != NULL && reqh != NULL);
546 
547  M0_ENTRY();
548  M0_SET0(comp_req);
549 
550  m0_buf_copy(&comp_req->icr_args, comp_args);
551  comp_req->icr_comp_fid = *comp_fid;
552  comp_req->icr_cookie = *comp_cookie;
553  comp_req->icr_reqh = reqh;
554  comp_req->icr_req_type = comp_req_type;
555  comp_req->icr_comp_data.icp_fom = &comp_req->icr_fom;
556  m0_chan_init(&comp_req->icr_chan, &comp_req->icr_guard);
557 
558  M0_POST(isc_comp_req_invariant(comp_req));
559  M0_LEAVE();
560 }
561 
562 static bool is_request_local(struct m0_isc_comp_req *comp_req)
563 {
564  return comp_req->icr_req_type == M0_ICRT_LOCAL;
565 }
566 
567 M0_INTERNAL void m0_isc_comp_req_fini(struct m0_isc_comp_req *comp_req)
568 {
569  M0_PRE(comp_req != NULL);
570  M0_ENTRY();
571 
572  m0_buf_free(&comp_req->icr_args);
573  if (is_request_local(comp_req))
574  m0_buf_free(&comp_req->icr_result);
575  m0_chan_fini_lock(&comp_req->icr_chan);
576  M0_LEAVE();
577 }
578 
579 static int comp_register(struct m0_htable *comp_ht,
580  int (*ftn)(struct m0_buf *arg_in,
581  struct m0_buf *args_out,
582  struct m0_isc_comp_private
583  *comp_data, int *rc),
584  char *comp_name,
585  const struct m0_fid *fid)
586 {
587  struct m0_isc_comp *comp;
588 
589  comp = m0_isc_htable_lookup(comp_ht, fid);
590  if (comp != NULL)
591  return M0_ERR_INFO(-EEXIST, "Computation %s already registered"
592  " for fid "FID_F, comp->ic_name,
593  FID_P(&comp->ic_fid));
594  M0_ALLOC_PTR(comp);
595  if (comp == NULL)
596  return M0_ERR(-ENOMEM);
597  comp->ic_fid = *fid;
598  comp->ic_op = ftn;
599  comp->ic_name = comp_name;
600  m0_cookie_new(&comp->ic_gen);
602  m0_isc_tlink_init(comp);
603  m0_isc_htable_add(comp_ht, comp);
604  M0_LOG(M0_INFO, "Computation %s with id "FID_F" registered.",
605  comp->ic_name, FID_P(&comp->ic_fid));
606  return 0;
607 }
608 
609 M0_INTERNAL int m0_isc_comp_register(int (*ftn)(struct m0_buf *arg_in,
610  struct m0_buf *args_out,
611  struct m0_isc_comp_private
612  *comp_data, int *rc),
613  const char *f_name,
614  const struct m0_fid *ftn_fid)
615 {
616  struct m0_htable *comp_ht = m0_isc_htable_get();
617  char *comp_name;
618  int rc = 0;
619 
620  M0_PRE(ftn != NULL && ftn_fid != NULL);
621  M0_PRE(m0_htable_is_init(comp_ht));
622  M0_ENTRY();
623 
624  comp_name = m0_strdup(f_name);
625  if (comp_name == NULL)
626  return M0_ERR(-ENOMEM);
627  m0_hbucket_lock(comp_ht, ftn_fid);
628  rc = comp_register(comp_ht, ftn, comp_name, ftn_fid);
629  m0_hbucket_unlock(comp_ht, ftn_fid);
630 
631  M0_LEAVE();
632  return M0_RC(rc);
633 }
634 
635 static void comp_unregister(struct m0_htable *comp_ht, const struct m0_fid *fid)
636 {
637  struct m0_isc_comp *comp;
638 
639  comp = m0_isc_htable_lookup(comp_ht, fid);
640  M0_ASSERT(comp != NULL);
641 
642  M0_LOG(M0_INFO, "Computation %s with id "FID_F" unregistered.",
643  comp->ic_name, FID_P(&comp->ic_fid));
644  if (comp->ic_ref_count > 0) {
646  return;
647  }
648  comp_cleanup(comp_ht, comp);
649  return;
650 }
651 
652 M0_INTERNAL void m0_isc_comp_unregister(const struct m0_fid *fid)
653 {
654  struct m0_htable *comp_ht = m0_isc_htable_get();
655  struct m0_fid comp_fid = *fid;
656 
657  M0_PRE(fid != NULL);
658  M0_PRE(m0_htable_is_init(comp_ht));
659  M0_ENTRY();
660 
661  m0_hbucket_lock(comp_ht, &comp_fid);
662  comp_unregister(comp_ht, &comp_fid);
663  m0_hbucket_unlock(comp_ht, &comp_fid);
664 
665  M0_LEAVE();
666 }
667 
668 M0_INTERNAL int m0_isc_comp_state_probe(const struct m0_fid *fid)
669 {
670  struct m0_htable *comp_ht = m0_isc_htable_get();
671  struct m0_isc_comp *comp;
672  int state;
673 
674  M0_PRE(fid != NULL);
675  M0_PRE(m0_htable_is_init(comp_ht));
676  M0_ENTRY();
677 
678  m0_hbucket_lock(comp_ht, fid);
679  comp = m0_isc_htable_lookup(comp_ht, fid);
680  if (comp == NULL) {
681  m0_hbucket_unlock(comp_ht, fid);
682  return M0_ERR(-ENOENT);
683  }
684  state = comp->ic_reg_state;
685  m0_hbucket_unlock(comp_ht, fid);
687 
688  M0_LEAVE();
689  return state;
690 }
691 
692 static int isc_spiel_prepare(struct m0_spiel *spiel, struct m0_fid *profile,
693  struct m0_reqh *reqh)
694 {
695  int rc;
696  char profile_str[M0_FID_STR_LEN];
697 
699  if (rc != 0)
700  return M0_ERR_INFO(rc, "spiel initialisation failed");
701 
702  snprintf(profile_str, M0_FID_STR_LEN, FID_F, FID_P(profile));
703  rc = m0_spiel_cmd_profile_set(spiel, profile_str);
704  if (rc != 0) {
706  return M0_ERR_INFO(rc, "invalid profile: %s",
707  (char*)profile_str);
708  }
709 
711  if (rc != 0) {
713  return M0_ERR_INFO(rc, "rconfc startup failed");
714  }
715 
716  return 0;
717 }
718 
719 static void isc_spiel_destroy(struct m0_spiel *spiel)
720 {
723 }
724 
725 static bool conf_obj_is_svc(const struct m0_conf_obj *obj)
726 {
728 }
729 
730 M0_INTERNAL int m0_isc_lib_register(const char *libpath, struct m0_fid *profile,
731  struct m0_reqh *reqh)
732 {
733  int rc;
734  struct m0_confc *confc;
735  struct m0_conf_root *root = NULL;
736  struct m0_conf_process *proc;
737  struct m0_conf_service *svc;
738  struct m0_conf_diter it;
739  struct m0_spiel *spiel_inst;
740 
741  M0_ALLOC_PTR(spiel_inst);
742  if (spiel_inst == NULL)
743  return M0_ERR(-ENOMEM);
744 
745  rc = isc_spiel_prepare(spiel_inst, profile, reqh);
746  if (rc != 0) {
747  m0_free(spiel_inst);
748  return M0_ERR_INFO(rc, "spiel initialization failed");
749  }
750 
753  if (rc != 0) {
754  M0_ERR_INFO(rc, "configuration open failed");
755  goto out;
756  }
757 
759  &root->rt_obj,
760  M0_CONF_ROOT_NODES_FID,
761  M0_CONF_NODE_PROCESSES_FID,
762  M0_CONF_PROCESS_SERVICES_FID);
763  if (rc != 0)
764  goto out;
765 
766  while (M0_CONF_DIRNEXT ==
768 
770  if (svc->cs_type != M0_CST_ISCS)
771  continue;
772  proc = M0_CONF_CAST(m0_conf_obj_grandparent(&svc->cs_obj),
774  rc = m0_spiel_process_lib_load(spiel_inst, &proc->pc_obj.co_id,
775  libpath);
776  if (rc != 0) {
777  M0_ERR_INFO(rc, "loading of %s library failed for "
778  "process "FID_F, libpath,
779  FID_P(&proc->pc_obj.co_id));
780  break;
781  }
782  }
783 
785  out:
786  if (root != NULL)
788  isc_spiel_destroy(spiel_inst);
789  m0_free(spiel_inst);
790 
791  return rc;
792 }
793 
794 #ifndef __KERNEL__
795 static void bufvec_pack(struct m0_bufvec *bv, uint32_t shift)
796 {
797  uint32_t i;
798 
799  for (i = 0; i < bv->ov_vec.v_nr; i++) {
800  bv->ov_vec.v_count[i] >>= shift;
801  bv->ov_buf[i] = m0_stob_addr_pack(bv->ov_buf[i], shift);
802  }
803 }
804 
805 static void bufvec_open(struct m0_bufvec *bv, uint32_t shift)
806 {
807  uint32_t i;
808 
809  for (i = 0; i < bv->ov_vec.v_nr; i++) {
810  bv->ov_vec.v_count[i] <<= shift;
811  bv->ov_buf[i] = m0_stob_addr_open(bv->ov_buf[i], shift);
812  }
813 }
814 
815 static int bufvec_alloc_init(struct m0_bufvec *bv, struct m0_io_indexvec *iiv,
816  uint32_t shift)
817 {
818  int rc;
819  int i;
820  char *p;
821 
822  p = m0_alloc_aligned(m0_io_count(iiv), shift);
823  if (p == NULL)
824  return M0_ERR_INFO(-ENOMEM, "failed to allocate buf");
825 
826  rc = m0_bufvec_empty_alloc(bv, iiv->ci_nr);
827  if (rc != 0) {
828  m0_free(p);
829  return M0_ERR_INFO(rc, "failed to allocate bufvec");
830  }
831 
832  for (i = 0; i < iiv->ci_nr; i++) {
833  bv->ov_buf[i] = p;
834  bv->ov_vec.v_count[i] = iiv->ci_iosegs[i].ci_count;
835  p += iiv->ci_iosegs[i].ci_count;
836  }
837 
838  return 0;
839 }
840 
841 M0_INTERNAL int m0_isc_io_launch(struct m0_stob_io *stio,
842  struct m0_fid *cob,
843  struct m0_io_indexvec *iv,
844  struct m0_fom *fom)
845 {
846  int rc;
847  uint32_t shift = 0;
848  struct m0_stob_id stob_id;
849  struct m0_stob *stob = NULL;
850 
851  if (iv->ci_nr == 0) {
852  rc = M0_ERR_INFO(-EINVAL, "no io segments given");
853  goto err;
854  }
855 
856  m0_stob_io_init(stio);
857  stio->si_opcode = SIO_READ;
858 
859  m0_fid_convert_cob2stob(cob, &stob_id);
861  &stob_id, &stob);
862  if (rc != 0) {
863  M0_ERR_INFO(rc, "failed to find stob by cob="FID_F, FID_P(cob));
864  goto err;
865  }
866 
867  shift = m0_stob_block_shift(stob);
868  stio->si_obj = stob; /* for m0_isc_io_fini() in case of err */
869 
870  rc = m0_indexvec_wire2mem(iv, iv->ci_nr, shift, &stio->si_stob);
871  if (rc != 0) {
872  M0_ERR_INFO(rc, "failed to make cob ivec");
873  goto err;
874  }
875 
876  rc = bufvec_alloc_init(&stio->si_user, iv, shift);
877  if (rc != 0) {
878  M0_ERR_INFO(rc, "failed to allocate bufvec");
879  goto err;
880  }
881 
882  bufvec_pack(&stio->si_user, shift);
883 
885  if (rc != 0) {
886  M0_ERR_INFO(rc, "failed to setup adio for stob="FID_F,
887  FID_P(&stob->so_id.si_fid));
888  goto err;
889  }
890 
891  /* make sure the fom is waked up on I/O completion */
892  m0_mutex_lock(&stio->si_mutex);
893  m0_fom_wait_on(fom, &stio->si_wait, &fom->fo_cb);
894  m0_mutex_unlock(&stio->si_mutex);
895 
897  if (rc != 0) {
898  m0_mutex_lock(&stio->si_mutex);
899  m0_fom_callback_cancel(&fom->fo_cb);
900  m0_mutex_unlock(&stio->si_mutex);
901  M0_ERR_INFO(rc, "failed to launch io for stob="FID_F,
902  FID_P(&stob->so_id.si_fid));
903  }
904  err:
905  if (rc != 0 && stob != NULL) {
906  bufvec_open(&stio->si_user, shift);
907  m0_isc_io_fini(stio);
908  }
909 
910  return rc;
911 }
912 
913 M0_INTERNAL int64_t m0_isc_io_res(struct m0_stob_io *stio, char **buf)
914 {
915  uint32_t shift = m0_stob_block_shift(stio->si_obj);
916 
917  bufvec_open(&stio->si_user, shift);
918  *buf = stio->si_user.ov_buf[0];
919 
920  return stio->si_count << shift;
921 }
922 
923 M0_INTERNAL void m0_isc_io_fini(struct m0_stob_io *stio)
924 {
925  struct m0_stob *stob = stio->si_obj;
926 
927  m0_indexvec_free(&stio->si_stob);
928  m0_free(stio->si_user.ov_buf[0]);
929  m0_bufvec_free2(&stio->si_user);
930  m0_stob_io_fini(stio);
932 }
933 #endif /* !__KERNEL__ */
934 
935 
936 #undef M0_TRACE_SUBSYSTEM
937 
938 /*
939  * Local variables:
940  * c-indentation-style: "K&R"
941  * c-basic-offset: 8
942  * tab-width: 8
943  * fill-column: 80
944  * scroll-step: 1
945  * End:
946  */
const struct m0_conf_obj_type * m0_conf_obj_type(const struct m0_conf_obj *obj)
Definition: obj.c:363
M0_INTERNAL int m0_buf_copy_aligned(struct m0_buf *dst, const struct m0_buf *src, unsigned shift)
Definition: buf.c:119
struct m0_fid co_id
Definition: obj.h:208
int m0_spiel_cmd_profile_set(struct m0_spiel *spiel, const char *profile_str)
Definition: spiel.c:100
uint32_t ic_ref_count
Definition: isc_service.h:69
uint64_t ci_count
Definition: vec.h:627
static struct m0_rpc_machine * fom_rmach(const struct m0_fom *fom)
Definition: isc.c:112
m0_isc_comp_req_type
Definition: isc.h:145
static struct m0_addb2_philter p
Definition: consumer.c:40
M0_INTERNAL void m0_chan_wait(struct m0_clink *link)
Definition: chan.c:336
uint64_t ic_gen
Definition: isc_service.h:57
#define M0_PRE(cond)
struct m0_sm_conf isc_sm_conf
Definition: isc.c:386
static const struct m0_fom_type_ops comp_exec_fom_type_ops
Definition: isc.c:433
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
Definition: mutex.c:66
struct m0_buf icr_result
Definition: isc.h:165
#define m0_strdup(s)
Definition: string.h:43
M0_INTERNAL void m0_chan_broadcast_lock(struct m0_chan *chan)
Definition: chan.c:178
M0_INTERNAL void m0_stob_io_fini(struct m0_stob_io *io)
Definition: io.c:122
struct m0_fop * fo_fop
Definition: fom.h:490
Definition: isc.c:395
#define NULL
Definition: misc.h:38
static int isc_fom_create(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
Definition: isc.c:287
M0_INTERNAL void m0_clink_init(struct m0_clink *link, m0_chan_cb_t cb)
Definition: chan.c:201
M0_INTERNAL void m0_clink_del_lock(struct m0_clink *link)
Definition: chan.c:293
Definition: isc.c:394
M0_INTERNAL int m0_storage_dev_stob_find(struct m0_storage_devs *devs, struct m0_stob_id *sid, struct m0_stob **stob)
Definition: storage_dev.c:868
Definition: sm.h:350
void * b_addr
Definition: buf.h:39
M0_INTERNAL void m0_storage_dev_stob_put(struct m0_storage_devs *devs, struct m0_stob *stob)
Definition: storage_dev.c:912
static struct io_request req
Definition: file.c:100
int(* fo_tick)(struct m0_fom *fom)
Definition: fom.h:663
struct m0_conf_obj rt_obj
Definition: obj.h:372
#define M0_LOG(level,...)
Definition: trace.h:167
M0_LEAVE()
M0_INTERNAL void m0_rpc_at_init(struct m0_rpc_at_buf *ab)
Definition: at.c:433
static void isc_comp_prepare(struct m0_isc_comp_req *comp_req, struct m0_fom *fom, int next_phase0, int next_phase1)
Definition: isc.c:189
static void isc_fom_fini(struct m0_fom *fom)
Definition: isc.c:271
const struct m0_conf_obj_type M0_CONF_SERVICE_TYPE
Definition: service.c:156
int32_t fir_rc
Definition: isc_fops.h:75
struct m0_rpc_at_buf fir_ret
Definition: isc_fops.h:79
struct m0_fom icr_fom
Definition: isc.h:191
struct m0_chan icr_chan
Definition: isc.h:189
void m0_spiel_fini(struct m0_spiel *spiel)
Definition: spiel.c:59
struct m0_vec ov_vec
Definition: vec.h:147
int(* fto_create)(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
Definition: fom.h:650
M0_INTERNAL bool m0_htable_is_init(const struct m0_htable *htable)
Definition: hash.c:127
M0_INTERNAL void m0_buf_init(struct m0_buf *buf, void *data, uint32_t nob)
Definition: buf.c:37
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
exec_fom_phases
Definition: isc.c:392
void m0_spiel_rconfc_stop(struct m0_spiel *spiel)
Definition: spiel.c:91
M0_INTERNAL int m0_isc_comp_req_exec_sync(struct m0_isc_comp_req *comp_req)
Definition: isc.c:517
void * m0_fop_data(const struct m0_fop *fop)
Definition: fop.c:220
static struct m0_be_emap_cursor it
Definition: extmap.c:46
M0_INTERNAL void m0_indexvec_free(struct m0_indexvec *ivec)
Definition: vec.c:553
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
struct m0_chan si_wait
Definition: io.h:318
struct m0_cookie fi_comp_cookie
Definition: isc_fops.h:69
int icr_rc
Definition: isc.h:171
static int void * buf
Definition: dir.c:1019
M0_INTERNAL int m0_rpc_at_load(struct m0_rpc_at_buf *ab, struct m0_fom *fom, int next_phase)
Definition: at.c:414
#define M0_SET0(obj)
Definition: misc.h:64
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
Definition: mutex.c:49
uint32_t ci_nr
Definition: vec.h:635
const struct m0_fom_type_ops m0_fom_isc_type_ops
Definition: isc.c:382
M0_INTERNAL bool m0_fid_is_set(const struct m0_fid *fid)
Definition: fid.c:106
static void isc_spiel_destroy(struct m0_spiel *spiel)
Definition: isc.c:719
void ** ov_buf
Definition: vec.h:149
static struct foo * obj
Definition: tlist.c:302
m0_fom_phase
Definition: fom.h:372
Definition: sock.c:887
M0_INTERNAL int m0_rpc_at_reply(struct m0_rpc_at_buf *in, struct m0_rpc_at_buf *out, struct m0_buf *repbuf, struct m0_fom *fom, int next_phase)
Definition: at.c:528
struct m0_fom_type ft_fom_type
Definition: fop.h:232
M0_INTERNAL void m0_hbucket_unlock(struct m0_htable *htable, const void *key)
Definition: hash.c:226
struct m0_fom * icp_fom
Definition: isc.h:134
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)
M0_INTERNAL uint32_t m0_stob_block_shift(struct m0_stob *stob)
Definition: stob.c:270
static bool is_request_local(struct m0_isc_comp_req *comp_req)
Definition: isc.c:562
struct m0_bufvec si_user
Definition: io.h:300
static const struct m0_fom_ops isc_fom_ops
Definition: isc.c:281
#define M0_ENTRY(...)
Definition: trace.h:170
Definition: buf.h:37
static const struct m0_sm_conf comp_exec_fom_states_conf
Definition: isc.c:426
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
M0_INTERNAL void m0_hbucket_lock(struct m0_htable *htable, const void *key)
Definition: hash.c:215
static void bufvec_open(struct m0_bufvec *bv, uint32_t shift)
Definition: isc.c:805
int i
Definition: dir.c:1033
static int isc_comp_launch(struct m0_isc_comp_req *comp_req, struct m0_fom *fom, int next_phase)
Definition: isc.c:135
struct m0_fop_type * f_type
Definition: fop.h:81
static int comp_register(struct m0_htable *comp_ht, int(*ftn)(struct m0_buf *arg_in, struct m0_buf *args_out, struct m0_isc_comp_private *comp_data, int *rc), char *comp_name, const struct m0_fid *fid)
Definition: isc.c:579
struct m0_fid icr_comp_fid
Definition: isc.h:167
#define M0_ERR_INFO(rc, fmt,...)
Definition: trace.h:215
struct m0_conf_root * root
Definition: note.c:50
return M0_ERR(-EOPNOTSUPP)
m0_bcount_t rm_bulk_cutoff
Definition: rpc_machine.h:157
struct m0_reqh_service_type m0_iscs_type
Definition: isc_service.c:76
M0_INTERNAL int64_t m0_isc_io_res(struct m0_stob_io *stio, char **buf)
Definition: isc.c:913
Definition: trace.h:482
Definition: cnt.h:36
struct m0_fop_type m0_fop_isc_rep_fopt
Definition: isc_fops.c:34
M0_INTERNAL struct m0_confc * m0_reqh2confc(struct m0_reqh *reqh)
Definition: reqh.c:753
#define M0_AMB(obj, ptr, field)
Definition: misc.h:320
static int ce_fom_tick(struct m0_fom *fom)
Definition: isc.c:437
M0_INTERNAL int m0_stob_io_prepare_and_launch(struct m0_stob_io *io, struct m0_stob *obj, struct m0_dtx *tx, struct m0_io_scope *scope)
Definition: io.c:219
Definition: stob.h:163
struct m0_mutex icr_guard
Definition: isc.h:187
int m0_fom_tick_generic(struct m0_fom *fom)
Definition: fom_generic.c:848
M0_INTERNAL int m0_isc_comp_state_probe(const struct m0_fid *fid)
Definition: isc.c:668
struct m0_indexvec si_stob
Definition: io.h:311
void m0_fom_fini(struct m0_fom *fom)
Definition: fom.c:1324
static bool conf_obj_is_svc(const struct m0_conf_obj *obj)
Definition: isc.c:725
static struct m0_stob * stob
Definition: storage.c:39
M0_INTERNAL void m0_chan_init(struct m0_chan *chan, struct m0_mutex *ch_guard)
Definition: chan.c:96
m0_bcount_t b_nob
Definition: buf.h:38
static struct m0_cob * cob
Definition: bytecount.c:40
#define M0_ASSERT(cond)
static void comp_unregister(struct m0_htable *comp_ht, const struct m0_fid *fid)
Definition: isc.c:635
static int comp_ref_get(struct m0_htable *comp_ht, struct m0_isc_comp_req *req)
Definition: isc.c:340
const char * scf_name
Definition: sm.h:352
struct m0_reqh * icr_reqh
Definition: isc.h:192
static struct m0_confc * confc
Definition: file.c:94
int(* ic_op)(struct m0_buf *args_in, struct m0_buf *result, struct m0_isc_comp_private *comp_data, int *rc)
Definition: isc_service.h:62
static bool m0_is_aligned(uint64_t val, uint64_t alignment)
Definition: arith.h:179
static void comp_ref_put(struct m0_htable *comp_ht, struct m0_isc_comp *comp)
Definition: isc.c:374
M0_INTERNAL void m0_isc_fom_type_init(void)
Definition: isc.c:480
m0_isc_fom_phases
Definition: isc.c:56
struct m0_conf_obj * m0_conf_obj_grandparent(const struct m0_conf_obj *obj)
Definition: obj.c:384
void m0_fom_phase_move(struct m0_fom *fom, int32_t rc, int phase)
Definition: fom.c:1699
static void isc_comp_cleanup(struct m0_fom *fom, int rc, int next_phase)
Definition: isc.c:316
struct m0_fid fi_comp_id
Definition: isc_fops.h:57
M0_INTERNAL void m0_fid_convert_cob2stob(const struct m0_fid *cob_fid, struct m0_stob_id *stob_id)
Definition: fid_convert.c:141
M0_INTERNAL int m0_indexvec_wire2mem(struct m0_io_indexvec *wire_ivec, int max_frags_nr, uint32_t bshift, struct m0_indexvec *mem_ivec)
Definition: vec.c:1058
M0_INTERNAL void m0_fom_type_init(struct m0_fom_type *type, uint64_t id, const struct m0_fom_type_ops *ops, const struct m0_reqh_service_type *svc_type, const struct m0_sm_conf *sm)
Definition: fom.c:1596
struct m0_rpc_at_buf fi_args
Definition: isc_fops.h:63
M0_INTERNAL int m0_isc_lib_register(const char *libpath, struct m0_fid *profile, struct m0_reqh *reqh)
Definition: isc.c:730
M0_INTERNAL void * m0_stob_addr_pack(const void *buf, uint32_t shift)
Definition: io.c:293
static int bufvec_alloc_init(struct m0_bufvec *bv, struct m0_io_indexvec *iiv, uint32_t shift)
Definition: isc.c:815
struct m0_fid si_fid
Definition: stob.h:105
M0_INTERNAL int m0_rpc_at_get(const struct m0_rpc_at_buf *ab, struct m0_buf *buf)
Definition: at.c:399
struct m0_fid ic_fid
Definition: isc_service.h:51
M0_INTERNAL int m0_stob_io_private_setup(struct m0_stob_io *io, struct m0_stob *obj)
Definition: io.c:49
struct m0_cookie icr_cookie
Definition: isc.h:169
M0_INTERNAL int m0_rpc_at_reply_rc(struct m0_rpc_at_buf *out)
Definition: at.c:583
#define M0_POST(cond)
static size_t fom_home_locality(const struct m0_fom *fom)
Definition: isc.c:104
Definition: reqh.h:94
uint32_t v_nr
Definition: vec.h:51
Definition: dump.c:103
Definition: io.h:285
M0_INTERNAL void m0_buf_free(struct m0_buf *buf)
Definition: buf.c:55
m0_bcount_t * v_count
Definition: vec.h:53
#define M0_CONF_CAST(ptr, type)
Definition: obj.h:780
M0_INTERNAL int m0_isc_comp_req_exec(struct m0_isc_comp_req *comp_req)
Definition: isc.c:497
M0_INTERNAL struct m0_htable * m0_isc_htable_get(void)
Definition: isc_service.c:83
M0_INTERNAL int m0_buf_copy(struct m0_buf *dest, const struct m0_buf *src)
Definition: buf.c:104
#define FID_P(f)
Definition: fid.h:77
M0_INTERNAL struct m0_storage_devs * m0_cs_storage_devs_get(void)
Definition: setup.c:1783
m0_bcount_t si_count
Definition: io.h:340
M0_INTERNAL void m0_isc_comp_unregister(const struct m0_fid *fid)
Definition: isc.c:652
struct m0_stob * si_obj
Definition: io.h:326
static void ce_fom_fini(struct m0_fom *fom)
Definition: isc.c:465
static void bufvec_pack(struct m0_bufvec *bv, uint32_t shift)
Definition: isc.c:795
struct m0_mutex si_mutex
Definition: io.h:319
struct m0_fop * m0_fop_reply_alloc(struct m0_fop *req, struct m0_fop_type *rept)
Definition: fop.c:129
struct m0_cookie fir_comp_cookie
Definition: isc_fops.h:77
void m0_clink_add_lock(struct m0_chan *chan, struct m0_clink *link)
Definition: chan.c:255
enum m0_isc_comp_state ic_reg_state
Definition: isc_service.h:67
uint32_t sd_flags
Definition: sm.h:378
M0_INTERNAL struct m0_conf_obj * m0_conf_diter_result(const struct m0_conf_diter *it)
Definition: diter.c:576
Definition: fom.h:481
struct m0_conf_obj pc_obj
Definition: obj.h:581
static bool is_alignment_required(struct m0_isc_comp_req *comp_req)
Definition: isc.c:117
#define m0_conf_diter_init(iter, confc, origin,...)
Definition: diter.h:235
size_t(* fo_home_locality)(const struct m0_fom *fom)
Definition: fom.h:671
static bool isc_comp_req_invariant(const struct m0_isc_comp_req *comp_req)
Definition: isc.c:487
static void comp_cleanup(struct m0_htable *comp_ht, struct m0_isc_comp *comp)
Definition: isc.c:366
M0_INTERNAL void m0_isc_comp_req_fini(struct m0_isc_comp_req *comp_req)
Definition: isc.c:567
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
struct m0_reqh reqh
Definition: rm_foms.c:48
struct m0_sm_state_descr isc_fom_phases[]
Definition: isc.c:73
const char * sd_name
Definition: sm.h:383
static struct m0_fid profile
Definition: rconfc.c:49
M0_INTERNAL void m0_isc_io_fini(struct m0_stob_io *stio)
Definition: isc.c:923
int m0_spiel_rconfc_start(struct m0_spiel *spiel, m0_rconfc_cb_t expired_cb)
Definition: spiel.c:66
#define M0_CNT_INC(cnt)
Definition: arith.h:226
Definition: isc.c:70
#define M0_FI_ENABLED(tag)
Definition: finject.h:231
Definition: fid.h:38
M0_INTERNAL void * m0_stob_addr_open(const void *buf, uint32_t shift)
Definition: io.c:302
#define M0_ALLOC_PTR(ptr)
Definition: memory.h:86
struct m0_rpc_at_buf fi_ret
Definition: isc_fops.h:67
M0_INTERNAL void m0_conf_diter_fini(struct m0_conf_diter *it)
Definition: diter.c:313
struct m0_spiel spiel
Definition: spiel_conf_ut.c:42
M0_INTERNAL m0_bcount_t m0_io_count(const struct m0_io_indexvec *io_info)
Definition: vec.c:999
static struct m0_net_test_service svc
Definition: service.c:34
int m0_spiel_process_lib_load(struct m0_spiel *spl, const struct m0_fid *proc_fid, const char *libname)
Definition: cmd.c:892
#define _0C(exp)
Definition: assert.h:311
M0_INTERNAL void m0_rpc_at_fini(struct m0_rpc_at_buf *ab)
Definition: at.c:441
static struct m0_fop * fop
Definition: item.c:57
static const struct m0_fom_ops comp_exec_fom_ops
Definition: isc.c:474
M0_INTERNAL void m0_fom_callback_cancel(struct m0_fom_callback *cb)
Definition: fom.c:1514
M0_INTERNAL void m0_fom_queue(struct m0_fom *fom)
Definition: fom.c:624
M0_INTERNAL void m0_stob_io_init(struct m0_stob_io *io)
Definition: io.c:111
M0_INTERNAL void m0_confc_close(struct m0_conf_obj *obj)
Definition: confc.c:921
#define M0_CNT_DEC(cnt)
Definition: arith.h:219
Definition: isc.c:396
char * ic_name
Definition: isc_service.h:53
M0_INTERNAL void m0_isc_comp_req_init(struct m0_isc_comp_req *comp_req, const struct m0_buf *comp_args, const struct m0_fid *comp_fid, const struct m0_cookie *comp_cookie, enum m0_isc_comp_req_type comp_req_type, struct m0_reqh *reqh)
Definition: isc.c:537
static int isc_fom_tick(struct m0_fom *fom)
Definition: isc.c:208
struct m0_buf icr_args
Definition: isc.h:158
#define out(...)
Definition: gen.c:41
void m0_fom_phase_set(struct m0_fom *fom, int phase)
Definition: fom.c:1688
enum m0_isc_comp_req_type icr_req_type
Definition: isc.h:177
M0_INTERNAL void * m0_alloc_aligned(size_t size, unsigned shift)
Definition: memory.c:168
Definition: io.h:229
static int isc_spiel_prepare(struct m0_spiel *spiel, struct m0_fid *profile, struct m0_reqh *reqh)
Definition: isc.c:692
M0_INTERNAL void m0_chan_fini_lock(struct m0_chan *chan)
Definition: chan.c:112
void m0_free(void *data)
Definition: memory.c:146
M0_INTERNAL int m0_isc_comp_register(int(*ftn)(struct m0_buf *arg_in, struct m0_buf *args_out, struct m0_isc_comp_private *comp_data, int *rc), const char *f_name, const struct m0_fid *ftn_fid)
Definition: isc.c:609
struct m0_ioseg * ci_iosegs
Definition: vec.h:636
M0_INTERNAL void m0_bufvec_free2(struct m0_bufvec *bufvec)
Definition: vec.c:401
struct m0_sm_state_descr comp_exec_fom_states[]
Definition: isc.c:400
int32_t rc
Definition: trigger_fop.h:47
struct m0_isc_comp_private icr_comp_data
Definition: isc.h:186
#define ARRAY_SIZE(a)
Definition: misc.h:45
struct m0_stob_id so_id
Definition: stob.h:166
static struct m0_fom_type comp_exec_fom_type
Definition: isc.c:432
Definition: fop.h:79
int m0_spiel_init(struct m0_spiel *spiel, struct m0_reqh *reqh)
Definition: spiel.c:44
#define FID_F
Definition: fid.h:75
Definition: vec.h:145
M0_INTERNAL int m0_bufvec_empty_alloc(struct m0_bufvec *bufvec, uint32_t num_segs)
Definition: vec.c:213
uint32_t ab_type
Definition: at.h:251
M0_INTERNAL int m0_isc_io_launch(struct m0_stob_io *stio, struct m0_fid *cob, struct m0_io_indexvec *iv, struct m0_fom *fom)
Definition: isc.c:841
enum m0_stob_io_opcode si_opcode
Definition: io.h:286