Motr  M0
idx.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 #include "motr/client.h"
23 #include "motr/client_internal.h"
24 #include "motr/addb.h"
25 #include "motr/idx.h"
26 #include "motr/sync.h"
27 #include "dtm0/dtx.h" /* m0_dtm0_dtx_* API */
28 #include "dtm0/service.h" /* m0_dtm0_service_find */
29 
30 #include "lib/errno.h"
31 #include "lib/finject.h"
32 
33 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_CLIENT
34 #include "lib/trace.h"
35 
36 static struct m0_idx_service
38 
39 static void idx_op_cb_launch(struct m0_op_common *oc);
40 static void idx_op_cb_fini(struct m0_op_common *oc);
41 static void idx_op_cb_free(struct m0_op_common *oc);
42 static void idx_op_cb_cancel(struct m0_op_common *oc);
43 
44 const struct m0_bob_type oi_bobtype;
45 M0_BOB_DEFINE(M0_INTERNAL, &oi_bobtype, m0_op_idx);
46 const struct m0_bob_type oi_bobtype = {
47  .bt_name = "oi_bobtype",
48  .bt_magix_offset = offsetof(struct m0_op_idx, oi_magic),
49  .bt_magix = M0_OI_MAGIC,
50  .bt_check = NULL,
51 };
52 
59 static struct m0_client *
61 {
62  M0_PRE(oi != NULL);
63 
65 }
66 
74 M0_INTERNAL bool m0__idx_op_invariant(struct m0_op_idx *oi)
75 {
76  struct m0_op *op;
77 
78  if (oi != NULL)
79  op = &oi->oi_oc.oc_op;
80 
81  return _0C(oi != NULL) &&
82  _0C(M0_IN(op->op_code, (M0_EO_CREATE,
84  M0_IC_GET,
85  M0_IC_PUT,
86  M0_IC_DEL,
87  M0_IC_NEXT,
89  M0_IC_LIST))) &&
90  _0C(m0_op_idx_bob_check(oi)) &&
91  _0C(oi->oi_oc.oc_op.op_size >= sizeof *oi &&
92  m0_ast_rc_bob_check(&oi->oi_ar) &&
93  m0_op_common_bob_check(&oi->oi_oc));
94 }
95 
96 M0_INTERNAL struct m0_idx*
97 m0__idx_entity(struct m0_entity *entity)
98 {
99  struct m0_idx *idx;
100 
101  M0_PRE(entity != NULL);
102 
103  return M0_AMB(idx, entity, in_entity);
104 }
105 
106 M0_INTERNAL int
108  struct m0_pool_version **pv)
109 {
110  int rc;
111  struct m0_client *cinst;
112 
113  M0_ENTRY();
114 
115  if (pv == NULL)
116  return M0_ERR(-EINVAL);
117 
118  cinst = m0__idx_instance(idx);
119 
121  if (rc != 0)
122  return M0_ERR(rc);
123  return M0_RC(0);
124 }
125 
134 static int idx_pool_version_get(struct m0_op_idx *oi)
135 {
136  int rc;
137  struct m0_pool_version *pv;
138  struct m0_idx *idx;
139 
140  M0_ENTRY();
141  M0_PRE(oi != NULL);
142 
143  M0_PRE(M0_IN(OP_IDX2CODE(oi), (M0_EO_CREATE)));
144 
145  idx = m0__idx_entity(oi->oi_oc.oc_op.op_entity);
146 
147  rc = m0__idx_pool_version_get(idx, &pv);
148  if (rc != 0)
149  return M0_ERR(rc);
150  idx->in_attr.idx_pver = pv->pv_id;
151 
152  return M0_RC(0);
153 }
154 
165 static int idx_op_init(struct m0_idx *idx, int opcode,
166  struct m0_bufvec *keys, struct m0_bufvec *vals,
167  int32_t *rcs, uint32_t flags,
168  struct m0_op *op)
169 {
170  int rc;
171  struct m0_op_common *oc;
172  struct m0_op_idx *oi;
173  struct m0_entity *entity;
174  struct m0_locality *locality;
175  struct m0_client *m0c;
176  uint64_t cid;
177  uint64_t did;
178 
179  M0_ENTRY();
180 
181  M0_PRE(idx != NULL);
182  M0_PRE(op != NULL);
183 
184  /* Initialise the operation's generic part. */
185  entity = &idx->in_entity;
186  m0c = entity->en_realm->re_instance;
187  op->op_code = opcode;
188  rc = m0_op_init(op, &m0_op_conf, entity);
189  if (rc != 0)
190  return M0_ERR(rc);
191  /*
192  * Init m0_op_common part.
193  * bob_init()'s haven't been called yet: we use M0_AMB().
194  */
195  oc = M0_AMB(oc, op, oc_op);
196  m0_op_common_bob_init(oc);
201 
202  /* Init the m0_op_idx part. */
203  oi = M0_AMB(oi, oc, oi_oc);
204  oi->oi_idx = idx;
205  oi->oi_keys = keys;
206  oi->oi_vals = vals;
207  oi->oi_rcs = rcs;
208  oi->oi_flags = flags;
209 
211  M0_ASSERT(locality != NULL);
212  oi->oi_sm_grp = locality->lo_grp;
213  M0_SET0(&oi->oi_ar);
214 
215  m0_op_idx_bob_init(oi);
216  m0_ast_rc_bob_init(&oi->oi_ar);
217 
218  if (ENABLE_DTM0 && !(flags & M0_OIF_NO_DTM) &&
219  M0_IN(op->op_code, (M0_IC_PUT, M0_IC_DEL))) {
220  M0_ASSERT(m0c->m0c_dtms != NULL);
221  oi->oi_dtx = m0_dtx0_alloc(m0c->m0c_dtms, oi->oi_sm_grp);
222  if (oi->oi_dtx == NULL)
223  return M0_ERR(-ENOMEM);
224  did = m0_sm_id_get(&oi->oi_dtx->tx_dtx->dd_sm);
225  cid = m0_sm_id_get(&op->op_sm);
227  } else
228  oi->oi_dtx = NULL;
229 
230  if (opcode == M0_EO_CREATE && entity->en_type == M0_ET_IDX &&
231  entity->en_flags & M0_ENF_META) {
232  rc = idx_pool_version_get(oi);
233  if (rc != 0)
234  return M0_ERR(rc);
236  M0_LOG(M0_DEBUG, "DIX pool version at index create: "FID_F"",
237  FID_P(&idx->in_attr.idx_pver));
238  }
239 
240  return M0_RC(0);
241 }
242 
243 static struct m0_op_idx *ar_ast2oi(struct m0_sm_ast *ast)
244 {
245  struct m0_ast_rc *ar;
246  ar = bob_of(ast, struct m0_ast_rc, ar_ast, &ar_bobtype);
247  return bob_of(ar, struct m0_op_idx, oi_ar, &oi_bobtype);
248 }
249 
251  struct m0_sm_ast *ast,
252  uint64_t mask)
253 {
254  struct m0_op_idx *oi = ar_ast2oi(ast);
255  struct m0_op *op = &oi->oi_oc.oc_op;
256  struct m0_sm_group *op_grp = &op->op_sm_group;
257  struct m0_sm_group *en_grp = &op->op_entity->en_sm_group;
258 
259  M0_ENTRY("oi=%p, mask=%" PRIu64, oi, mask);
260 
261  M0_PRE(grp != NULL);
263  M0_PRE((mask & ~M0_BITS(M0_OS_EXECUTED, M0_OS_STABLE)) == 0);
264 
265  oi->oi_in_completion = true;
266 
267  if (M0_IN(op->op_code, (M0_EO_CREATE, M0_EO_DELETE))) {
268  m0_sm_group_lock(en_grp);
269  if (op->op_code == M0_EO_CREATE)
270  m0_sm_move(&op->op_entity->en_sm, 0, M0_ES_OPEN);
271  else if (op->op_code == M0_EO_DELETE)
272  m0_sm_move(&op->op_entity->en_sm, 0, M0_ES_INIT);
273  m0_sm_group_unlock(en_grp);
274  }
275 
276  m0_sm_group_lock(op_grp);
277  if ((mask & M0_BITS(M0_OS_EXECUTED)) != 0) {
278  m0_sm_move(&op->op_sm, 0, M0_OS_EXECUTED);
280  }
281  if ((mask & M0_BITS(M0_OS_STABLE)) != 0) {
282  m0_sm_move(&op->op_sm, 0, M0_OS_STABLE);
283  m0_op_stable(op);
284  if (oi->oi_dtx != NULL) {
285  m0_dtx0_done(oi->oi_dtx);
286  oi->oi_dtx = NULL;
287  }
288  }
289  m0_sm_group_unlock(op_grp);
290 
291  M0_LEAVE();
292 }
293 
294 M0_INTERNAL void idx_op_ast_stable(struct m0_sm_group *grp,
295  struct m0_sm_ast *ast)
296 {
298 }
299 
300 M0_INTERNAL void idx_op_ast_executed(struct m0_sm_group *grp,
301  struct m0_sm_ast *ast)
302 {
304 }
305 
312 M0_INTERNAL void idx_op_ast_complete(struct m0_sm_group *grp,
313  struct m0_sm_ast *ast)
314 {
317 }
318 
326 static void idx_op_fail(struct m0_op_idx *oi, int rc)
327 {
328  struct m0_op *op;
329  struct m0_sm_group *op_grp;
330  struct m0_sm_group *en_grp;
331 
332  M0_ENTRY();
333 
334  M0_PRE(oi != NULL);
335 
336  op = &oi->oi_oc.oc_op;
337 
338  op_grp = &op->op_sm_group;
339  en_grp = &op->op_entity->en_sm_group;
340 
341  oi->oi_in_completion = true;
342  m0_sm_group_lock(en_grp);
343 
344  if (op->op_code == M0_EO_CREATE)
345  m0_sm_move(&op->op_entity->en_sm, 0, M0_ES_OPEN);
346  else if (op->op_code == M0_EO_DELETE)
347  m0_sm_move(&op->op_entity->en_sm, 0, M0_ES_INIT);
348 
349  m0_sm_group_unlock(en_grp);
350 
351  m0_sm_group_lock(op_grp);
352  op->op_rc = rc;
353  m0_sm_move(&op->op_sm, 0, M0_OS_EXECUTED);
355  m0_sm_move(&op->op_sm, 0, M0_OS_STABLE);
356  m0_op_stable(op);
357  m0_sm_group_unlock(op_grp);
358 
359  M0_LEAVE();
360 }
361 
368 M0_INTERNAL void idx_op_ast_fail(struct m0_sm_group *grp,
369  struct m0_sm_ast *ast)
370 {
371  struct m0_op_idx *oi;
372  struct m0_ast_rc *ar;
373 
374  M0_ENTRY();
375 
376  M0_PRE(grp != NULL);
378  M0_PRE(ast != NULL);
379 
380  ar = bob_of(ast, struct m0_ast_rc, ar_ast, &ar_bobtype);
381  oi = bob_of(ar, struct m0_op_idx, oi_ar, &oi_bobtype);
382  idx_op_fail(oi, ar->ar_rc);
383 
384  M0_LEAVE();
385 }
386 
392 static void idx_op_cb_fini(struct m0_op_common *oc)
393 {
394  struct m0_op_idx *oi;
395 
396  M0_ENTRY();
397 
398  M0_PRE(oc != NULL);
399  M0_PRE(oc->oc_op.op_size >= sizeof *oi);
400 
401  oi = bob_of(oc, struct m0_op_idx, oi_oc, &oi_bobtype);
403 
404  m0_op_common_bob_fini(&oi->oi_oc);
405  m0_ast_rc_bob_fini(&oi->oi_ar);
406  m0_op_idx_bob_fini(oi);
407 
408  M0_LEAVE();
409 }
410 
416 static void idx_op_cb_free(struct m0_op_common *oc)
417 {
418  struct m0_op_idx *oi;
419 
420  M0_ENTRY();
421 
422  M0_PRE(oc != NULL);
423  M0_PRE((oc->oc_op.op_size >= sizeof *oi));
424 
425  /* By now, fini() has been called and bob_of cannot be used */
426  oi = M0_AMB(oi, oc, oi_oc);
427  m0_free(oi);
428 
429  M0_LEAVE();
430 }
431 
438 static void idx_op_cb_cancel(struct m0_op_common *oc)
439 {
440  struct m0_op *op;
441  struct m0_op_idx *oi;
442  struct m0_client *m0c;
443  struct m0_config *conf;
444 
445  M0_ENTRY();
446 
447  M0_PRE(oc != NULL);
448  op = &oc->oc_op;
449  M0_PRE(op->op_entity != NULL);
450  M0_PRE(m0_sm_group_is_locked(&op->op_sm_group));
451 
452  oi = bob_of(oc, struct m0_op_idx, oi_oc, &oi_bobtype);
454 
455  m0c = oi_instance(oi);
456  conf = m0c->m0c_config;
457 
458  M0_LOG(M0_DEBUG, "op->op_code:%d", op->op_code);
459 
460  if (!oi->oi_in_completion && conf->mc_idx_service_id == M0_IDX_DIX)
461  op->op_rc = m0__idx_cancel(oi);
462  else
463  op->op_rc = 0;
464 
465  M0_LEAVE();
466 }
467 
472 static void idx_op_cb_launch(struct m0_op_common *oc)
473 {
474  int rc;
475  struct m0_client *m0c;
476  struct m0_op *op;
477  struct m0_op_idx *oi;
478  struct m0_idx_query_ops *query_ops;
479 
480  int (*query) (struct m0_op_idx *);
481 
482  M0_ENTRY();
483 
484  M0_PRE(oc != NULL);
485  op = &oc->oc_op;
486  oi = bob_of(oc, struct m0_op_idx, oi_oc, &oi_bobtype);
487 
488  m0c = oi_instance(oi);
489  query_ops = m0c->m0c_idx_svc_ctx.isc_service->is_query_ops;
490  M0_ASSERT(query_ops != NULL);
491 
492  /* No harm to set the operation state here. */
493  m0_sm_move(&op->op_sm, 0, M0_OS_LAUNCHED);
494 
495  /* Move to a different state and call the control function. */
496  m0_sm_group_lock(&op->op_entity->en_sm_group);
497 
498  if (oi->oi_dtx)
499  m0_dtx0_prepare(oi->oi_dtx);
500 
501  switch (op->op_code) {
502  case M0_EO_CREATE:
503  m0_sm_move(&op->op_entity->en_sm, 0,
505  query = query_ops->iqo_namei_create;
506  break;
507  case M0_EO_DELETE:
508  m0_sm_move(&op->op_entity->en_sm, 0,
510  query = query_ops->iqo_namei_delete;
511  break;
512  case M0_IC_GET:
513  query = query_ops->iqo_get;
514  break;
515  case M0_IC_PUT:
516  query = query_ops->iqo_put;
517  break;
518  case M0_IC_DEL:
519  query = query_ops->iqo_del;
520  break;
521  case M0_IC_NEXT:
522  query = query_ops->iqo_next;
523  break;
524  case M0_IC_LOOKUP:
525  query = query_ops->iqo_namei_lookup;
526  break;
527  case M0_IC_LIST:
528  query = query_ops->iqo_namei_list;
529  break;
530  default:
531  M0_IMPOSSIBLE("Management operation not implemented");
532  }
533  M0_ASSERT(query != NULL);
534 
535  m0_sm_group_unlock(&op->op_entity->en_sm_group);
536  /*
537  * Returned value of query operations:
538  * = 0: the query is executed synchronously and returns successfully.
539  * < 0: the query fails.
540  * = 1: the driver successes in launching the query asynchronously.
541  */
542  rc = query(oi);
543  oi->oi_ar.ar_rc = rc;
544  if (rc < 0) {
547  } else if (rc == 0) {
550  }
551 
552  M0_LEAVE();
553 }
554 
555 int m0_idx_op(struct m0_idx *idx,
556  enum m0_idx_opcode opcode,
557  struct m0_bufvec *keys,
558  struct m0_bufvec *vals,
559  int32_t *rcs,
560  uint32_t flags,
561  struct m0_op **op)
562 {
563  int rc;
564 
565  M0_ENTRY();
566 
567  M0_PRE(idx != NULL);
570  M0_IC_DEL, M0_IC_NEXT)));
571  M0_PRE(M0_IN(opcode, (M0_IC_DEL,
572  M0_IC_LOOKUP,
573  M0_IC_LIST)) == (vals == NULL));
574  M0_PRE(ergo(opcode != M0_IC_LOOKUP, keys != NULL));
575  M0_PRE(ergo(vals != NULL,
576  keys->ov_vec.v_nr == vals->ov_vec.v_nr));
578  m0_forall(i, keys->ov_vec.v_nr,
579  keys->ov_vec.v_count[i] ==
580  sizeof(struct m0_uint128))));
581  M0_PRE(op != NULL);
583  M0_IN(opcode, (M0_IC_PUT, M0_IC_DEL))));
584 
585  rc = m0_op_get(op, sizeof(struct m0_op_idx));
586  if (rc == 0) {
587  M0_ASSERT(*op != NULL);
588  rc = idx_op_init(idx, opcode, keys, vals, rcs, flags,
589  *op);
590  }
591 
592  return M0_RC(rc);
593 }
594 M0_EXPORTED(m0_idx_op);
595 
604 M0_INTERNAL int m0_idx_op_namei(struct m0_entity *entity,
605  struct m0_op **op,
607 {
608  int rc;
609  struct m0_idx *idx;
610 
611  M0_ENTRY();
612 
613  M0_PRE(entity != NULL);
614  M0_PRE(op != NULL);
615 
616  rc = m0_op_get(op, sizeof(struct m0_op_idx));
617  if (rc == 0) {
618  M0_ASSERT(*op != NULL);
619  idx = M0_AMB(idx, entity, in_entity);
620  rc = idx_op_init(idx, opcode, NULL, NULL, NULL, 0,
621  *op);
622  }
623 
624  return M0_RC(rc);
625 }
626 
627 void m0_idx_init(struct m0_idx *idx,
628  struct m0_realm *parent,
629  const struct m0_uint128 *id)
630 {
631  M0_ENTRY();
632 
633  M0_PRE(idx != NULL);
634  M0_PRE(parent != NULL);
635  M0_PRE(id != NULL);
636 
637  /* Initialise the entity */
638  m0_entity_init(&idx->in_entity, parent, id, M0_ET_IDX);
639 
640  M0_LEAVE();
641 }
642 M0_EXPORTED(m0_idx_init);
643 
644 void m0_idx_fini(struct m0_idx *idx)
645 {
646  M0_ENTRY();
647 
648  M0_PRE(idx != NULL);
649  m0_entity_fini(&idx->in_entity);
650 
651  M0_LEAVE();
652 }
653 M0_EXPORTED(m0_idx_fini);
654 
655 M0_INTERNAL void m0_idx_service_config(struct m0_client *m0c,
656  int svc_id, void *svc_conf)
657 {
658  struct m0_idx_service *service;
659  struct m0_idx_service_ctx *ctx;
660 
661  M0_PRE(m0c != NULL);
662  M0_PRE(svc_id >= 0 && svc_id < M0_IDX_MAX_SERVICE_ID);
663 
664  service = &idx_services[svc_id];
665  ctx = &m0c->m0c_idx_svc_ctx;
666  ctx->isc_service = service;
667  ctx->isc_svc_conf = svc_conf;
668  ctx->isc_svc_inst = NULL;
669 }
670 
671 M0_INTERNAL void m0_idx_service_register(int svc_id,
672  struct m0_idx_service_ops *sops,
673  struct m0_idx_query_ops *qops)
674 {
675  struct m0_idx_service *service;
676 
677  M0_PRE(svc_id >= 0 && svc_id < M0_IDX_MAX_SERVICE_ID);
678 
679  service = &idx_services[svc_id];
680  service->is_svc_ops = sops;
681  service->is_query_ops = qops;
682 }
683 
684 M0_INTERNAL void m0_idx_services_register(void)
685 {
687 #ifdef MOTR_IDX_STORE_CASS
689 #endif
691 }
692 
693 #undef M0_TRACE_SUBSYSTEM
694 
695 /*
696  * Local variables:
697  * c-indentation-style: "K&R"
698 
699  * c-basic-offset: 8
700  * tab-width: 8
701  * fill-column: 80
702  * scroll-step: 1
703  * End:
704  */
705 /*
706  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
707  */
M0_INTERNAL int m0_dix_pool_version_get(struct m0_pools_common *pc, struct m0_pool_version **pv)
Definition: pool.c:704
struct m0_fid idx_pver
Definition: client.h:821
struct m0_dtx * oi_dtx
struct m0_dtm0_dtx * tx_dtx
Definition: dtm.h:563
const struct m0_bob_type ar_bobtype
Definition: client.c:73
#define M0_PRE(cond)
M0_INTERNAL struct m0_client * m0__idx_instance(const struct m0_idx *idx)
Definition: client.c:269
Definition: client.h:841
void m0_entity_fini(struct m0_entity *entity)
Definition: client.c:438
M0_INTERNAL int m0_op_get(struct m0_op **op, size_t size)
Definition: client.c:568
int const char const void size_t int flags
Definition: dir.c:328
#define NULL
Definition: misc.h:38
static int idx_pool_version_get(struct m0_op_idx *oi)
Definition: idx.c:134
m0_idx_opcode
Definition: client.h:550
m0_entity_opcode
Definition: client.h:523
uint32_t idx_layout_type
Definition: client.h:819
static void idx_op_cb_fini(struct m0_op_common *oc)
Definition: idx.c:392
static size_t locality(const struct m0_fom *fom)
Definition: rm_foms.c:269
int(* iqo_namei_list)(struct m0_op_idx *oi)
Definition: idx.h:132
M0_INTERNAL int m0__idx_pool_version_get(struct m0_idx *idx, struct m0_pool_version **pv)
Definition: idx.c:107
#define ergo(a, b)
Definition: misc.h:293
M0_INTERNAL void idx_op_ast_complete(struct m0_sm_group *grp, struct m0_sm_ast *ast)
Definition: idx.c:312
void(* sa_cb)(struct m0_sm_group *grp, struct m0_sm_ast *)
Definition: sm.h:506
def query(from_, to_, range_end, plug_name, time_unit)
Definition: hist.py:65
static struct m0_sm_group * grp
Definition: bytecount.c:38
struct m0_pool_version * pv
Definition: dir.c:629
#define M0_LOG(level,...)
Definition: trace.h:167
M0_LEAVE()
M0_INTERNAL void m0_sm_ast_post(struct m0_sm_group *grp, struct m0_sm_ast *ast)
Definition: sm.c:135
int(* iqo_namei_delete)(struct m0_op_idx *oi)
Definition: idx.h:130
M0_INTERNAL void idx_op_ast_fail(struct m0_sm_group *grp, struct m0_sm_ast *ast)
Definition: idx.c:368
M0_INTERNAL void m0_idx_service_register(int svc_id, struct m0_idx_service_ops *sops, struct m0_idx_query_ops *qops)
Definition: idx.c:671
M0_INTERNAL void m0_dtx0_done(struct m0_dtx *dtx)
Definition: dtx.c:532
M0_INTERNAL void m0_idx_service_config(struct m0_client *m0c, int svc_id, void *svc_conf)
Definition: idx.c:655
struct m0_vec ov_vec
Definition: vec.h:147
Definition: idx.h:70
const struct m0_bob_type oi_bobtype
Definition: idx.c:44
static struct m0_clovis * m0c
Definition: main.c:25
struct m0_op oc_op
M0_INTERNAL int m0_op_init(struct m0_op *op, const struct m0_sm_conf *conf, struct m0_entity *entity)
Definition: client.c:805
M0_INTERNAL void m0_dtx0_prepare(struct m0_dtx *dtx)
Definition: dtx.c:491
Definition: conf.py:1
static void idx_op_cb_cancel(struct m0_op_common *oc)
Definition: idx.c:438
M0_INTERNAL void m0_idx_mock_register(void)
Definition: idx_mock.c:768
#define M0_BITS(...)
Definition: misc.h:236
void m0_idx_fini(struct m0_idx *idx)
Definition: idx.c:644
Definition: sm.h:504
struct m0_idx_attr in_attr
Definition: client.h:843
int(* iqo_next)(struct m0_op_idx *oi)
Definition: idx.h:138
#define M0_SET0(obj)
Definition: misc.h:64
M0_ADDB2_ADD(M0_AVI_FS_CREATE, new_fid.f_container, new_fid.f_key, mode, rc)
struct m0_op_common oi_oc
struct m0_bufvec * oi_keys
const char * bt_name
Definition: bob.h:73
struct m0_sm dd_sm
Definition: dtx.h:61
uint32_t oi_flags
int m0_idx_op(struct m0_idx *idx, enum m0_idx_opcode opcode, struct m0_bufvec *keys, struct m0_bufvec *vals, int32_t *rcs, uint32_t flags, struct m0_op **op)
Definition: idx.c:555
return M0_RC(rc)
op
Definition: libdemo.c:64
M0_INTERNAL int m0_idx_op_namei(struct m0_entity *entity, struct m0_op **op, enum m0_entity_opcode opcode)
Definition: idx.c:604
static void idx_op_cb_free(struct m0_op_common *oc)
Definition: idx.c:416
#define M0_ENTRY(...)
Definition: trace.h:170
int(* iqo_namei_create)(struct m0_op_idx *oi)
Definition: idx.h:129
static struct m0_sm_ast ast[NR]
Definition: locality.c:44
M0_INTERNAL void m0_idx_services_register(void)
Definition: idx.c:684
M0_INTERNAL void m0_sm_group_unlock(struct m0_sm_group *grp)
Definition: sm.c:96
struct m0_entity in_entity
Definition: client.h:842
int opcode
Definition: crate.c:301
int(* iqo_get)(struct m0_op_idx *oi)
Definition: idx.h:135
int i
Definition: dir.c:1033
size_t op_size
Definition: client.h:670
#define PRIu64
Definition: types.h:58
struct m0_pools_common m0c_pools_common
M0_INTERNAL struct m0_dtx * m0_dtx0_alloc(struct m0_dtm0_service *svc, struct m0_sm_group *grp)
Definition: dtx.c:484
Definition: client.h:647
void(* oc_cb_free)(struct m0_op_common *oc)
return M0_ERR(-EOPNOTSUPP)
static struct m0_client * oi_instance(struct m0_op_idx *oi)
Definition: idx.c:60
struct m0_idx * oi_idx
M0_INTERNAL int m0_op_stable(struct m0_op *op)
Definition: client.c:520
#define M0_AMB(obj, ptr, field)
Definition: misc.h:320
struct m0_fid pv_id
Definition: pool.h:113
#define ENABLE_DTM0
Definition: config.h:36
#define M0_ASSERT(cond)
struct crate_conf * conf
int(* iqo_del)(struct m0_op_idx *oi)
Definition: idx.h:137
int(* iqo_put)(struct m0_op_idx *oi)
Definition: idx.h:136
#define bob_of(ptr, type, field, bt)
Definition: bob.h:140
static void idx_op_fail(struct m0_op_idx *oi, int rc)
Definition: idx.c:326
struct m0_ast_rc oi_ar
M0_INTERNAL int m0__idx_cancel(struct m0_op_idx *oi)
Definition: idx_dix.c:1244
Definition: xcode.c:55
M0_INTERNAL struct m0_idx * m0__idx_entity(struct m0_entity *entity)
Definition: idx.c:97
uint32_t v_nr
Definition: vec.h:51
void(* oc_cb_fini)(struct m0_op_common *oc)
int32_t * oi_rcs
M0_INTERNAL bool m0__idx_op_invariant(struct m0_op_idx *oi)
Definition: idx.c:74
m0_bcount_t * v_count
Definition: vec.h:53
static struct m0_idx_service idx_services[M0_IDX_MAX_SERVICE_ID]
Definition: idx.c:36
static struct fdmi_ctx ctx
Definition: main.c:80
#define FID_P(f)
Definition: fid.h:77
M0_INTERNAL int m0_op_executed(struct m0_op *op)
Definition: client.c:500
M0_INTERNAL void idx_op_ast_executed(struct m0_sm_group *grp, struct m0_sm_ast *ast)
Definition: idx.c:300
bool oi_in_completion
#define m0_forall(var, nr,...)
Definition: misc.h:112
static struct m0_client cinst
Definition: sync.c:84
static void idx_op_cb_launch(struct m0_op_common *oc)
Definition: idx.c:472
struct m0_sm_ast ar_ast
M0_BOB_DEFINE(M0_INTERNAL, &oi_bobtype, m0_op_idx)
struct m0_sm_group * oi_sm_grp
struct m0_realm * en_realm
Definition: client.h:716
#define OP_IDX2CODE(op_idx)
struct m0_entity * op_entity
Definition: client.h:666
M0_INTERNAL struct m0_locality * m0__locality_pick(struct m0_client *cinst)
Definition: client.c:290
struct m0_bufvec * oi_vals
void(* oc_cb_cancel)(struct m0_op_common *oc)
static void idx_op_complete_state_set(struct m0_sm_group *grp, struct m0_sm_ast *ast, uint64_t mask)
Definition: idx.c:250
#define _0C(exp)
Definition: assert.h:311
M0_INTERNAL void m0_sm_move(struct m0_sm *mach, int32_t rc, int state)
Definition: sm.c:485
M0_INTERNAL void m0_sm_group_lock(struct m0_sm_group *grp)
Definition: sm.c:83
struct m0_client * re_instance
Definition: client.h:879
M0_INTERNAL void m0_idx_cass_register(void)
Definition: idx_cass.c:1198
M0_INTERNAL void m0_idx_dix_register(void)
Definition: idx_dix.c:1562
uint32_t en_flags
Definition: client.h:744
Definition: nucleus.c:42
int(* iqo_namei_lookup)(struct m0_op_idx *oi)
Definition: idx.h:131
M0_INTERNAL void idx_op_ast_stable(struct m0_sm_group *grp, struct m0_sm_ast *ast)
Definition: idx.c:294
void(* oc_cb_launch)(struct m0_op_common *oc)
M0_INTERNAL uint64_t m0_sm_id_get(const struct m0_sm *sm)
Definition: sm.c:1021
static int idx_op_init(struct m0_idx *idx, int opcode, struct m0_bufvec *keys, struct m0_bufvec *vals, int32_t *rcs, uint32_t flags, struct m0_op *op)
Definition: idx.c:165
void m0_free(void *data)
Definition: memory.c:146
static struct m0_reqh_service * service[REQH_IN_UT_MAX]
Definition: long_lock_ut.c:46
static struct m0_op_idx * ar_ast2oi(struct m0_sm_ast *ast)
Definition: idx.c:243
int32_t rc
Definition: trigger_fop.h:47
M0_INTERNAL void m0_entity_init(struct m0_entity *entity, struct m0_realm *parent, const struct m0_uint128 *id, const enum m0_entity_type type)
Definition: client.c:371
#define offsetof(typ, memb)
Definition: misc.h:29
enum m0_entity_type en_type
Definition: client.h:712
M0_INTERNAL bool m0_sm_group_is_locked(const struct m0_sm_group *grp)
Definition: sm.c:107
void m0_idx_init(struct m0_idx *idx, struct m0_realm *parent, const struct m0_uint128 *id)
Definition: idx.c:627
struct m0_sm_conf m0_op_conf
Definition: client.c:145
#define FID_F
Definition: fid.h:75
Definition: vec.h:145
#define M0_IMPOSSIBLE(fmt,...)
M0_INTERNAL struct m0_client * m0__entity_instance(const struct m0_entity *entity)
Definition: client.c:226