Motr  M0
index_gc.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2015-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_CAS
24 
25 #include "lib/trace.h"
26 #include "lib/memory.h"
27 #include "lib/assert.h"
28 #include "lib/cond.h" /* m0_cond */
29 #include "fop/fop.h" /* M0_FOP_TYPE_INIT */
30 #include "fop/fom_long_lock.h"
31 #include "fop/fom_generic.h"
32 #include "rpc/rpc_opcodes.h"
33 #include "rpc/item.h" /* M0_RPC_ITEM_TYPE_REQUEST */
34 #include "cas/ctg_store.h"
35 #include "motr/setup.h"
36 
94 static size_t cgc_fom_home_locality (const struct m0_fom *fom);
95 static int cgc_fom_tick (struct m0_fom *fom);
96 static void cgc_fom_fini (struct m0_fom *fom);
97 static void cgc_retry (void);
98 
109 };
110 
111 struct cgc_fom {
112  struct m0_fom cg_fom;
113  struct m0_fop cg_fop;
120  struct m0_reqh *cg_reqh;
122 };
123 
124 struct cgc_context {
129  struct m0_be_op *cgc_op;
130 };
131 
132 static struct cgc_context gc;
133 
134 static const struct m0_fom_ops cgc_fom_ops = {
135  .fo_fini = &cgc_fom_fini,
136  .fo_tick = &cgc_fom_tick,
137  .fo_home_locality = &cgc_fom_home_locality
138 };
139 
140 M0_INTERNAL struct m0_fop_type cgc_fake_fopt;
141 
142 static const struct m0_fom_type_ops cgc_fom_type_ops = {
143  .fto_create = NULL
144 };
145 
147  [CGC_LOOKUP] = {
148  .sd_name = "cgc-lookup",
149  .sd_allowed = M0_BITS(CGC_INDEX_FOUND)
150  },
151  [CGC_INDEX_FOUND] = {
152  .sd_name = "cgc-index-found",
154  },
155  [CGC_CREDITS] = {
156  .sd_name = "cgc-credits-get",
157  .sd_allowed = M0_BITS(M0_FOPH_TXN_OPEN)
158  },
159  [CGC_TREE_CLEAN] = {
160  .sd_name = "cgc-tree-clean",
161  .sd_allowed = M0_BITS(CGC_TREE_DROP)
162  },
163  [CGC_TREE_DROP] = {
164  .sd_name = "cgc-tree-drop",
166  },
167  [CGC_LOCK_DEAD_INDEX] = {
168  .sd_name = "cgc-lock-dead-index",
169  .sd_allowed = M0_BITS(CGC_RM_FROM_DEAD_INDEX)
170  },
172  .sd_name = "cgc-rm-from-dead-index",
173  .sd_allowed = M0_BITS(CGC_SUCCESS),
174  },
175  [CGC_SUCCESS] = {
176  .sd_name = "cgc-success",
177  .sd_allowed = M0_BITS(M0_FOPH_SUCCESS)
178  },
179 };
180 
183  { "cgc-starting", M0_FOPH_TXN_INIT, CGC_LOOKUP },
184  { "cgc-index-lookup", CGC_LOOKUP, CGC_INDEX_FOUND },
185  { "cgc-start-txn", CGC_INDEX_FOUND, M0_FOPH_TXN_INIT },
186  { "cgc-no-job", CGC_INDEX_FOUND, M0_FOPH_SUCCESS },
187  { "cgc-starting", M0_FOPH_TXN_OPEN, CGC_CREDITS },
188  { "cgc-credits", CGC_CREDITS, M0_FOPH_TXN_OPEN },
189  { "cgc-tree-drop", CGC_TREE_CLEAN, CGC_TREE_DROP },
190  { "cgc-start-lock", CGC_TREE_DROP, CGC_LOCK_DEAD_INDEX },
191  { "cgc-commit-clean", CGC_TREE_DROP, M0_FOPH_SUCCESS },
192  { "cgc-rm-dead", CGC_LOCK_DEAD_INDEX, CGC_RM_FROM_DEAD_INDEX },
193  { "cgc-forget", CGC_RM_FROM_DEAD_INDEX, CGC_SUCCESS },
194  { "cgc-done", CGC_SUCCESS, M0_FOPH_SUCCESS }
195 };
196 
197 static struct m0_sm_conf cgc_sm_conf = {
198  .scf_name = "cgc-fom",
199  .scf_nr_states = ARRAY_SIZE(cgc_fom_phases),
200  .scf_state = cgc_fom_phases,
201  .scf_trans_nr = ARRAY_SIZE(cgc_fom_trans),
202  .scf_trans = cgc_fom_trans
203 };
204 
205 static size_t cgc_fom_home_locality(const struct m0_fom *fom)
206 {
207  return 0;
208 }
209 
210 static int cgc_fom_tick(struct m0_fom *fom0)
211 {
212  struct cgc_fom *fom = M0_AMB(fom, fom0, cg_fom);
213  int phase = m0_fom_phase(fom0);
214  struct m0_ctg_op *ctg_op = &fom->cg_ctg_op;
215  int result = M0_FSO_AGAIN;
216  int rc;
217 
218  M0_ENTRY("fom %p phase %d", fom, phase);
219 
220  switch (phase) {
221  case M0_FOPH_INIT ... M0_FOPH_NR - 1:
222  if (phase == M0_FOPH_FAILURE) {
223  struct m0_long_lock *ll;
225 
226  M0_LOG(M0_DEBUG, "Cleanup CGC");
227  if (m0_long_is_write_locked(ll, fom0)) {
228  m0_long_unlock(ll, &fom->cg_dead_index);
229  M0_LOG(M0_DEBUG, "Lock released");
230  }
231 
232  m0_ctg_fini(fom0, fom->cg_ctg);
233  if (fom->cg_ctg_op_initialized) {
234  m0_ctg_op_fini(ctg_op);
235  fom->cg_ctg_op_initialized = false;
236  M0_LOG(M0_DEBUG, "ctg op finalized");
237  }
238  }
239  result = m0_fom_tick_generic(fom0);
240  /*
241  * Intercept generic fom control flow when starting transaction
242  * init. Note: when we intercepted it here, state is already set
243  * to M0_FOPH_TXN_INIT.
244  * Seek for an index to drop and collect credits before
245  * transaction initialized.
246  */
247  if (phase == M0_FOPH_AUTHORISATION) {
248  if (M0_FI_ENABLED("fail_in_cgc_generic_phase")) {
249  M0_LOG(M0_DEBUG, "Fail the FOM at TXN_INIT");
250  m0_fom_phase_move(fom0, -ENOMEM,
252  result = M0_FSO_AGAIN;
253  break;
254  }
256  }
257  /*
258  * Intercept generic fom control flow control after transaction
259  * init but before its start complete: need to reserve credits.
260  */
261  if (phase == M0_FOPH_TXN_INIT)
263  /*
264  * Jump over fom_queue_reply() which does nothing if fom is
265  * local, but still asserts in absence of fo_rep_fop which we do
266  * not need.
267  */
268  if (phase == M0_FOPH_TXN_COMMIT)
270  break;
271  case CGC_LOOKUP:
272  m0_ctg_op_init(ctg_op, fom0, 0);
273  fom->cg_ctg_op_initialized = true;
274  /*
275  * Actually we need any value from the dead index. Min key value
276  * is ok. Do not need to lock dead index here: btree logic uses
277  * its own short time lock.
278  */
279  result = m0_ctg_minkey(ctg_op, m0_ctg_dead_index(),
281  break;
282  case CGC_INDEX_FOUND:
283  rc = m0_ctg_op_rc(ctg_op);
284  if (rc == 0) {
285  fom->cg_ctg_key = ctg_op->co_out_key;
286  fom->cg_ctg = *(struct m0_cas_ctg **)
287  ctg_op->co_out_key.b_addr;
288  M0_LOG(M0_DEBUG, "got index, ctg %p", fom->cg_ctg);
289  m0_ctg_try_init(fom->cg_ctg);
290  /*
291  * Use generic fom to open transaction already having
292  * credits in hands.
293  * Also lock dead index for write.
294  */
295  result = m0_long_write_lock(
297  &fom->cg_dead_index,
299  result = M0_FOM_LONG_LOCK_RETURN(result);
300 
301  if (M0_FI_ENABLED("fail_after_index_found")) {
302  M0_LOG(M0_DEBUG, "Fail after CGC_INDEX_FOUND");
303  m0_fom_phase_move(fom0, -ENOMEM,
305  result = M0_FSO_AGAIN;
306  }
307  } else {
308  /*
309  * -ENOENT is expected here meaning no entries in dead
310  * index. Otherwise it's some unexpected error.
311  */
312  if (rc == -ENOENT)
313  M0_LOG(M0_DEBUG, "nothing in dead index");
314  else
315  M0_LOG(M0_WARN, "cgc lookup error %d", rc);
316  /*
317  * Done, exit fom. cgc_fom_fini() may decide to re-start
318  * GC fom if cas service dropped some index while we
319  * were busy here. Abort transaction.
320  */
322  }
323  m0_ctg_op_fini(ctg_op);
324  fom->cg_ctg_op_initialized = false;
325  break;
326  case CGC_CREDITS:
327  /*
328  * Calculate credits. Must not delete more than
329  * del_limit records in the single transaction.
330  * Must calculate credits now, after transaction init but before
331  * its open in the generic fom.
332  */
335  fom->cg_ctg, &fom->cg_del_limit);
337  break;
338 
339  /*
340  * This is M0_FOPH_TYPE_SPECIFIC in generic fom - kind of
341  * "legal" entry point for us.
342  */
343  case CGC_TREE_CLEAN:
344  /*
345  * Transaction is now open. Start tree cleanup process. Remove
346  * all records from the tree but keep empty tree alive.
347  */
348  m0_ctg_op_init(ctg_op, fom0, 0);
349  fom->cg_ctg_op_initialized = true;
350  result = m0_ctg_truncate(ctg_op, fom->cg_ctg,
351  fom->cg_del_limit,
352  CGC_TREE_DROP);
353  break;
354  case CGC_TREE_DROP:
355  rc = m0_ctg_op_rc(ctg_op);
356  m0_ctg_op_fini(ctg_op);
357  fom->cg_ctg_op_initialized = false;
358  if (rc == 0 && m0_be_btree_is_empty(&fom->cg_ctg->cc_tree)) {
359  M0_LOG(M0_DEBUG, "tree cleaned, now drop it");
360  m0_ctg_op_init(ctg_op, fom0, 0);
361  fom->cg_ctg_op_initialized = true;
362  result = m0_ctg_drop(ctg_op, fom->cg_ctg,
364  } else {
365  M0_LOG(M0_DEBUG, "out of credits, commit & restart");
367  &fom->cg_dead_index);
368  cgc_retry();
369  /*
370  * If out of credits. Commit transaction and
371  * start from the very beginning, by creating
372  * new fom.
373  * Let generic fom commit transaction for us.
374  */
376  }
377  break;
378  case CGC_LOCK_DEAD_INDEX:
379  m0_ctg_op_fini(ctg_op);
380  m0_ctg_op_init(ctg_op, fom0, 0);
381  fom->cg_ctg_op_initialized = true;
382  m0_ctg_fini(fom0, fom->cg_ctg);
384  result = M0_FSO_AGAIN;
385  break;
387  m0_ctg_op_fini(ctg_op);
388  m0_ctg_op_init(ctg_op, fom0, 0);
389  fom->cg_ctg_op_initialized = true;
390  /*
391  * Now completely forget this ctg by deleting its descriptor
392  * from "dead index" catalogue.
393  */
394  result = m0_ctg_delete(ctg_op, m0_ctg_dead_index(),
395  &fom->cg_ctg_key, CGC_SUCCESS);
396  break;
397  case CGC_SUCCESS:
399  &fom->cg_dead_index);
400  m0_ctg_op_fini(ctg_op);
401  fom->cg_ctg_op_initialized = false;
402  /*
403  * Retry: maybe, have more trees to drop.
404  */
405  cgc_retry();
406  /*
407  * Let generic fom commit transaction for us.
408  */
410  break;
411  }
412  return M0_RC(result);
413 }
414 
415 static void cgc_retry(void)
416 {
417  /*
418  * Increment gc.cgc_running to launch same GC fom again
419  * just after fini: we still have data to delete.
420  */
422  gc.cgc_running++;
424 }
425 
426 M0_INTERNAL void m0_cas_gc_init(void)
427 {
428  M0_ENTRY();
437  gc.cgc_running = 0;
438 
439  /*
440  * Actually we do not need a fop. But generic fom wants it, and it must
441  * be of type request and mutabo.
442  */
444  .name = "cgc-fake",
446  .rpc_flags = M0_RPC_ITEM_TYPE_REQUEST |
448  .fom_ops = &cgc_fom_type_ops,
449  .sm = &cgc_sm_conf,
450  .svc_type = &m0_cas_service_type);
451 
452  M0_LEAVE();
453 }
454 
455 M0_INTERNAL void m0_cas_gc_fini(void)
456 {
457  M0_ENTRY();
458  gc.cgc_running = 0;
463  M0_LEAVE();
464 }
465 
466 static void cgc_fop_release(struct m0_ref *ref)
467 {
468  struct m0_fop *fop;
469 
470  M0_ENTRY();
471  fop = container_of(ref, struct m0_fop, f_ref);
472  /* Fop is a part of cgc_fom, it shouldn't be freed. */
473  m0_fop_fini(fop);
474  M0_LEAVE();
475 }
476 
477 static void cgc_start_fom(struct m0_fom *fom0, struct m0_fop *fop)
478 {
479  struct cgc_fom *fom = M0_AMB(fom, fom0, cg_fom);
480 
481  M0_ENTRY();
482 
483  /*
484  * Need a fop to use transactions from generic fom. If it is null, crash
485  * in fom_is_update().
486  */
489  &cgc_fom_ops, fop, NULL, fom->cg_reqh);
490  fom0->fo_local = true;
491  fom->cg_ctg_op_initialized = false;
492  m0_long_lock_link_init(&fom->cg_dead_index, fom0,
493  &fom->cg_dead_index_addb2);
494  m0_fom_queue(fom0);
495  M0_LOG(M0_DEBUG, "CGC fom enqueued");
496  M0_LEAVE();
497 }
498 
502 static void cgc_fom_fini(struct m0_fom *fom0)
503 {
504  struct cgc_fom *fom = M0_AMB(fom, fom0, cg_fom);
505 
506  M0_ENTRY();
507  M0_ASSERT(fom0->fo_fop != NULL);
508  M0_ASSERT(fom0->fo_fop == &fom->cg_fop);
510  gc.cgc_running--;
511  /*
512  * Our fop has 2 reference counts: 1 for create, 1 for fom init.
513  * Actually we do not use fop but it required by asserts inside
514  * transaction routines.
515  * We do not use and do not have rpc so can't directly use m0_fop_put():
516  * it crashes inside assert for m0_fop_rpc_is_locked().
517  * So use m0_ref_put() manually.
518  */
519  m0_ref_put(&fom0->fo_fop->f_ref);
520  m0_ref_put(&fom0->fo_fop->f_ref);
521  fom0->fo_fop = NULL;
522  m0_fom_fini(fom0);
523  m0_long_lock_link_fini(&fom->cg_dead_index);
524  /*
525  * If have more job to do, start another fom using current fom memory.
526  */
527  if (gc.cgc_running > 0) {
528  /*
529  * Must fill fom0 by zeroes when reusing fom memory. Else assert
530  * in m0_be_tx_init() because tx is not all-zero.
531  */
532  M0_SET0(fom0);
533  M0_SET0(&fom->cg_fop);
534  cgc_start_fom(fom0, &fom->cg_fop);
535  } else {
536  m0_free(fom);
537  if (gc.cgc_waiting) {
538  M0_LOG(M0_DEBUG, "Waking waiter for gc complete");
540  }
541  gc.cgc_waiting = false;
544  }
546  M0_LEAVE();
547 }
548 
549 M0_INTERNAL void m0_cas_gc_start(struct m0_reqh_service *service)
550 {
551  struct cgc_fom *fom;
552  int rc;
553  struct m0_reqh *reqh = service->rs_reqh;
554  struct m0_reqh_context *rctx;
555  struct m0_be_domain *dom;
556 
557  M0_ENTRY();
558 
559  /* Check if UT domain is preset */
561  if (dom == NULL) {
564  }
565 
567  if (gc.cgc_running == 0) {
568  /*
569  * GC fom was not running, start it now.
570  */
571  M0_LOG(M0_DEBUG, "Starting CGC fom");
572  M0_ALLOC_PTR(fom);
574  if (rc != 0 || fom == NULL) {
575  M0_LOG(M0_WARN, "CGC start error fom=%p, rc=%d",
576  fom, rc);
577  m0_free(fom);
578  if (rc == 0)
580  } else {
581  fom->cg_reqh = reqh;
582  cgc_start_fom(&fom->cg_fom, &fom->cg_fop);
583  gc.cgc_running++;
584  }
585  } else
586  gc.cgc_running++;
588  M0_LEAVE();
589 }
590 
591 M0_INTERNAL void m0_cas_gc_wait_sync(void)
592 {
593  M0_ENTRY();
595  while (gc.cgc_running > 0)
598  M0_LEAVE();
599 }
600 
601 M0_INTERNAL void m0_cas_gc_wait_async(struct m0_be_op *beop)
602 {
603  M0_ENTRY();
604  m0_be_op_active(beop);
606  if (gc.cgc_running == 0)
607  m0_be_op_done(beop);
608  else {
609  M0_LOG(M0_DEBUG, "Setup wait for gc complete");
610  gc.cgc_waiting = true;
611  gc.cgc_op = beop;
612  }
614  M0_LEAVE();
615 }
616 
617 #undef M0_TRACE_SUBSYSTEM
618 
619 /*
620  * Local variables:
621  * c-indentation-style: "K&R"
622  * c-basic-offset: 8
623  * tab-width: 8
624  * fill-column: 80
625  * scroll-step: 1
626  * End:
627  */
628 /*
629  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
630  */
int cgc_running
Definition: index_gc.c:127
M0_INTERNAL void m0_long_lock_link_init(struct m0_long_lock_link *link, struct m0_fom *fom, struct m0_long_lock_addb2 *addb2)
Definition: fom_long_lock.c:66
Definition: cond.h:99
static void cgc_retry(void)
Definition: index_gc.c:415
struct m0_be_domain * bs_domain
Definition: seg.h:82
M0_INTERNAL void m0_sm_conf_init(struct m0_sm_conf *conf)
Definition: sm.c:340
static struct cgc_context gc
Definition: index_gc.c:132
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
Definition: mutex.c:66
struct m0_fop cg_fop
Definition: index_gc.c:113
struct m0_fop * fo_fop
Definition: fom.h:490
#define M0_FOM_LONG_LOCK_RETURN(rc)
#define NULL
Definition: misc.h:38
M0_INTERNAL int m0_ctg_delete(struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, const struct m0_buf *key, int next_phase)
Definition: ctg_store.c:1540
static void cgc_fom_fini(struct m0_fom *fom)
Definition: index_gc.c:502
#define M0_FOP_TYPE_INIT(ft,...)
Definition: fop.h:307
struct m0_reqh * cg_reqh
Definition: index_gc.c:120
Definition: sm.h:350
void * b_addr
Definition: buf.h:39
M0_INTERNAL struct m0_long_lock * m0_ctg_lock(struct m0_cas_ctg *ctg)
Definition: ctg_store.c:2162
M0_INTERNAL void m0_ctg_store_fini(void)
Definition: ctg_store.c:870
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
#define M0_LOG(level,...)
Definition: trace.h:167
M0_LEAVE()
M0_INTERNAL void m0_ctg_fini(struct m0_fom *fom, struct m0_cas_ctg *ctg)
Definition: ctg_store.c:479
int(* fto_create)(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
Definition: fom.h:650
M0_INTERNAL void m0_ctg_dead_clean_credit(struct m0_be_tx_credit *accum)
Definition: ctg_store.c:1887
uint64_t sd_allowed
Definition: sm.h:422
void m0_fop_type_fini(struct m0_fop_type *fopt)
Definition: fop.c:232
M0_INTERNAL void m0_sm_conf_trans_extend(const struct m0_sm_conf *base, struct m0_sm_conf *sub)
Definition: sm.c:726
M0_INTERNAL void m0_sm_conf_extend(const struct m0_sm_state_descr *base, struct m0_sm_state_descr *sub, uint32_t nr)
Definition: sm.c:763
M0_INTERNAL int m0_ctg_minkey(struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, int next_phase)
Definition: ctg_store.c:1593
struct m0_dtx fo_tx
Definition: fom.h:498
M0_INTERNAL bool m0_be_btree_is_empty(struct m0_be_btree *tree)
Definition: btree.c:2499
#define M0_BITS(...)
Definition: misc.h:236
uint64_t m0_bcount_t
Definition: types.h:77
static void cgc_start_fom(struct m0_fom *fom0, struct m0_fop *fop)
Definition: index_gc.c:477
#define container_of(ptr, type, member)
Definition: misc.h:33
M0_INTERNAL struct m0_cas_ctg * m0_ctg_dead_index(void)
Definition: ctg_store.c:2140
#define M0_SET0(obj)
Definition: misc.h:64
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
Definition: mutex.c:49
M0_INTERNAL void m0_cas_gc_wait_async(struct m0_be_op *beop)
Definition: index_gc.c:601
const struct m0_sm_conf m0_generic_conf
Definition: fom_generic.c:838
M0_EXTERN struct m0_reqh_service_type m0_cas_service_type
Definition: cas.h:433
M0_INTERNAL void m0_cond_init(struct m0_cond *cond, struct m0_mutex *mutex)
Definition: cond.c:40
m0_fom_phase
Definition: fom.h:372
struct m0_fom_type ft_fom_type
Definition: fop.h:232
return M0_RC(rc)
M0_INTERNAL void m0_cas_gc_init(void)
Definition: index_gc.c:426
#define M0_ENTRY(...)
Definition: trace.h:170
struct m0_reqh_context rctx
Definition: buf.h:37
static void cgc_fop_release(struct m0_ref *ref)
Definition: index_gc.c:466
int opcode
Definition: crate.c:301
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 bool m0_long_write_lock(struct m0_long_lock *lk, struct m0_long_lock_link *link, int next_phase)
struct m0_fop_type * f_type
Definition: fop.h:81
M0_INTERNAL void m0_ref_put(struct m0_ref *ref)
Definition: refs.c:38
struct m0_sm_trans_descr cgc_fom_trans[]
Definition: index_gc.c:181
bool cgc_waiting
Definition: index_gc.c:128
struct m0_buf cg_ctg_key
Definition: index_gc.c:119
M0_INTERNAL void m0_ctg_try_init(struct m0_cas_ctg *ctg)
Definition: ctg_store.c:953
static const struct m0_fom_ops cgc_fom_ops
Definition: index_gc.c:134
const char * name
Definition: trace.c:110
#define M0_AMB(obj, ptr, field)
Definition: misc.h:320
Definition: refs.h:34
struct m0_mutex cgc_mutex
Definition: index_gc.c:125
struct m0_cas_ctg * cg_ctg
Definition: index_gc.c:116
struct m0_fom cg_fom
Definition: index_gc.c:112
int m0_fom_tick_generic(struct m0_fom *fom)
Definition: fom_generic.c:848
M0_INTERNAL void m0_long_unlock(struct m0_long_lock *lock, struct m0_long_lock_link *link)
void m0_fom_fini(struct m0_fom *fom)
Definition: fom.c:1324
struct m0_be_seg * rc_beseg
Definition: setup.h:268
#define M0_ASSERT(cond)
const char * scf_name
Definition: sm.h:352
M0_INTERNAL void m0_cond_fini(struct m0_cond *cond)
Definition: cond.c:46
bool fo_local
Definition: fom.h:503
void m0_fom_phase_move(struct m0_fom *fom, int32_t rc, int phase)
Definition: fom.c:1699
M0_INTERNAL void m0_long_lock_link_fini(struct m0_long_lock_link *link)
Definition: fom_long_lock.c:76
static struct m0_sm_state_descr cgc_fom_phases[]
Definition: index_gc.c:146
uint32_t scf_nr_states
Definition: sm.h:354
static const struct m0_fom_type_ops cgc_fom_type_ops
Definition: index_gc.c:142
M0_INTERNAL struct m0_reqh_context * m0_cs_reqh_context(struct m0_reqh *reqh)
Definition: setup.c:1773
M0_INTERNAL int m0_ctg_store_init(struct m0_be_domain *dom)
Definition: ctg_store.c:814
static struct m0_stob_domain * dom
Definition: storage.c:38
struct m0_be_tx_credit tx_betx_cred
Definition: dtm.h:560
M0_INTERNAL void m0_cas_gc_fini(void)
Definition: index_gc.c:455
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
Definition: mutex.c:35
struct m0_cond cgc_cond
Definition: index_gc.c:126
M0_INTERNAL struct m0_be_domain * m0_cas__ut_svc_be_get(struct m0_reqh_service *svc)
Definition: service.c:553
Definition: reqh.h:94
M0_INTERNAL void m0_be_op_done(struct m0_be_op *op)
Definition: stubs.c:104
Definition: dump.c:103
M0_INTERNAL void m0_cas_gc_wait_sync(void)
Definition: index_gc.c:591
static int cgc_fom_tick(struct m0_fom *fom)
Definition: index_gc.c:210
M0_INTERNAL void m0_fop_fini(struct m0_fop *fop)
Definition: fop.c:136
M0_INTERNAL void m0_ctg_op_init(struct m0_ctg_op *ctg_op, struct m0_fom *fom, uint32_t flags)
Definition: ctg_store.c:1759
M0_INTERNAL bool m0_long_is_write_locked(struct m0_long_lock *lock, const struct m0_fom *fom)
m0_bcount_t cg_del_limit
Definition: index_gc.c:121
Definition: fom.h:481
M0_INTERNAL void m0_cond_wait(struct m0_cond *cond)
Definition: cond.c:52
struct m0_buf co_out_key
Definition: ctg_store.h:214
struct m0_reqh reqh
Definition: rm_foms.c:48
M0_INTERNAL void m0_be_op_active(struct m0_be_op *op)
Definition: stubs.c:100
const char * sd_name
Definition: sm.h:383
struct m0_ctg_op cg_ctg_op
Definition: index_gc.c:117
struct m0_sm_state_descr * scf_state
Definition: sm.h:356
#define M0_FI_ENABLED(tag)
Definition: finject.h:231
struct m0_ref f_ref
Definition: fop.h:80
#define M0_ALLOC_PTR(ptr)
Definition: memory.h:86
bool cg_ctg_op_initialized
Definition: index_gc.c:118
struct m0_sm_trans_descr m0_generic_phases_trans[]
Definition: fom_generic.c:765
struct m0_be_op * cgc_op
Definition: index_gc.c:129
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
Definition: mutex.c:42
static struct m0_fop * fop
Definition: item.c:57
M0_INTERNAL void m0_fom_queue(struct m0_fom *fom)
Definition: fom.c:624
struct m0_long_lock_link cg_dead_index
Definition: index_gc.c:114
void(* fo_fini)(struct m0_fom *fom)
Definition: fom.h:657
M0_INTERNAL void m0_cond_broadcast(struct m0_cond *cond)
Definition: cond.c:100
M0_INTERNAL void m0_ctg_op_fini(struct m0_ctg_op *ctg_op)
Definition: ctg_store.c:1788
M0_INTERNAL void m0_cas_gc_start(struct m0_reqh_service *service)
Definition: index_gc.c:549
M0_INTERNAL int m0_ctg_drop(struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, int next_phase)
Definition: ctg_store.c:1620
void m0_fom_phase_set(struct m0_fom *fom, int phase)
Definition: fom.c:1688
M0_INTERNAL void m0_sm_conf_fini(struct m0_sm_conf *conf)
Definition: sm.c:376
static struct m0_sm_conf cgc_sm_conf
Definition: index_gc.c:197
Definition: op.h:74
struct m0_reqh * rs_reqh
Definition: reqh_service.h:259
static size_t cgc_fom_home_locality(const struct m0_fom *fom)
Definition: index_gc.c:205
void m0_free(void *data)
Definition: memory.c:146
Definition: mutex.h:47
static struct m0_reqh_service * service[REQH_IN_UT_MAX]
Definition: long_lock_ut.c:46
int32_t rc
Definition: trigger_fop.h:47
#define ARRAY_SIZE(a)
Definition: misc.h:45
M0_INTERNAL int m0_ctg_truncate(struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, m0_bcount_t limit, int next_phase)
Definition: ctg_store.c:1606
Definition: fop.h:79
M0_INTERNAL int m0_ctg_op_rc(struct m0_ctg_op *ctg_op)
Definition: ctg_store.c:1779
M0_INTERNAL struct m0_fop_type cgc_fake_fopt
Definition: index_gc.c:140
struct m0_long_lock_addb2 cg_dead_index_addb2
Definition: index_gc.c:115
Definition: trace.h:478
cgc_fom_phase
Definition: index_gc.c:99
M0_INTERNAL void m0_ctg_drop_credit(struct m0_fom *fom, struct m0_be_tx_credit *accum, struct m0_cas_ctg *ctg, m0_bcount_t *limit)
Definition: ctg_store.c:1841