Motr  M0
setup_dix.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2018-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 
29 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_M0D
30 #include "lib/trace.h"
31 
32 #include "cas/client.h"
33 #include "conf/confc.h" /* m0_confc_close */
34 #include "conf/helpers.h" /* m0_confc_root_open */
35 #include "dix/req.h" /* m0_dix */
36 #include "dix/fid_convert.h" /* m0_dix_fid_convert_dix2cctg */
37 #include "dix/meta.h" /* m0_dix_root_fid */
38 #include "lib/buf.h"
39 #include "lib/locality.h" /* m0_locality0_get */
40 #include "lib/misc.h" /* M0_SET */
41 #include "lib/vec.h" /* m0_bufvec_empty_alloc */
42 #include "motr/setup.h" /* m0_motr */
43 #include "motr/setup_internal.h"/* cs_service_init */
44 #include "pool/pool.h" /* m0_pools_common, m0_pool_version */
45 #include "reqh/reqh.h" /* m0_reqh2confc */
46 #include "rpc/link.h" /* m0_rpc_link */
47 #include "sm/sm.h" /* m0_sm_timedwait */
48 
49 static void cs_dix_cas_id_make(struct m0_cas_id *cid,
50  struct m0_dix *index,
51  uint32_t sdev_idx)
52 {
53  struct m0_fid cctg_fid;
54  int rc;
55 
56  m0_dix_fid_convert_dix2cctg(&index->dd_fid, &cctg_fid, sdev_idx);
57  cid->ci_fid = cctg_fid;
58  M0_ASSERT(index->dd_layout.dl_type == DIX_LTYPE_DESCR);
59  cid->ci_layout.dl_type = index->dd_layout.dl_type;
60  rc = m0_dix_ldesc_copy(&cid->ci_layout.u.dl_desc,
61  &index->dd_layout.u.dl_desc);
62  M0_ASSERT(rc == 0); /* XXX */
63 }
64 
65 static int cs_dix_create_sync(struct m0_dix *index,
66  uint32_t sdev_idx,
67  struct m0_rpc_link *link)
68 {
69  struct m0_cas_req req;
70  struct m0_cas_id cid;
71  int rc;
72 
73  M0_ENTRY("sdev_idx=%"PRIu32, sdev_idx);
74 
75  M0_SET0(&cid);
76  cs_dix_cas_id_make(&cid, index, sdev_idx);
77 
78  M0_SET0(&req);
79  m0_cas_req_init(&req, &link->rlk_sess,
80  m0_locality0_get()->lo_grp /* XXX */);
81 
82  /* XXX Locks sm group of locality0 */
84  rc = m0_cas_index_create(&req, &cid, 1, NULL /* XXX */);
85  M0_ASSERT(rc == 0);
88  M0_ASSERT(M0_IN(rc, (0, -ESRCH)));
90 
92  M0_LOG(M0_DEBUG, "m0_cas_index_create() finished with rc=%d", rc);
93 
95  m0_cas_id_fini(&cid);
96 
97  return M0_RC(rc);
98 }
99 
100 static int cs_dix_keys_vals_init(struct m0_bufvec *keys,
101  struct m0_bufvec *vals,
102  const char *key,
103  const struct m0_fid *fid,
104  struct m0_dix_ldesc *dld)
105 {
106  m0_bcount_t klen;
107  int rc;
108 
109  rc = m0_bufvec_empty_alloc(keys, 1) ?:
110  m0_bufvec_empty_alloc(vals, 1);
111  M0_ASSERT(rc == 0);
112 
113  rc = m0_dix__meta_val_enc(fid, dld, 1, vals);
114  M0_ASSERT(rc == 0);
115 
116  klen = strlen(key);
117  keys->ov_buf[0] = m0_alloc(klen);
118  M0_ASSERT(keys->ov_buf[0] != NULL);
119  keys->ov_vec.v_count[0] = klen;
120  memcpy(keys->ov_buf[0], key, klen);
121 
122  return M0_RC(rc);
123 }
124 
125 static void cs_dix_keys_vals_fini(struct m0_bufvec *keys,
126  struct m0_bufvec *vals)
127 {
128  m0_bufvec_free(keys);
129  m0_bufvec_free(vals);
130 }
131 
132 static int cs_dix_put_sync(struct m0_dix *index,
133  uint32_t sdev_idx,
134  struct m0_bufvec *keys,
135  struct m0_bufvec *vals,
136  struct m0_rpc_link *link)
137 {
138  struct m0_cas_req req;
139  struct m0_cas_id cid;
140  int rc;
141 
142  M0_ENTRY("sdev_idx=%"PRIu32, sdev_idx);
143 
144  M0_SET0(&cid);
145  cs_dix_cas_id_make(&cid, index, sdev_idx);
146 
147  M0_SET0(&req);
148  m0_cas_req_init(&req, &link->rlk_sess,
149  m0_locality0_get()->lo_grp /* XXX */);
150 
152  rc = m0_cas_put(&req, &cid, keys, vals, NULL /* XXX */, 0);
153  if (rc == 0) {
156  M0_TIME_NEVER);
157  M0_ASSERT(M0_IN(rc, (0, -ESRCH)));
158  }
160 
162  M0_LOG(M0_DEBUG, "m0_cas_put() for sdev_idx=%"PRIu32" finished with "
163  "rc=%d", sdev_idx, rc);
164 
166  m0_cas_id_fini(&cid);
167 
168  return M0_RC(rc);
169 }
170 
171 static int cs_dix_put_one(struct m0_dix *index,
172  const char *keystr,
173  const struct m0_fid *fid,
174  struct m0_dix_ldesc *dld,
175  struct m0_pools_common *pc,
176  struct m0_pool_version *pver,
177  struct m0_layout_domain *ldom,
178  struct m0_fid *cas_fid,
179  struct m0_rpc_link *link)
180 {
181  struct m0_reqh_service_ctx *cas_svc;
182  struct m0_dix_layout_iter iter;
183  struct m0_pooldev *sdev;
184  struct m0_bufvec keys;
185  struct m0_bufvec vals;
186  struct m0_buf key;
187  uint64_t tgt;
188  uint32_t sdev_idx;
189  uint32_t iter_max;
190  uint32_t i;
191  bool is_spare;
192  int rc;
193 
194  rc = cs_dix_keys_vals_init(&keys, &vals, keystr, fid, dld);
195  M0_ASSERT(rc == 0);
196  key = M0_BUF_INIT(keys.ov_vec.v_count[0], keys.ov_buf[0]);
197 
198  M0_SET0(&iter);
199  rc = m0_dix_layout_iter_init(&iter, &index->dd_fid, ldom, pver,
200  &index->dd_layout.u.dl_desc, &key);
201  M0_ASSERT(rc == 0);
202  iter_max = pver->pv_attr.pa_N + pver->pv_attr.pa_K + pver->pv_attr.pa_S;
204  for (i = 0; i < iter_max; ++i) {
206  iter.dit_unit) == M0_PUT_SPARE;
207  m0_dix_layout_iter_next(&iter, &tgt);
208  M0_ASSERT(tgt < pver->pv_attr.pa_P);
209  M0_LOG(M0_DEBUG, "tgt=%" PRIu64 " is_spare=%d", tgt, !!is_spare);
210  if (is_spare)
211  continue;
212 
213  sdev = &pver->pv_mach.pm_state->pst_devices_array[tgt];
214  sdev_idx = sdev->pd_sdev_idx;
215  cas_svc = pc->pc_dev2svc[sdev_idx].pds_ctx;
216  M0_ASSERT(cas_svc->sc_type == M0_CST_CAS);
217  if (!m0_fid_eq(cas_fid, &cas_svc->sc_fid))
218  continue;
219 
220  rc = cs_dix_put_sync(index, sdev_idx, &keys, &vals, link);
221  M0_ASSERT(rc == 0);
222  }
223 
225  cs_dix_keys_vals_fini(&keys, &vals);
226 
227  return M0_RC(rc);
228 }
229 
231  struct m0_pool_version *pver)
232 {
233  struct m0_reqh_service_ctx *cas_svc;
234  struct m0_poolmach *pm = &pver->pv_mach;
235  struct m0_pooldev *sdev;
236  uint32_t sdev_idx;
237  uint32_t i;
238 
239  /* `pm' is locked in m0_cs_dix_setup(). */
240  for (i = 0; i < pm->pm_state->pst_nr_devices; ++i) {
241  sdev = &pm->pm_state->pst_devices_array[i];
242  sdev_idx = sdev->pd_sdev_idx;
243  cas_svc = pc->pc_dev2svc[sdev_idx].pds_ctx;
244  if (cas_svc->sc_type != M0_CST_CAS) {
245  return false;
246  }
247  }
248  return true;
249 }
250 
251 /*
252  * XXX Current implementation doesn't support multiple DIX pools.
253  * rt_imeta_pver is used for all 3 meta indices.
254  */
255 M0_INTERNAL int m0_cs_dix_setup(struct m0_motr *cctx)
256 {
257  struct m0_pools_common *pc = &cctx->cc_pools_common;
258  struct m0_reqh_context *rctx = &cctx->cc_reqh_ctx;
259  struct m0_rpc_machine *rmach = m0_motr_to_rmach(cctx);
260  struct m0_rpc_machine *rmach_save;
261  const char *ep;
262  struct m0_reqh_service_type *stype;
263  struct m0_reqh_service *service;
264  struct m0_reqh_service_ctx *cas_svc;
265  struct m0_fid *cas_fid;
266  struct m0_rpc_link link;
267  int rc;
268 
269  struct m0_pool_version *pver;
270  struct m0_poolmach *pm;
271  struct m0_conf_root *root;
272  struct m0_pooldev *sdev;
273  struct m0_fid root_pver_fid;
274  uint32_t sdev_idx;
275  uint32_t i;
276 
277  struct m0_dix index_root;
278  struct m0_dix index1;
279  struct m0_dix index2;
280  struct m0_dix_ldesc dld_root;
281  struct m0_dix_ldesc dlds[2];
282  struct m0_dix_ldesc *dld1 = &dlds[0];
283  struct m0_dix_ldesc *dld2 = &dlds[1];
284 
285  struct m0_ext range[] = {
286  { .e_start = 0, .e_end = IMASK_INF },
287  };
288 
289  const char *layout_key = "layout";
290  const char *ldescr_key = "layout-descr";
291 
292  enum { MAX_RPCS_IN_FLIGHT = 2 }; /* XXX */
293 
294  M0_ENTRY();
295 
296  M0_PRE(cctx->cc_mkfs);
297  M0_PRE(rmach != NULL);
298 
299  ep = rmach->rm_tm.ntm_ep->nep_addr;
300 
301  /* Skip if CAS isn't configured */
302 
303  if (rctx->rc_services[M0_CST_CAS] == NULL)
304  return M0_RC(0);
305 
306  /* Start CAS/FDMI services */
307 
308  M0_PRE(rctx->rc_services[M0_CST_CAS] != NULL);
309 
310  rc = cs_service_init(rctx->rc_services[M0_CST_CAS], rctx, &rctx->rc_reqh,
311  &rctx->rc_service_fids[M0_CST_CAS]);
312  M0_ASSERT(rc == 0);
313  M0_LOG(M0_DEBUG, "service: %s" FID_F " cs_service_init: %d",
314  rctx->rc_services[M0_CST_CAS],
315  FID_P(&rctx->rc_service_fids[M0_CST_CAS]), rc);
316 
317  /* Start FDMI service even if it's missed in configuration */
318  rc = cs_service_init("M0_CST_FDMI", rctx, &rctx->rc_reqh, NULL);
319  M0_ASSERT(rc == 0);
320 
321  cas_fid = &rctx->rc_service_fids[M0_CST_CAS];
322 
323  /* Create service ctxs in pools_common */
324 
325  /* XXX workaround not to connect to services */
326  rmach_save = pc->pc_rmach;
327  pc->pc_rmach = NULL;
329  M0_ASSERT(rc == 0);
330  pc->pc_rmach = rmach_save;
331 
333  M0_ASSERT(rc == 0);
334 
335  /* Get root pver */
336 
337  rc = m0_confc_root_open(m0_reqh2confc(&cctx->cc_reqh_ctx.rc_reqh),
338  &root);
339  M0_ASSERT(rc == 0);
340  root_pver_fid = root->rt_imeta_pver;
342 
343  pver = m0_pool_version_find(&cctx->cc_pools_common, &root_pver_fid);
344  M0_ASSERT(pver != NULL);
345  pm = &pver->pv_mach;
347  /*
348  * @todo: Enable this logic once multiple DIX pvers available.
349  * M0_ASSERT(!pver->pv_is_dirty);
350  */
351  M0_ASSERT(pool_failed_devs_tlist_is_empty(
352  &pver->pv_pool->po_failed_devices));
353 
354  /* Purpose of this check is to skip UTs with incorrect DIX root pver. */
355  if (!cs_dix_pver_is_valid(pc, pver)) {
356  M0_LOG(M0_DEBUG, "DIX pver is not valid, skipping DIX init");
357  goto exit_fini_pools;
358  }
359 
360  M0_LOG(M0_DEBUG, "Root pver: P=%"PRIu32" N=%"PRIu32" K=%"PRIu32,
361  pver->pv_attr.pa_P, pver->pv_attr.pa_N, pver->pv_attr.pa_K);
362 
363  /* Connect to itself to send CAS fop */
364 
365  M0_SET0(&link);
366  rc = m0_rpc_link_init(&link, rmach, NULL, ep, MAX_RPCS_IN_FLIGHT);
367  M0_ASSERT(rc == 0);
369  M0_ASSERT(rc == 0);
370 
371  /* Init m0_dix objects */
372 
373  M0_SET0(&dld_root);
374  m0_dix_ldesc_init(&dld_root, range, ARRAY_SIZE(range),
375  HASH_FNC_FNV1, &root_pver_fid);
376  M0_SET0(&index_root);
377  index_root.dd_fid = m0_dix_root_fid;
378  rc = m0_dix_desc_set(&index_root, &dld_root);
379  M0_ASSERT(rc == 0);
380 
381  M0_SET0(dld1);
382  m0_dix_ldesc_init(dld1, range, ARRAY_SIZE(range),
383  HASH_FNC_CITY, &root_pver_fid);
384  M0_SET0(&index1);
385  index1.dd_fid = m0_dix_layout_fid;
386  rc = m0_dix_desc_set(&index1, dld1);
387  M0_ASSERT(rc == 0);
388 
389  M0_SET0(dld2);
390  m0_dix_ldesc_init(dld2, range, ARRAY_SIZE(range),
391  HASH_FNC_CITY, &root_pver_fid);
392  M0_SET0(&index2);
393  index2.dd_fid = m0_dix_ldescr_fid;
394  rc = m0_dix_desc_set(&index2, dld2);
395  M0_ASSERT(rc == 0);
396 
397  /* Create meta indices */
398 
399  /*
400  * Emulate behaviour of dix_idxop_req_send()
401  * and send reqs for all sdevs
402  */
403  for (i = 0; i < pm->pm_state->pst_nr_devices; ++i) {
404  sdev = &pm->pm_state->pst_devices_array[i];
405  M0_ASSERT(M0_IN(sdev->pd_state, (M0_PNDS_ONLINE,
407  sdev_idx = sdev->pd_sdev_idx;
408  cas_svc = pc->pc_dev2svc[sdev_idx].pds_ctx;
409  M0_ASSERT(cas_svc->sc_type == M0_CST_CAS);
410  if (!m0_fid_eq(cas_fid, &cas_svc->sc_fid))
411  continue;
412 
413  rc = cs_dix_create_sync(&index_root, sdev_idx, &link);
414  M0_ASSERT(rc == 0);
415  rc = cs_dix_create_sync(&index1, sdev_idx, &link);
416  M0_ASSERT(rc == 0);
417  rc = cs_dix_create_sync(&index2, sdev_idx, &link);
418  M0_ASSERT(rc == 0);
419  }
420 
421  /* PUT layout */
422 
423  rc = cs_dix_put_one(&index_root, layout_key, &m0_dix_layout_fid,
424  dld1, pc, pver, &rctx->rc_reqh.rh_ldom,
425  cas_fid, &link);
426  M0_ASSERT(rc == 0);
427 
428  /* PUT ldescr */
429 
430  rc = cs_dix_put_one(&index_root, ldescr_key, &m0_dix_ldescr_fid,
431  dld2, pc, pver, &rctx->rc_reqh.rh_ldom,
432  cas_fid, &link);
433  M0_ASSERT(rc == 0);
434 
435  /* Fini */
436 
437  m0_dix_fini(&index2);
438  m0_dix_fini(&index1);
439  m0_dix_fini(&index_root);
440  m0_dix_ldesc_fini(dld2);
441  m0_dix_ldesc_fini(dld1);
442  m0_dix_ldesc_fini(&dld_root);
443 
444  /* Disconnect */
445 
447  M0_ASSERT(rc == 0);
448  m0_rpc_link_fini(&link);
449 
450  /* Destroy service ctxs in pools_common */
451 
452 exit_fini_pools:
454  if (rctx->rc_state == RC_INITIALISED)
458 
459  /* Stop CAS/FDMI services */
460 
462  M0_ASSERT(service != NULL);
464 
465  stype = m0_reqh_service_type_find("M0_CST_FDMI");
466  M0_ASSERT(stype != NULL);
468  M0_ASSERT(service != NULL);
470 
471  return M0_RC(rc);
472 }
473 
474 #undef M0_TRACE_SUBSYSTEM
475 
478 /*
479  * Local variables:
480  * c-indentation-style: "K&R"
481  * c-basic-offset: 8
482  * tab-width: 8
483  * fill-column: 80
484  * scroll-step: 1
485  * End:
486  */
487 /*
488  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
489  */
struct m0_poolmach_state * pm_state
Definition: pool_machine.h:169
#define M0_PRE(cond)
M0_INTERNAL struct m0_reqh_service * m0_reqh_service_lookup(const struct m0_reqh *reqh, const struct m0_fid *fid)
Definition: reqh_service.c:551
struct m0_fid sc_fid
Definition: reqh_service.h:751
#define NULL
Definition: misc.h:38
uint32_t pst_nr_devices
Definition: pool_machine.h:108
M0_INTERNAL int m0_dix_desc_set(struct m0_dix *dix, const struct m0_dix_ldesc *desc)
Definition: req.c:2596
const m0_time_t M0_TIME_NEVER
Definition: time.c:108
M0_INTERNAL struct m0_pool_version * m0_pool_version_find(struct m0_pools_common *pc, const struct m0_fid *id)
Definition: pool.c:586
static struct io_request req
Definition: file.c:100
struct m0_conf_obj rt_obj
Definition: obj.h:372
#define M0_LOG(level,...)
Definition: trace.h:167
M0_INTERNAL void m0_reqh_layouts_cleanup(struct m0_reqh *reqh)
Definition: reqh.c:169
M0_INTERNAL const struct m0_fid m0_dix_layout_fid
Definition: meta.c:45
struct m0_vec ov_vec
Definition: vec.h:147
M0_INTERNAL void cs_service_fini(struct m0_reqh_service *service)
Definition: setup.c:1178
M0_INTERNAL void m0_cas_id_fini(struct m0_cas_id *cid)
Definition: cas.c:198
struct m0_dix_layout ci_layout
Definition: cas.h:120
M0_INTERNAL int m0_dix_layout_iter_init(struct m0_dix_layout_iter *iter, const struct m0_fid *index, struct m0_layout_domain *ldom, struct m0_pool_version *pver, struct m0_dix_ldesc *ldesc, struct m0_buf *key)
Definition: layout.c:203
static struct m0_rpc_client_ctx cctx
Definition: rconfc.c:69
#define M0_BITS(...)
Definition: misc.h:236
static bool is_spare(uint64_t alloc_flags)
Definition: balloc.c:1049
uint64_t m0_bcount_t
Definition: types.h:77
const char * nep_addr
Definition: net.h:503
#define M0_SET0(obj)
Definition: misc.h:64
M0_INTERNAL int cs_service_init(const char *name, struct m0_reqh_context *rctx, struct m0_reqh *reqh, struct m0_fid *fid)
Definition: setup.c:1117
M0_INTERNAL struct m0_rpc_machine * m0_motr_to_rmach(struct m0_motr *motr)
Definition: setup.c:196
void ** ov_buf
Definition: vec.h:149
static const struct m0_fid * cas_fid(const struct m0_fom *fom)
Definition: service.c:1749
static int cs_dix_keys_vals_init(struct m0_bufvec *keys, struct m0_bufvec *vals, const char *key, const struct m0_fid *fid, struct m0_dix_ldesc *dld)
Definition: setup_dix.c:100
static struct m0_pools_common pc
Definition: iter_ut.c:59
M0_INTERNAL struct m0_reqh_service_type * m0_reqh_service_type_find(const char *sname)
Definition: reqh_service.c:168
static void cs_dix_keys_vals_fini(struct m0_bufvec *keys, struct m0_bufvec *vals)
Definition: setup_dix.c:125
M0_INTERNAL void m0_cas_req_unlock(struct m0_cas_req *req)
Definition: client.c:229
M0_INTERNAL void m0_dix_layout_iter_fini(struct m0_dix_layout_iter *iter)
Definition: layout.c:315
M0_INTERNAL int m0_dix_ldesc_copy(struct m0_dix_ldesc *dst, const struct m0_dix_ldesc *src)
Definition: layout.c:189
M0_INTERNAL int m0_sm_timedwait(struct m0_sm *mach, uint64_t states, m0_time_t deadline)
Definition: sm.c:387
struct m0_pooldev * pst_devices_array
Definition: pool_machine.h:111
struct m0_fid fid
Definition: di.c:46
M0_INTERNAL void m0_cas_req_lock(struct m0_cas_req *req)
Definition: client.c:223
M0_INTERNAL int m0_confc_root_open(struct m0_confc *confc, struct m0_conf_root **root)
Definition: helpers.c:219
return M0_RC(rc)
static int cs_dix_create_sync(struct m0_dix *index, uint32_t sdev_idx, struct m0_rpc_link *link)
Definition: setup_dix.c:65
Definition: sock.c:754
#define M0_ENTRY(...)
Definition: trace.h:170
struct m0_reqh_context rctx
Definition: buf.h:37
M0_INTERNAL void m0_bufvec_free(struct m0_bufvec *bufvec)
Definition: vec.c:395
int i
Definition: dir.c:1033
#define PRIu64
Definition: types.h:58
struct m0_conf_root * root
Definition: note.c:50
M0_INTERNAL int m0_cas_req_generic_rc(const struct m0_cas_req *req)
Definition: client.c:457
M0_INTERNAL void m0_cas_req_init(struct m0_cas_req *req, struct m0_rpc_session *sess, struct m0_sm_group *grp)
Definition: client.c:195
M0_INTERNAL struct m0_confc * m0_reqh2confc(struct m0_reqh *reqh)
Definition: reqh.c:753
static const struct socktype stype[]
Definition: sock.c:1156
struct m0_fid rt_imeta_pver
Definition: obj.h:403
struct m0_fid dd_fid
Definition: req.h:111
struct m0_net_transfer_mc rm_tm
Definition: rpc_machine.h:88
#define M0_ASSERT(cond)
M0_INTERNAL void m0_dix_layout_iter_next(struct m0_dix_layout_iter *iter, uint64_t *tgt)
Definition: layout.c:249
struct m0_fid pver
Definition: idx_dix.c:74
struct m0_reqh rc_reqh
Definition: setup.h:312
M0_INTERNAL int m0_dix_ldesc_init(struct m0_dix_ldesc *ld, struct m0_ext *range, m0_bcount_t range_nr, enum m0_dix_hash_fnc_type htype, struct m0_fid *pver)
Definition: layout.c:171
enum m0_conf_service_type sc_type
Definition: reqh_service.h:757
M0_INTERNAL void m0_pools_service_ctx_destroy(struct m0_pools_common *pc)
Definition: pool.c:1617
M0_INTERNAL uint32_t m0_dix_liter_unit_classify(struct m0_dix_layout_iter *iter, uint64_t unit)
Definition: layout.c:295
void * m0_alloc(size_t size)
Definition: memory.c:126
uint32_t pd_sdev_idx
Definition: pool.h:437
static bool cs_dix_pver_is_valid(struct m0_pools_common *pc, struct m0_pool_version *pver)
Definition: setup_dix.c:230
struct m0_layout_domain rh_ldom
Definition: reqh.h:153
uint32_t dl_type
Definition: layout.h:100
struct m0_fid ci_fid
Definition: cas.h:113
M0_INTERNAL int m0_cas_index_create(struct m0_cas_req *req, const struct m0_cas_id *cids, uint64_t cids_nr, struct m0_dtx *dtx)
Definition: client.c:1321
m0_bcount_t * v_count
Definition: vec.h:53
struct m0_pool_device_to_service * pc_dev2svc
Definition: pool.h:207
union m0_dix_layout::@145 u
#define FID_P(f)
Definition: fid.h:77
M0_INTERNAL void m0_dix_layout_iter_reset(struct m0_dix_layout_iter *iter)
Definition: layout.c:310
struct m0_reqh_service_ctx * pds_ctx
Definition: pool.h:74
M0_INTERNAL void m0_dix_ldesc_fini(struct m0_dix_ldesc *ld)
Definition: layout.c:197
struct m0_rpc_machine * pc_rmach
Definition: pool.h:166
M0_INTERNAL bool m0_fid_eq(const struct m0_fid *fid0, const struct m0_fid *fid1)
Definition: fid.c:164
static void cs_dix_cas_id_make(struct m0_cas_id *cid, struct m0_dix *index, uint32_t sdev_idx)
Definition: setup_dix.c:49
#define PRIu32
Definition: types.h:66
struct m0_pdclust_tgt_addr tgt
Definition: fd.c:110
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
Definition: setup.h:354
M0_INTERNAL void m0_cas_req_fini_lock(struct m0_cas_req *req)
Definition: client.c:295
static int cs_dix_put_one(struct m0_dix *index, const char *keystr, const struct m0_fid *fid, struct m0_dix_ldesc *dld, struct m0_pools_common *pc, struct m0_pool_version *pver, struct m0_layout_domain *ldom, struct m0_fid *cas_fid, struct m0_rpc_link *link)
Definition: setup_dix.c:171
char * ep
Definition: sw.h:132
uint64_t dit_unit
Definition: layout.h:141
M0_INTERNAL struct m0_locality * m0_locality0_get(void)
Definition: locality.c:169
Definition: ext.h:37
static int cs_dix_put_sync(struct m0_dix *index, uint32_t sdev_idx, struct m0_bufvec *keys, struct m0_bufvec *vals, struct m0_rpc_link *link)
Definition: setup_dix.c:132
Definition: fid.h:38
struct m0_net_end_point * ntm_ep
Definition: net.h:868
m0_bindex_t e_start
Definition: ext.h:39
M0_INTERNAL const struct m0_fid m0_dix_ldescr_fid
Definition: meta.c:46
M0_INTERNAL int m0_pools_service_ctx_create(struct m0_pools_common *pc)
Definition: pool.c:1535
M0_INTERNAL int m0_cas_put(struct m0_cas_req *req, struct m0_cas_id *index, const struct m0_bufvec *keys, const struct m0_bufvec *values, struct m0_dtx *dtx, uint32_t flags)
Definition: client.c:1643
struct m0_fid * rc_service_fids
Definition: setup.h:249
M0_INTERNAL void m0_rwlock_read_lock(struct m0_rwlock *lock)
Definition: rwlock.c:52
M0_INTERNAL void m0_confc_close(struct m0_conf_obj *obj)
Definition: confc.c:921
enum cs_reqh_ctx_states rc_state
Definition: setup.h:261
struct m0_rwlock pm_lock
Definition: pool_machine.h:178
M0_INTERNAL void m0_rwlock_read_unlock(struct m0_rwlock *lock)
Definition: rwlock.c:57
M0_INTERNAL int m0_pool_versions_setup(struct m0_pools_common *pc)
Definition: pool.c:1640
M0_INTERNAL void m0_pool_versions_destroy(struct m0_pools_common *pc)
Definition: pool.c:1876
M0_INTERNAL int m0_cs_dix_setup(struct m0_motr *cctx)
Definition: setup_dix.c:255
Definition: cas.h:107
#define M0_BUF_INIT(size, data)
Definition: buf.h:64
static struct m0_reqh_service * service[REQH_IN_UT_MAX]
Definition: long_lock_ut.c:46
M0_INTERNAL const struct m0_fid m0_dix_root_fid
Definition: meta.c:44
M0_INTERNAL void m0_dix_fid_convert_dix2cctg(const struct m0_fid *dix_fid, struct m0_fid *cctg_fid, uint32_t device_id)
Definition: fid_convert.c:54
char ** rc_services
Definition: setup.h:246
int32_t rc
Definition: trigger_fop.h:47
#define ARRAY_SIZE(a)
Definition: misc.h:45
#define FID_F
Definition: fid.h:75
M0_INTERNAL void m0_dix_fini(struct m0_dix *dix)
Definition: req.c:2603
M0_INTERNAL int m0_dix__meta_val_enc(const struct m0_fid *fid, const struct m0_dix_ldesc *dld, uint32_t nr, struct m0_bufvec *vals)
Definition: encdec.c:48
Definition: vec.h:145
Definition: req.h:110
M0_INTERNAL int m0_bufvec_empty_alloc(struct m0_bufvec *bufvec, uint32_t num_segs)
Definition: vec.c:213
Definition: idx_mock.c:47