Motr  M0
io_nw_xfer.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #include "layout/layout.h"
24 
25 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_CLIENT
26 #include "lib/trace.h" /* M0_LOG */
27 #include "lib/uuid.h" /* m0_uuid_generate */
28 
29 #include "ut/ut.h" /* M0_UT_ASSERT */
30 #include "motr/ut/client.h"
31 
32 /*
33  * Including the c files so we can replace the M0_PRE asserts
34  * in order to test them.
35  */
36 #if defined(round_down)
37 #undef round_down
38 #endif
39 #if defined(round_up)
40 #undef round_up
41 #endif
42 #include "motr/io_nw_xfer.c"
43 
44 #include "layout/layout_internal.h" /* REMOVE ME */
45 
47 static struct m0_client *dummy_instance;
48 
49 #define DUMMY_PTR 0xdeafdead
50 
51 #define UT_DEFAULT_BLOCK_SIZE (1ULL << M0_DEFAULT_BUF_SHIFT)
52 
53 static void ut_test_io_di_size(void)
54 {
55  /* XXX Base case (dealing with m0_resource is needed) */
56 }
57 
61 static void ut_helper_tioreqs_hash_func(uint64_t b_nr, uint64_t key,
62  uint64_t exp_ret)
63 {
64  struct m0_htable htable;
65  uint64_t hash;
66 
67  htable.h_bucket_nr = b_nr;
68  hash = tioreqs_hash_func(&htable, (void *)&key);
69  M0_UT_ASSERT(hash == exp_ret);
70 }
71 
75 static void ut_test_tioreqs_hash_func(void)
76 {
77  uint64_t key;
78 
79  /* Keep gcc quiet during debug build */
80  M0_SET0(&key);
81 
82  /* Base cases: bucket_nr == 2 */
84  ut_helper_tioreqs_hash_func(2, 777, 1);
85  ut_helper_tioreqs_hash_func(2, 12345, 1);
88  ut_helper_tioreqs_hash_func(2, 5000, 0);
89 
90  /* Base case: bucket_nr == 1 */
91  ut_helper_tioreqs_hash_func(1, 12345, 0);
93  ut_helper_tioreqs_hash_func(1, 23431423, 0);
95 }
96 
100 static void ut_helper_tioreq_key_eq(uint64_t k1, uint64_t k2,
101  bool exp_ret)
102 {
103  bool eq;
104 
105  eq = tioreq_key_eq(&k1, &k2);
106  M0_UT_ASSERT(eq == exp_ret);
107 }
108 
112 static void ut_test_tioreq_key_eq(void)
113 {
114  uint64_t k1;
115  uint64_t k2;
116 
117  /* Keep gcc quiet during debug build */
118  M0_SET0(&k1);
119  M0_SET0(&k2);
120 
121  /* Base case. */
122  ut_helper_tioreq_key_eq(2, 2, true);
123  ut_helper_tioreq_key_eq(123456, 123456, true);
124  ut_helper_tioreq_key_eq(123456, 2, false);
125 }
126 
131 {
132  struct target_ioreq *ti;
133  bool ret;
134 
135  /* Base case. */
137  ret = target_ioreq_invariant(ti);
138  M0_UT_ASSERT(ret == true);
140 }
141 
145 static void ut_test_target_session(void)
146 {
147  struct m0_fid fid;
148  struct m0_fid tfid;
149  struct m0_client *instance;
150  struct m0_reqh_service_ctx *ctx;
151  struct m0_realm realm;
152  struct m0_entity entity;
153  struct m0_op_io *ioo;
154  struct m0_rpc_session *session;
155  struct m0_pool_version *pv;
156 
157  /* initialise client */
160 
161  ioo = ut_dummy_ioo_create(instance, 1);
162  ioo->ioo_oo.oo_oc.oc_op.op_entity = &entity;
163 
164  /* Keep gcc quiet during debug build */
165  M0_SET0(&tfid);
166 
167  /* Base case. */
168  m0_fid_gob_make(&fid, 0, 0);
169  m0_fid_convert_gob2cob(&fid, &tfid, 0);
170 
171  pv = instance->m0c_pools_common.pc_cur_pver;
172  pv->pv_pc = &instance->m0c_pools_common;
173  pv->pv_pc->pc_nr_devices = 1;
175  M0_ALLOC_PTR(ctx);
176  ctx->sc_type = M0_CST_IOS;
177  pv->pv_pc->pc_dev2svc[0].pds_ctx = ctx;
178 
179  ioo->ioo_pver = pv->pv_id;
180  session = target_session(ioo, tfid);
181  M0_UT_ASSERT(session == &ctx->sc_rlink.rlk_sess);
182 
184  m0_free(ctx);
185 
186  /* fini */
187  m0_entity_fini(&entity);
189 }
190 
195 {
196  struct nw_xfer_request *xfer;
197  struct m0_fid *fid;
198  struct target_ioreq *ti;
199  struct target_ioreq *aux_ti;
200 
201  /* Base case: Found. */
202  M0_ALLOC_PTR(fid);
203  m0_fid_set(fid, 0xDEAD, 0xBEEF);
204  xfer = ut_dummy_xfer_req_create();
205  tioreqht_htable_init(&xfer->nxr_tioreqs_hash, 1);
207  m0_fid_set(&ti->ti_fid, 0xDEAD, 0xBEEF);
208  tioreqht_htable_add(&xfer->nxr_tioreqs_hash, ti);
209 
210  aux_ti = target_ioreq_locate(xfer, fid);
211  M0_UT_ASSERT(aux_ti == ti);
212 
213  tioreqht_htable_del(&xfer->nxr_tioreqs_hash, ti);
215  tioreqht_htable_fini(&xfer->nxr_tioreqs_hash);
217  m0_free(fid);
218 
219  /* Base case: Not found. */
220  M0_ALLOC_PTR(fid);
221  m0_fid_set(fid, 0xDEAD, 0xBEEF);
222  xfer = ut_dummy_xfer_req_create();
223  tioreqht_htable_init(&xfer->nxr_tioreqs_hash, 1);
224  ti = target_ioreq_locate(xfer, fid);
225  M0_UT_ASSERT(ti == NULL);
226  tioreqht_htable_fini(&xfer->nxr_tioreqs_hash);
228  m0_free(fid);
229 }
230 
235 {
236  struct target_ioreq *ti;
237  struct m0_op_io *ioo;
238  struct m0_client *instance;
239  struct m0_pdclust_src_addr *src;
240  struct m0_pdclust_tgt_addr *tgt;
241  struct pargrp_iomap *map;
242  struct m0_pdclust_layout *play;
243 
244  /* see ut_dummy_pdclust_layout_create() */
245  const uint32_t unit_size = UT_DEFAULT_BLOCK_SIZE;
246 
247  /* Initialise client. */
249 
250  /* Base case. */
251  ioo = ut_dummy_ioo_create(instance, 1);
252  M0_ALLOC_PTR(src);
253  M0_ALLOC_PTR(tgt);
254  src->sa_unit = 1;
255  tgt->ta_frame = 1;
257  /* don't use this allocated buf*/
258  ut_dummy_data_buf_free(map->pi_databufs[0][0]);
259  map->pi_ioo = ioo;
260  map->pi_databufs[0][0]->db_buf.b_addr = NULL;
261  map->pi_databufs[0][0]->db_flags |= 777;
262 
263  play = pdlayout_get(ioo);
265 
267  ti->ti_nwxfer = &ioo->ioo_nwxfer;
268  m0_indexvec_alloc(&ti->ti_ivec, 1);
269  ti->ti_ivec.iv_vec.v_nr = 0;
271  ti->ti_goff_ivec.iv_vec.v_nr = 0;
273  m0_free(ti->ti_bufvec.ov_buf[0]); /* don't use this buf*/
275  M0_SET0(&ioo->ioo_attr);
276  M0_ALLOC_ARR(ti->ti_pageattrs, 1);
277 
278  target_ioreq_seg_add(ti, src, tgt, 111, 1, map);
279  M0_UT_ASSERT(ti->ti_ivec.iv_vec.v_nr == 1);
280  M0_UT_ASSERT(ti->ti_ivec.iv_index[0] == unit_size + 111);
281  M0_UT_ASSERT(ti->ti_ivec.iv_vec.v_count[0] == 1);
282  M0_UT_ASSERT(ti->ti_bufvec.ov_vec.v_count[0] == 1);
283  M0_UT_ASSERT(ti->ti_bufvec.ov_buf[0] == NULL);
285  M0_UT_ASSERT(ti->ti_pageattrs[0] & 777);
286 
287  /* we want to re-use ti - free this one */
288  m0_free(ti->ti_pageattrs);
293 
295  m0_free(tgt);
296  m0_free(src);
298 }
299 
300 static void ut_test_bulk_buffer_add(void)
301 {
302  /* XXX Base case (when io_desc_size can be tested) */
303 
304 }
305 
306 static void ut_test_irfop_fini(void)
307 {
308  /* XXX: Base case (if you feel like testing rpc_bulk) */
309 }
310 
312 {
313  /* XXX Base case (when bulk_buffer_add is testable). */
314 }
315 
319 static void ut_test_target_ioreq_init(void)
320 {
321  struct target_ioreq *ti;
322  struct m0_fid gfid;
323  struct m0_fid fid;
324  struct m0_rpc_session *session;
325  struct m0_op_io *ioo;
326  struct m0_client *instance;
327  int rc;
328  struct m0_realm realm;
329 
330  /* initialise client */
332 
333  /* Base case. */
334  m0_fid_gob_make(&gfid, 0, 1);
336  session = (struct m0_rpc_session *)DUMMY_PTR;
337  M0_ALLOC_PTR(ti);
338  ioo = ut_dummy_ioo_create(instance, 1);
340  instance);
341  rc = target_ioreq_init(ti, &ioo->ioo_nwxfer, &fid, 777,
343  M0_UT_ASSERT(rc == 0);
344  M0_UT_ASSERT(ti->ti_rc == 0);
345  M0_UT_ASSERT(ti->ti_ops == &tioreq_ops);
346  M0_UT_ASSERT(m0_fid_cmp(&ti->ti_fid, &fid) == 0);
347  M0_UT_ASSERT(ti->ti_nwxfer == &ioo->ioo_nwxfer);
348  M0_UT_ASSERT(ti->ti_dgvec == NULL);
351  M0_UT_ASSERT(ti->ti_parbytes == 0);
352  M0_UT_ASSERT(ti->ti_databytes == 0);
353  M0_UT_ASSERT(ti->ti_obj == 777);
354  M0_UT_ASSERT(ti->ti_bufvec.ov_vec.v_nr == 1);
355  M0_UT_ASSERT(ti->ti_bufvec.ov_vec.v_count != NULL);
356  M0_UT_ASSERT(ti->ti_bufvec.ov_buf != NULL);
358  M0_UT_ASSERT(ti->ti_ivec.iv_vec.v_nr == 0);
359 
360  target_ioreq_fini(ti);
361 
364 }
365 
369 static void ut_test_target_ioreq_fini(void)
370 {
371  struct target_ioreq *ti;
372  int rc;
373  struct m0_op_io *ioo;
374 
376 
377  /* Base case. */
379  ti->ti_nwxfer = &ioo->ioo_nwxfer;
380  target_ioreq_bob_init(ti);
381  tioreqht_tlink_init(ti);
382  ti->ti_dgvec = NULL;
383  M0_ALLOC_PTR(ti->ti_bufvec.ov_buf);
384  M0_ALLOC_PTR(ti->ti_bufvec.ov_vec.v_count);
388  rc = m0_indexvec_alloc(&ti->ti_ivec, 1);
389  M0_UT_ASSERT(rc == 0);
391  M0_UT_ASSERT(rc == 0);
392 
393  target_ioreq_fini(ti);
395 }
396 
401 {
402  struct nw_xfer_request *xfer;
403  bool ret;
404 
405  /* Base case. */
406  xfer = ut_dummy_xfer_req_create();
407  ret = nw_xfer_request_invariant(xfer);
408  /* XXX: Other base cases can be covered. */
409  M0_UT_ASSERT(ret == true);
411 
412 }
413 
419 static void ut_test_nw_xfer_tioreq_get(void)
420 {
421  struct m0_op_io *ioo;
422  struct m0_fid gfid;
423  struct m0_fid fid;
424  struct m0_rpc_session *session;
425  struct target_ioreq *out;
426  struct m0_client *instance;
427  int rc;
428  struct m0_realm realm;
429 
430  /* Initialise client. */
432 
433  /* Base case. */
434  M0_SET0(&out);
435  session = (struct m0_rpc_session *)DUMMY_PTR;
436  ioo = ut_dummy_ioo_create(instance, 1);
438  instance);
439  tioreqht_htable_init(&ioo->ioo_nwxfer.nxr_tioreqs_hash, 1);
440  m0_fid_gob_make(&gfid, 0, 1);
442  rc = nw_xfer_tioreq_get(&ioo->ioo_nwxfer, &fid, 777,
444  M0_UT_ASSERT(rc == 0);
445  M0_UT_ASSERT(out != NULL);
446  tioreqht_htable_del(&ioo->ioo_nwxfer.nxr_tioreqs_hash, out);
448 
449  tioreqht_htable_fini(&ioo->ioo_nwxfer.nxr_tioreqs_hash);
452 }
453 
455 {
456 }
457 
462 {
463  struct m0_op_io *ioo;
464  struct m0_client *instance;
465  struct m0_realm realm;
466  struct m0_entity entity;
467 
468  /* Initialise. */
471 
472  /* Base case. */
473  ioo = ut_dummy_ioo_create(instance, 1);
474  ioo->ioo_oo.oo_oc.oc_op.op_entity = &entity;
475  tioreqht_htable_init(&ioo->ioo_nwxfer.nxr_tioreqs_hash, 1);
476 
477  ioo->ioo_nwxfer.nxr_rc = -777;
478  ioo->ioo_nwxfer.nxr_bytes = 99;
481  nw_xfer_req_complete(&ioo->ioo_nwxfer, true);
483  M0_UT_ASSERT(ioo->ioo_rc == -777);
484  M0_UT_ASSERT(ioo->ioo_nwxfer.nxr_bytes == 0);
485 
486  tioreqht_htable_fini(&ioo->ioo_nwxfer.nxr_tioreqs_hash);
488 }
489 
491 {
492 }
493 
494 static void ut_test_nw_xfer_tioreq_map(void)
495 {
496 }
497 
502 {
503  struct m0_op_io *ioo;
504  struct m0_client *instance;
505  struct nw_xfer_request *xfer;
506 
507  /* initialise client */
509 
510  /* Base case. */
511  ioo = ut_dummy_ioo_create(instance, 1);
513  xfer = &ioo->ioo_nwxfer;
514  M0_UT_ASSERT(xfer->nxr_rc == 0);
515  M0_UT_ASSERT(xfer->nxr_bytes == 0);
516  M0_UT_ASSERT(xfer->nxr_rc == 0);
520  M0_UT_ASSERT(xfer->nxr_ops == &xfer_ops);
521 
522  /* clean after the function */
523  m0_mutex_fini(&xfer->nxr_lock);
524  tioreqht_htable_fini(&xfer->nxr_tioreqs_hash);
526 }
527 
532 {
533  struct nw_xfer_request *xfer;
534 
535  /* Base case. */
536  M0_ALLOC_PTR(xfer);
537  xfer->nxr_state = NXS_COMPLETE;
538  nw_xfer_request_bob_init(xfer);
539  xfer->nxr_ops = (struct nw_xfer_ops *)DUMMY_PTR;
540  m0_mutex_init(&xfer->nxr_lock);
541  tioreqht_htable_init(&xfer->nxr_tioreqs_hash, 1);
542  nw_xfer_request_fini(xfer);
543  M0_UT_ASSERT(xfer->nxr_ops == NULL);
544  m0_free(xfer);
545 }
546 
548 {
549  int rc;
550  struct m0_client *instance;
551  struct m0_op_io *ioo;
552  struct target_ioreq *ti;
553 
554  /* init */
556  ioo = ut_dummy_ioo_create(instance, 1);
558  ti->ti_nwxfer = &ioo->ioo_nwxfer;
559 
560  /* base cases */
562  M0_UT_ASSERT(rc == 0);
563  dgmode_rwvec_dealloc_fini(ti->ti_dgvec); /* a shortcut to fix memory leak*/
564 
565  /* fini */
568 
569 }
570 
572 {
573  int rc;
574  struct m0_client *instance;
575  struct m0_op_io *ioo;
576  struct target_ioreq *ti;
577 
578  /* init */
580  ioo = ut_dummy_ioo_create(instance, 1);
582  ti->ti_nwxfer = &ioo->ioo_nwxfer;
583 
584  /* base cases */
586  M0_UT_ASSERT(rc == 0);
587 
589 
590  /* fini */
593 }
594 
595 M0_INTERNAL int m0_io_nw_xfer_ut_init(void)
596 {
597  int rc;
599 
600 #ifndef __KERNEL__
602 #endif
603 
605 
607  M0_UT_ASSERT(rc == 0);
608 
612 
613  return 0;
614 }
615 
616 M0_INTERNAL int m0_io_nw_xfer_ut_fini(void)
617 {
620  return 0;
621 }
622 
624  .ts_name = "io-nw-xfer-ut",
625  .ts_init = m0_io_nw_xfer_ut_init,
626  .ts_fini = m0_io_nw_xfer_ut_fini,
627  .ts_tests = {
628 
629  { "io_di_size",
631  { "tioreqs_hash_func",
633  { "tioreq_key_eq",
635  { "target_ioreq_invariant",
637  { "target_session",
639  { "target_ioreq_locate",
641  { "target_ioreq_seg_add",
643  { "bulk_buffer_add",
645  { "irfop_fini",
647  { "target_ioreq_iofops_prepare",
649  { "target_ioreq_init",
651  { "target_ioreq_fini",
653  { "nw_xfer_request_invariant",
655  { "nw_xfer_tioreq_get",
657  { "nw_xfer_io_distribute",
659  { "nw_xfer_req_complete",
661  { "nw_xfer_req_dispatch",
663  { "nw_xfer_tioreq_map",
665  { "nw_xfer_request_init",
667  { "nw_xfer_request_fini",
669  { "dgmode_rwvec_alloc_init",
671  { "dgmode_rwvec_dealloc_fini",
673  { NULL, NULL },
674  }
675 };
676 
677 #undef M0_TRACE_SUBSYSTEM
678 
679 /*
680  * Local variables:
681  * c-indentation-style: "K&R"
682  * c-basic-offset: 8
683  * tab-width: 8
684  * fill-column: 80
685  * scroll-step: 1
686  * End:
687  */
static uint64_t tioreqs_hash_func(const struct m0_htable *htable, const void *k)
Definition: io_nw_xfer.c:279
M0_INTERNAL void ut_dummy_data_buf_free(struct data_buf *db)
Definition: io_dummy.c:232
static bool target_ioreq_invariant(const struct target_ioreq *ti)
Definition: io_nw_xfer.c:324
void ut_layout_domain_empty(struct m0_client *cinst)
Definition: obj.c:218
static void ut_test_nw_xfer_io_distribute(void)
Definition: io_nw_xfer.c:454
#define M0_ALLOC_ARR(arr, nr)
Definition: memory.h:84
static void ut_test_nw_xfer_request_invariant(void)
Definition: io_nw_xfer.c:400
static void ut_test_target_ioreq_fini(void)
Definition: io_nw_xfer.c:369
static void nw_xfer_req_complete(struct nw_xfer_request *xfer, bool rmw)
Definition: io_nw_xfer.c:1682
void m0_entity_fini(struct m0_entity *entity)
Definition: client.c:438
M0_INTERNAL void m0_fid_gob_make(struct m0_fid *gob_fid, uint32_t container, uint64_t key)
Definition: fid_convert.c:46
M0_INTERNAL int m0_indexvec_alloc(struct m0_indexvec *ivec, uint32_t len)
Definition: vec.c:532
static const uint64_t k1
Definition: hash_fnc.c:34
#define NULL
Definition: misc.h:38
map
Definition: processor.c:112
#define DUMMY_PTR
Definition: io_nw_xfer.c:49
uint64_t pa_unit_size
Definition: pdclust.h:118
struct m0_atomic64 nxr_rdbulk_nr
static struct m0_client * dummy_instance
Definition: io_nw_xfer.c:47
struct m0_pool_version * pv
Definition: dir.c:629
M0_INTERNAL void nw_xfer_request_init(struct nw_xfer_request *xfer)
Definition: io_nw_xfer.c:2137
M0_INTERNAL int m0_io_nw_xfer_ut_fini(void)
Definition: io_nw_xfer.c:616
struct m0_vec ov_vec
Definition: vec.h:147
static int dgmode_rwvec_alloc_init(struct target_ioreq *ti)
Definition: io_nw_xfer.c:151
M0_INTERNAL void ut_dummy_pargrp_iomap_delete(struct pargrp_iomap *map, struct m0_client *instance)
Definition: io_dummy.c:342
#define UT_DEFAULT_BLOCK_SIZE
Definition: io_nw_xfer.c:51
M0_INTERNAL void ut_dummy_target_ioreq_delete(struct target_ioreq *ti)
Definition: io_dummy.c:554
M0_INTERNAL int m0_io_nw_xfer_ut_init(void)
Definition: io_nw_xfer.c:595
struct m0_indexvec_varr ti_bufvec
struct m0_op oc_op
static void dgmode_rwvec_dealloc_fini(struct dgmode_rwvec *dg)
Definition: io_nw_xfer.c:244
M0_INTERNAL void m0_indexvec_free(struct m0_indexvec *ivec)
Definition: vec.c:553
static struct m0_rpc_session * target_session(struct m0_op_io *ioo, struct m0_fid tfid)
Definition: io_nw_xfer.c:731
uint64_t ti_obj
static void ut_test_nw_xfer_request_init(void)
Definition: io_nw_xfer.c:501
struct m0_varr ti_pageattrs
static void ut_test_nw_xfer_req_complete(void)
Definition: io_nw_xfer.c:461
void ut_layout_domain_fill(struct m0_client *cinst)
Definition: obj.c:208
static void ut_test_target_ioreq_iofops_prepare(void)
Definition: io_nw_xfer.c:311
static struct m0_rpc_session session
Definition: formation2.c:38
#define M0_SET0(obj)
Definition: misc.h:64
Definition: ut.h:77
M0_INTERNAL int m0_fid_cmp(const struct m0_fid *fid0, const struct m0_fid *fid1)
Definition: fid.c:170
M0_INTERNAL int ut_m0_client_init(struct m0_client **instance)
Definition: client.c:265
struct m0_pdclust_attr pl_attr
Definition: pdclust.h:150
void ** ov_buf
Definition: vec.h:149
static struct m0_pdclust_layout * dummy_pdclust_layout
Definition: io.c:50
static void ut_test_io_di_size(void)
Definition: io_nw_xfer.c:53
struct m0_sm ioo_sm
M0_INTERNAL struct nw_xfer_request * ut_dummy_xfer_req_create(void)
Definition: io_dummy.c:178
static void ut_test_bulk_buffer_add(void)
Definition: io_nw_xfer.c:300
enum m0_pool_nd_state ti_state
struct m0_fid fid
Definition: di.c:46
M0_INTERNAL int m0_bufvec_alloc(struct m0_bufvec *bufvec, uint32_t num_segs, m0_bcount_t seg_size)
Definition: vec.c:220
struct m0_vec iv_vec
Definition: vec.h:139
static struct target_ioreq * target_ioreq_locate(struct nw_xfer_request *xfer, struct m0_fid *fid)
Definition: io_nw_xfer.c:435
static uint32_t unit_size
Definition: layout.c:53
static void ut_test_target_ioreq_seg_add(void)
Definition: io_nw_xfer.c:234
M0_INTERNAL void m0_bufvec_free(struct m0_bufvec *bufvec)
Definition: vec.c:395
M0_INTERNAL void m0_sm_group_unlock(struct m0_sm_group *grp)
Definition: sm.c:96
m0_bindex_t * iv_index
Definition: vec.h:141
M0_INTERNAL void ut_realm_entity_setup(struct m0_realm *realm, struct m0_entity *ent, struct m0_client *cinst)
Definition: client.c:60
struct nw_xfer_request ioo_nwxfer
M0_INTERNAL void m0_fid_set(struct m0_fid *fid, uint64_t container, uint64_t key)
Definition: fid.c:116
uint64_t ti_parbytes
static int target_ioreq_init(struct target_ioreq *ti, struct nw_xfer_request *xfer, const struct m0_fid *cobfid, uint64_t ta_obj, struct m0_rpc_session *session, uint64_t size)
Definition: io_nw_xfer.c:1210
M0_INTERNAL bool nw_xfer_request_invariant(const struct nw_xfer_request *xfer)
Definition: io_nw_xfer.c:340
struct m0_op_obj ioo_oo
static int key
Definition: locality.c:283
static int nw_xfer_tioreq_get(struct nw_xfer_request *xfer, struct m0_fid *fid, uint64_t ta_obj, struct m0_rpc_session *session, uint64_t size, struct target_ioreq **out)
Definition: io_nw_xfer.c:1366
M0_INTERNAL void ut_dummy_ioo_delete(struct m0_op_io *ioo, struct m0_client *instance)
Definition: io_dummy.c:465
struct m0_fid pv_id
Definition: pool.h:113
M0_INTERNAL void nw_xfer_request_fini(struct nw_xfer_request *xfer)
Definition: io_nw_xfer.c:2166
static void ut_helper_tioreqs_hash_func(uint64_t b_nr, uint64_t key, uint64_t exp_ret)
Definition: io_nw_xfer.c:61
struct m0_fid ioo_pver
M0_INTERNAL void ut_m0_client_fini(struct m0_client **instance)
Definition: client.c:354
M0_INTERNAL struct target_ioreq * ut_dummy_target_ioreq_create(void)
Definition: io_dummy.c:534
const struct nw_xfer_ops * nxr_ops
uint64_t ta_frame
Definition: pdclust.h:254
uint32_t pc_nr_devices
Definition: pool.h:196
static void ut_test_nw_xfer_request_fini(void)
Definition: io_nw_xfer.c:531
static void ut_test_tioreqs_hash_func(void)
Definition: io_nw_xfer.c:75
static void ut_test_dgmode_rwvec_dealloc_fini(void)
Definition: io_nw_xfer.c:571
struct m0_sm_group * sm_grp
Definition: sm.h:321
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
Definition: mutex.c:35
M0_INTERNAL void ut_shuffle_test_order(struct m0_ut_suite *suite)
Definition: client.c:1205
struct m0_pools_common * pv_pc
Definition: pool.h:130
uint32_t v_nr
Definition: vec.h:51
static void ut_test_irfop_fini(void)
Definition: io_nw_xfer.c:306
M0_INTERNAL struct pargrp_iomap * ut_dummy_pargrp_iomap_create(struct m0_client *instance, int num_blocks)
Definition: io_dummy.c:303
struct m0_htable nxr_tioreqs_hash
m0_bcount_t * v_count
Definition: vec.h:53
struct m0_rpc_session * ti_session
struct m0_pool_device_to_service * pc_dev2svc
Definition: pool.h:207
struct m0_op_common oo_oc
static struct fdmi_ctx ctx
Definition: main.c:80
static void ut_test_nw_xfer_tioreq_map(void)
Definition: io_nw_xfer.c:494
static const struct nw_xfer_ops xfer_ops
Definition: io_nw_xfer.c:2130
const struct target_ioreq_ops * ti_ops
static const uint64_t k2
Definition: hash_fnc.c:35
struct m0_reqh_service_ctx * pds_ctx
Definition: pool.h:74
static struct m0_pdclust_layout * pdlayout_get(const struct io_request *req)
Definition: file.c:510
static int64_t m0_atomic64_get(const struct m0_atomic64 *a)
uint64_t sa_unit
Definition: pdclust.h:243
int32_t ioo_rc
const char * ts_name
Definition: ut.h:99
uint64_t ti_databytes
struct m0_pdclust_tgt_addr tgt
Definition: fd.c:110
struct m0_ut_suite ut_suite_io_nw_xfer
Definition: io_nw_xfer.c:46
M0_INTERNAL struct m0_pdclust_layout * ut_dummy_pdclust_layout_create(struct m0_client *instance)
Definition: io_dummy.c:79
M0_INTERNAL struct m0_op_io * ut_dummy_ioo_create(struct m0_client *instance, int num_io_maps)
Definition: io_dummy.c:368
static void ut_test_nw_xfer_req_dispatch(void)
Definition: io_nw_xfer.c:490
Definition: fid.h:38
struct m0_fid ti_fid
static void ut_test_nw_xfer_tioreq_get(void)
Definition: io_nw_xfer.c:419
#define M0_ALLOC_PTR(ptr)
Definition: memory.h:86
static struct m0_realm realm
Definition: sync.c:87
struct m0_entity * op_entity
Definition: client.h:666
M0_INTERNAL void ut_dummy_xfer_req_delete(struct nw_xfer_request *xfer)
Definition: io_dummy.c:193
struct m0_mutex nxr_lock
enum nw_xfer_state nxr_state
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
Definition: mutex.c:42
struct m0_atomic64 nxr_iofop_nr
static void ut_test_tioreq_key_eq(void)
Definition: io_nw_xfer.c:112
static struct m0 instance
Definition: main.c:78
M0_INTERNAL void m0_sm_group_lock(struct m0_sm_group *grp)
Definition: sm.c:83
static void ut_test_target_ioreq_init(void)
Definition: io_nw_xfer.c:319
static void ut_test_target_session(void)
Definition: io_nw_xfer.c:145
static void ut_helper_tioreq_key_eq(uint64_t k1, uint64_t k2, bool exp_ret)
Definition: io_nw_xfer.c:100
static void ut_test_target_ioreq_locate(void)
Definition: io_nw_xfer.c:194
Definition: nucleus.c:42
struct nw_xfer_request * ti_nwxfer
M0_INTERNAL void m0_fid_convert_gob2cob(const struct m0_fid *gob_fid, struct m0_fid *cob_fid, uint32_t device_id)
Definition: fid_convert.c:55
#define out(...)
Definition: gen.c:41
M0_INTERNAL void m0_client_init_io_op(void)
Definition: io.c:815
static bool tioreq_key_eq(const void *key1, const void *key2)
Definition: io_nw_xfer.c:299
struct m0_fid gfid
Definition: dir.c:626
void target_ioreq_fini(struct target_ioreq *ti)
Definition: io_nw_xfer.c:364
struct m0_indexvec ti_goff_ivec
Definition: pg.h:820
struct m0_bufvec ti_auxbufvec
Definition: pg.h:807
static void ut_test_dgmode_rwvec_alloc_init(void)
Definition: io_nw_xfer.c:547
static void ut_test_target_ioreq_invariant(void)
Definition: io_nw_xfer.c:130
void m0_free(void *data)
Definition: memory.c:146
static const struct target_ioreq_ops tioreq_ops
Definition: io_nw_xfer.c:1182
uint32_t sm_state
Definition: sm.h:307
struct m0_bufvec ioo_attr
struct m0_pdclust_src_addr src
Definition: fd.c:108
struct dgmode_rwvec * ti_dgvec
int32_t rc
Definition: trigger_fop.h:47
uint64_t h_bucket_nr
Definition: hash.h:178
struct m0_indexvec ti_ivec
Definition: pg.h:793
#define M0_UT_ASSERT(a)
Definition: ut.h:46
Definition: idx_mock.c:47
static void target_ioreq_seg_add(struct target_ioreq *ti, const struct m0_pdclust_src_addr *src, const struct m0_pdclust_tgt_addr *tgt, m0_bindex_t gob_offset, m0_bcount_t count, struct pargrp_iomap *map)
Definition: io_nw_xfer.c:479