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 && M0_IN(op->op_code, (M0_IC_PUT, M0_IC_DEL))) {
219  M0_ASSERT(m0c->m0c_dtms != NULL);
220  oi->oi_dtx = m0_dtx0_alloc(m0c->m0c_dtms, oi->oi_sm_grp);
221  if (oi->oi_dtx == NULL)
222  return M0_ERR(-ENOMEM);
223  did = m0_sm_id_get(&oi->oi_dtx->tx_dtx->dd_sm);
224  cid = m0_sm_id_get(&op->op_sm);
226  } else
227  oi->oi_dtx = NULL;
228 
229  if (opcode == M0_EO_CREATE && entity->en_type == M0_ET_IDX &&
230  entity->en_flags & M0_ENF_META) {
231  rc = idx_pool_version_get(oi);
232  if (rc != 0)
233  return M0_ERR(rc);
235  M0_LOG(M0_DEBUG, "DIX pool version at index create: "FID_F"",
236  FID_P(&idx->in_attr.idx_pver));
237  }
238 
239  return M0_RC(0);
240 }
241 
242 static struct m0_op_idx *ar_ast2oi(struct m0_sm_ast *ast)
243 {
244  struct m0_ast_rc *ar;
245  ar = bob_of(ast, struct m0_ast_rc, ar_ast, &ar_bobtype);
246  return bob_of(ar, struct m0_op_idx, oi_ar, &oi_bobtype);
247 }
248 
250  struct m0_sm_ast *ast,
251  uint64_t mask)
252 {
253  struct m0_op_idx *oi = ar_ast2oi(ast);
254  struct m0_op *op = &oi->oi_oc.oc_op;
255  struct m0_sm_group *op_grp = &op->op_sm_group;
256  struct m0_sm_group *en_grp = &op->op_entity->en_sm_group;
257 
258  M0_ENTRY("oi=%p, mask=%" PRIu64, oi, mask);
259 
260  M0_PRE(grp != NULL);
262  M0_PRE((mask & ~M0_BITS(M0_OS_EXECUTED, M0_OS_STABLE)) == 0);
263 
264  oi->oi_in_completion = true;
265 
266  if (M0_IN(op->op_code, (M0_EO_CREATE, M0_EO_DELETE))) {
267  m0_sm_group_lock(en_grp);
268  if (op->op_code == M0_EO_CREATE)
269  m0_sm_move(&op->op_entity->en_sm, 0, M0_ES_OPEN);
270  else if (op->op_code == M0_EO_DELETE)
271  m0_sm_move(&op->op_entity->en_sm, 0, M0_ES_INIT);
272  m0_sm_group_unlock(en_grp);
273  }
274 
275  m0_sm_group_lock(op_grp);
276  if ((mask & M0_BITS(M0_OS_EXECUTED)) != 0) {
277  m0_sm_move(&op->op_sm, 0, M0_OS_EXECUTED);
279  }
280  if ((mask & M0_BITS(M0_OS_STABLE)) != 0) {
281  m0_sm_move(&op->op_sm, 0, M0_OS_STABLE);
282  m0_op_stable(op);
283  if (oi->oi_dtx != NULL) {
284  m0_dtx0_done(oi->oi_dtx);
285  oi->oi_dtx = NULL;
286  }
287  }
288  m0_sm_group_unlock(op_grp);
289 
290  M0_LEAVE();
291 }
292 
293 M0_INTERNAL void idx_op_ast_stable(struct m0_sm_group *grp,
294  struct m0_sm_ast *ast)
295 {
297 }
298 
299 M0_INTERNAL void idx_op_ast_executed(struct m0_sm_group *grp,
300  struct m0_sm_ast *ast)
301 {
303 }
304 
311 M0_INTERNAL void idx_op_ast_complete(struct m0_sm_group *grp,
312  struct m0_sm_ast *ast)
313 {
316 }
317 
325 static void idx_op_fail(struct m0_op_idx *oi, int rc)
326 {
327  struct m0_op *op;
328  struct m0_sm_group *op_grp;
329  struct m0_sm_group *en_grp;
330 
331  M0_ENTRY();
332 
333  M0_PRE(oi != NULL);
334 
335  op = &oi->oi_oc.oc_op;
336 
337  op_grp = &op->op_sm_group;
338  en_grp = &op->op_entity->en_sm_group;
339 
340  oi->oi_in_completion = true;
341  m0_sm_group_lock(en_grp);
342 
343  if (op->op_code == M0_EO_CREATE)
344  m0_sm_move(&op->op_entity->en_sm, 0, M0_ES_OPEN);
345  else if (op->op_code == M0_EO_DELETE)
346  m0_sm_move(&op->op_entity->en_sm, 0, M0_ES_INIT);
347 
348  m0_sm_group_unlock(en_grp);
349 
350  m0_sm_group_lock(op_grp);
351  op->op_rc = rc;
352  m0_sm_move(&op->op_sm, 0, M0_OS_EXECUTED);
354  m0_sm_move(&op->op_sm, 0, M0_OS_STABLE);
355  m0_op_stable(op);
356  m0_sm_group_unlock(op_grp);
357 
358  M0_LEAVE();
359 }
360 
367 M0_INTERNAL void idx_op_ast_fail(struct m0_sm_group *grp,
368  struct m0_sm_ast *ast)
369 {
370  struct m0_op_idx *oi;
371  struct m0_ast_rc *ar;
372 
373  M0_ENTRY();
374 
375  M0_PRE(grp != NULL);
377  M0_PRE(ast != NULL);
378 
379  ar = bob_of(ast, struct m0_ast_rc, ar_ast, &ar_bobtype);
380  oi = bob_of(ar, struct m0_op_idx, oi_ar, &oi_bobtype);
381  idx_op_fail(oi, ar->ar_rc);
382 
383  M0_LEAVE();
384 }
385 
391 static void idx_op_cb_fini(struct m0_op_common *oc)
392 {
393  struct m0_op_idx *oi;
394 
395  M0_ENTRY();
396 
397  M0_PRE(oc != NULL);
398  M0_PRE(oc->oc_op.op_size >= sizeof *oi);
399 
400  oi = bob_of(oc, struct m0_op_idx, oi_oc, &oi_bobtype);
402 
403  m0_op_common_bob_fini(&oi->oi_oc);
404  m0_ast_rc_bob_fini(&oi->oi_ar);
405  m0_op_idx_bob_fini(oi);
406 
407  M0_LEAVE();
408 }
409 
415 static void idx_op_cb_free(struct m0_op_common *oc)
416 {
417  struct m0_op_idx *oi;
418 
419  M0_ENTRY();
420 
421  M0_PRE(oc != NULL);
422  M0_PRE((oc->oc_op.op_size >= sizeof *oi));
423 
424  /* By now, fini() has been called and bob_of cannot be used */
425  oi = M0_AMB(oi, oc, oi_oc);
426  m0_free(oi);
427 
428  M0_LEAVE();
429 }
430 
437 static void idx_op_cb_cancel(struct m0_op_common *oc)
438 {
439  struct m0_op *op;
440  struct m0_op_idx *oi;
441  struct m0_client *m0c;
442  struct m0_config *conf;
443 
444  M0_ENTRY();
445 
446  M0_PRE(oc != NULL);
447  op = &oc->oc_op;
448  M0_PRE(op->op_entity != NULL);
449  M0_PRE(m0_sm_group_is_locked(&op->op_sm_group));
450 
451  oi = bob_of(oc, struct m0_op_idx, oi_oc, &oi_bobtype);
453 
454  m0c = oi_instance(oi);
455  conf = m0c->m0c_config;
456 
457  M0_LOG(M0_DEBUG, "op->op_code:%d", op->op_code);
458 
459  if (!oi->oi_in_completion && conf->mc_idx_service_id == M0_IDX_DIX)
460  op->op_rc = m0__idx_cancel(oi);
461  else
462  op->op_rc = 0;
463 
464  M0_LEAVE();
465 }
466 
471 static void idx_op_cb_launch(struct m0_op_common *oc)
472 {
473  int rc;
474  struct m0_client *m0c;
475  struct m0_op *op;
476  struct m0_op_idx *oi;
477  struct m0_idx_query_ops *query_ops;
478 
479  int (*query) (struct m0_op_idx *);
480 
481  M0_ENTRY();
482 
483  M0_PRE(oc != NULL);
484  op = &oc->oc_op;
485  oi = bob_of(oc, struct m0_op_idx, oi_oc, &oi_bobtype);
486 
487  m0c = oi_instance(oi);
488  query_ops = m0c->m0c_idx_svc_ctx.isc_service->is_query_ops;
489  M0_ASSERT(query_ops != NULL);
490 
491  /* No harm to set the operation state here. */
492  m0_sm_move(&op->op_sm, 0, M0_OS_LAUNCHED);
493 
494  /* Move to a different state and call the control function. */
495  m0_sm_group_lock(&op->op_entity->en_sm_group);
496 
497  if (oi->oi_dtx)
498  m0_dtx0_prepare(oi->oi_dtx);
499 
500  switch (op->op_code) {
501  case M0_EO_CREATE:
502  m0_sm_move(&op->op_entity->en_sm, 0,
504  query = query_ops->iqo_namei_create;
505  break;
506  case M0_EO_DELETE:
507  m0_sm_move(&op->op_entity->en_sm, 0,
509  query = query_ops->iqo_namei_delete;
510  break;
511  case M0_IC_GET:
512  query = query_ops->iqo_get;
513  break;
514  case M0_IC_PUT:
515  query = query_ops->iqo_put;
516  break;
517  case M0_IC_DEL:
518  query = query_ops->iqo_del;
519  break;
520  case M0_IC_NEXT:
521  query = query_ops->iqo_next;
522  break;
523  case M0_IC_LOOKUP:
524  query = query_ops->iqo_namei_lookup;
525  break;
526  case M0_IC_LIST:
527  query = query_ops->iqo_namei_list;
528  break;
529  default:
530  M0_IMPOSSIBLE("Management operation not implemented");
531  }
532  M0_ASSERT(query != NULL);
533 
534  m0_sm_group_unlock(&op->op_entity->en_sm_group);
535  /*
536  * Returned value of query operations:
537  * = 0: the query is executed synchronously and returns successfully.
538  * < 0: the query fails.
539  * = 1: the driver successes in launching the query asynchronously.
540  */
541  rc = query(oi);
542  oi->oi_ar.ar_rc = rc;
543  if (rc < 0) {
546  } else if (rc == 0) {
549  }
550 
551  M0_LEAVE();
552 }
553 
554 int m0_idx_op(struct m0_idx *idx,
555  enum m0_idx_opcode opcode,
556  struct m0_bufvec *keys,
557  struct m0_bufvec *vals,
558  int32_t *rcs,
559  uint32_t flags,
560  struct m0_op **op)
561 {
562  int rc;
563 
564  M0_ENTRY();
565 
566  M0_PRE(idx != NULL);
569  M0_IC_DEL, M0_IC_NEXT)));
570  M0_PRE(M0_IN(opcode, (M0_IC_DEL,
571  M0_IC_LOOKUP,
572  M0_IC_LIST)) == (vals == NULL));
573  M0_PRE(ergo(opcode != M0_IC_LOOKUP, keys != NULL));
574  M0_PRE(ergo(vals != NULL,
575  keys->ov_vec.v_nr == vals->ov_vec.v_nr));
577  m0_forall(i, keys->ov_vec.v_nr,
578  keys->ov_vec.v_count[i] ==
579  sizeof(struct m0_uint128))));
580  M0_PRE(op != NULL);
582  M0_IN(opcode, (M0_IC_PUT, M0_IC_DEL))));
583 
584  rc = m0_op_get(op, sizeof(struct m0_op_idx));
585  if (rc == 0) {
586  M0_ASSERT(*op != NULL);
587  rc = idx_op_init(idx, opcode, keys, vals, rcs, flags,
588  *op);
589  }
590 
591  return M0_RC(rc);
592 }
593 M0_EXPORTED(m0_idx_op);
594 
603 M0_INTERNAL int m0_idx_op_namei(struct m0_entity *entity,
604  struct m0_op **op,
606 {
607  int rc;
608  struct m0_idx *idx;
609 
610  M0_ENTRY();
611 
612  M0_PRE(entity != NULL);
613  M0_PRE(op != NULL);
614 
615  rc = m0_op_get(op, sizeof(struct m0_op_idx));
616  if (rc == 0) {
617  M0_ASSERT(*op != NULL);
618  idx = M0_AMB(idx, entity, in_entity);
619  rc = idx_op_init(idx, opcode, NULL, NULL, NULL, 0,
620  *op);
621  }
622 
623  return M0_RC(rc);
624 }
625 
626 void m0_idx_init(struct m0_idx *idx,
627  struct m0_realm *parent,
628  const struct m0_uint128 *id)
629 {
630  M0_ENTRY();
631 
632  M0_PRE(idx != NULL);
633  M0_PRE(parent != NULL);
634  M0_PRE(id != NULL);
635 
636  /* Initialise the entity */
637  m0_entity_init(&idx->in_entity, parent, id, M0_ET_IDX);
638 
639  M0_LEAVE();
640 }
641 M0_EXPORTED(m0_idx_init);
642 
643 void m0_idx_fini(struct m0_idx *idx)
644 {
645  M0_ENTRY();
646 
647  M0_PRE(idx != NULL);
648  m0_entity_fini(&idx->in_entity);
649 
650  M0_LEAVE();
651 }
652 M0_EXPORTED(m0_idx_fini);
653 
654 M0_INTERNAL void m0_idx_service_config(struct m0_client *m0c,
655  int svc_id, void *svc_conf)
656 {
657  struct m0_idx_service *service;
658  struct m0_idx_service_ctx *ctx;
659 
660  M0_PRE(m0c != NULL);
661  M0_PRE(svc_id >= 0 && svc_id < M0_IDX_MAX_SERVICE_ID);
662 
663  service = &idx_services[svc_id];
664  ctx = &m0c->m0c_idx_svc_ctx;
665  ctx->isc_service = service;
666  ctx->isc_svc_conf = svc_conf;
667  ctx->isc_svc_inst = NULL;
668 }
669 
670 M0_INTERNAL void m0_idx_service_register(int svc_id,
671  struct m0_idx_service_ops *sops,
672  struct m0_idx_query_ops *qops)
673 {
674  struct m0_idx_service *service;
675 
676  M0_PRE(svc_id >= 0 && svc_id < M0_IDX_MAX_SERVICE_ID);
677 
678  service = &idx_services[svc_id];
679  service->is_svc_ops = sops;
680  service->is_query_ops = qops;
681 }
682 
683 M0_INTERNAL void m0_idx_services_register(void)
684 {
686 #ifdef MOTR_IDX_STORE_CASS
688 #endif
690 }
691 
692 #undef M0_TRACE_SUBSYSTEM
693 
694 /*
695  * Local variables:
696  * c-indentation-style: "K&R"
697 
698  * c-basic-offset: 8
699  * tab-width: 8
700  * fill-column: 80
701  * scroll-step: 1
702  * End:
703  */
704 /*
705  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
706  */
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:815
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:835
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:813
static void idx_op_cb_fini(struct m0_op_common *oc)
Definition: idx.c:391
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:126
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:311
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:124
M0_INTERNAL void idx_op_ast_fail(struct m0_sm_group *grp, struct m0_sm_ast *ast)
Definition: idx.c:367
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:670
M0_INTERNAL void m0_dtx0_done(struct m0_dtx *dtx)
Definition: dtx.c:504
M0_INTERNAL void m0_idx_service_config(struct m0_client *m0c, int svc_id, void *svc_conf)
Definition: idx.c:654
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:806
M0_INTERNAL void m0_dtx0_prepare(struct m0_dtx *dtx)
Definition: dtx.c:463
Definition: conf.py:1
static void idx_op_cb_cancel(struct m0_op_common *oc)
Definition: idx.c:437
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:643
Definition: sm.h:504
struct m0_idx_attr in_attr
Definition: client.h:837
int(* iqo_next)(struct m0_op_idx *oi)
Definition: idx.h:132
#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:554
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:603
static void idx_op_cb_free(struct m0_op_common *oc)
Definition: idx.c:415
#define M0_ENTRY(...)
Definition: trace.h:170
int(* iqo_namei_create)(struct m0_op_idx *oi)
Definition: idx.h:123
static struct m0_sm_ast ast[NR]
Definition: locality.c:44
M0_INTERNAL void m0_idx_services_register(void)
Definition: idx.c:683
M0_INTERNAL void m0_sm_group_unlock(struct m0_sm_group *grp)
Definition: sm.c:96
struct m0_entity in_entity
Definition: client.h:836
int opcode
Definition: crate.c:301
int(* iqo_get)(struct m0_op_idx *oi)
Definition: idx.h:129
int i
Definition: dir.c:1033
size_t op_size
Definition: client.h:664
#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:456
Definition: client.h:641
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:131
int(* iqo_put)(struct m0_op_idx *oi)
Definition: idx.h:130
#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:325
struct m0_ast_rc oi_ar
M0_INTERNAL int m0__idx_cancel(struct m0_op_idx *oi)
Definition: idx_dix.c:1235
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:299
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:471
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:710
#define OP_IDX2CODE(op_idx)
struct m0_entity * op_entity
Definition: client.h:660
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:249
#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:873
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:1553
uint32_t en_flags
Definition: client.h:738
Definition: nucleus.c:42
int(* iqo_namei_lookup)(struct m0_op_idx *oi)
Definition: idx.h:125
M0_INTERNAL void idx_op_ast_stable(struct m0_sm_group *grp, struct m0_sm_ast *ast)
Definition: idx.c:293
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:242
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:706
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:626
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