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  m0_free(map->pi_databufs[0][0]->db_buf.b_addr);/* don't use this allocated buf*/
258  map->pi_ioo = ioo;
259  map->pi_databufs[0][0]->db_buf.b_addr = NULL;
260  map->pi_databufs[0][0]->db_flags |= 777;
261 
262  play = pdlayout_get(ioo);
264 
266  ti->ti_nwxfer = &ioo->ioo_nwxfer;
267  m0_indexvec_alloc(&ti->ti_ivec, 1);
268  ti->ti_ivec.iv_vec.v_nr = 0;
270  ti->ti_goff_ivec.iv_vec.v_nr = 0;
272  m0_free(ti->ti_bufvec.ov_buf[0]); /* don't use this buf*/
274  M0_SET0(&ioo->ioo_attr);
275  M0_ALLOC_ARR(ti->ti_pageattrs, 1);
276 
277  target_ioreq_seg_add(ti, src, tgt, 111, 1, map);
278  M0_UT_ASSERT(ti->ti_ivec.iv_vec.v_nr == 1);
279  M0_UT_ASSERT(ti->ti_ivec.iv_index[0] == unit_size + 111);
280  M0_UT_ASSERT(ti->ti_ivec.iv_vec.v_count[0] == 1);
281  M0_UT_ASSERT(ti->ti_bufvec.ov_vec.v_count[0] == 1);
282  M0_UT_ASSERT(ti->ti_bufvec.ov_buf[0] == NULL);
284  M0_UT_ASSERT(ti->ti_pageattrs[0] & 777);
285 
286  /* we want to re-use ti - free this one */
287  m0_free(ti->ti_pageattrs);
292 
294  m0_free(tgt);
295  m0_free(src);
297 }
298 
299 static void ut_test_bulk_buffer_add(void)
300 {
301  /* XXX Base case (when io_desc_size can be tested) */
302 
303 }
304 
305 static void ut_test_irfop_fini(void)
306 {
307  /* XXX: Base case (if you feel like testing rpc_bulk) */
308 }
309 
311 {
312  /* XXX Base case (when bulk_buffer_add is testable). */
313 }
314 
318 static void ut_test_target_ioreq_init(void)
319 {
320  struct target_ioreq *ti;
321  struct m0_fid gfid;
322  struct m0_fid fid;
323  struct m0_rpc_session *session;
324  struct m0_op_io *ioo;
325  struct m0_client *instance;
326  int rc;
327  struct m0_realm realm;
328 
329  /* initialise client */
331 
332  /* Base case. */
333  m0_fid_gob_make(&gfid, 0, 1);
335  session = (struct m0_rpc_session *)DUMMY_PTR;
336  M0_ALLOC_PTR(ti);
337  ioo = ut_dummy_ioo_create(instance, 1);
339  instance);
340  rc = target_ioreq_init(ti, &ioo->ioo_nwxfer, &fid, 777,
342  M0_UT_ASSERT(rc == 0);
343  M0_UT_ASSERT(ti->ti_rc == 0);
344  M0_UT_ASSERT(ti->ti_ops == &tioreq_ops);
345  M0_UT_ASSERT(m0_fid_cmp(&ti->ti_fid, &fid) == 0);
346  M0_UT_ASSERT(ti->ti_nwxfer == &ioo->ioo_nwxfer);
347  M0_UT_ASSERT(ti->ti_dgvec == NULL);
350  M0_UT_ASSERT(ti->ti_parbytes == 0);
351  M0_UT_ASSERT(ti->ti_databytes == 0);
352  M0_UT_ASSERT(ti->ti_obj == 777);
353  M0_UT_ASSERT(ti->ti_bufvec.ov_vec.v_nr == 1);
354  M0_UT_ASSERT(ti->ti_bufvec.ov_vec.v_count != NULL);
355  M0_UT_ASSERT(ti->ti_bufvec.ov_buf != NULL);
357  M0_UT_ASSERT(ti->ti_ivec.iv_vec.v_nr == 0);
358 
359  target_ioreq_fini(ti);
360 
363 }
364 
368 static void ut_test_target_ioreq_fini(void)
369 {
370  struct target_ioreq *ti;
371  int rc;
372  struct m0_op_io *ioo;
373 
375 
376  /* Base case. */
378  ti->ti_nwxfer = &ioo->ioo_nwxfer;
379  target_ioreq_bob_init(ti);
380  tioreqht_tlink_init(ti);
381  ti->ti_dgvec = NULL;
382  M0_ALLOC_PTR(ti->ti_bufvec.ov_buf);
383  M0_ALLOC_PTR(ti->ti_bufvec.ov_vec.v_count);
387  rc = m0_indexvec_alloc(&ti->ti_ivec, 1);
388  M0_UT_ASSERT(rc == 0);
390  M0_UT_ASSERT(rc == 0);
391 
392  target_ioreq_fini(ti);
394 }
395 
400 {
401  struct nw_xfer_request *xfer;
402  bool ret;
403 
404  /* Base case. */
405  xfer = ut_dummy_xfer_req_create();
406  ret = nw_xfer_request_invariant(xfer);
407  /* XXX: Other base cases can be covered. */
408  M0_UT_ASSERT(ret == true);
410 
411 }
412 
418 static void ut_test_nw_xfer_tioreq_get(void)
419 {
420  struct m0_op_io *ioo;
421  struct m0_fid gfid;
422  struct m0_fid fid;
423  struct m0_rpc_session *session;
424  struct target_ioreq *out;
425  struct m0_client *instance;
426  int rc;
427  struct m0_realm realm;
428 
429  /* Initialise client. */
431 
432  /* Base case. */
433  M0_SET0(&out);
434  session = (struct m0_rpc_session *)DUMMY_PTR;
435  ioo = ut_dummy_ioo_create(instance, 1);
437  instance);
438  tioreqht_htable_init(&ioo->ioo_nwxfer.nxr_tioreqs_hash, 1);
439  m0_fid_gob_make(&gfid, 0, 1);
441  rc = nw_xfer_tioreq_get(&ioo->ioo_nwxfer, &fid, 777,
443  M0_UT_ASSERT(rc == 0);
444  M0_UT_ASSERT(out != NULL);
445  tioreqht_htable_del(&ioo->ioo_nwxfer.nxr_tioreqs_hash, out);
447 
448  tioreqht_htable_fini(&ioo->ioo_nwxfer.nxr_tioreqs_hash);
451 }
452 
454 {
455 }
456 
461 {
462  struct m0_op_io *ioo;
463  struct m0_client *instance;
464  struct m0_realm realm;
465  struct m0_entity entity;
466 
467  /* Initialise. */
470 
471  /* Base case. */
472  ioo = ut_dummy_ioo_create(instance, 1);
473  ioo->ioo_oo.oo_oc.oc_op.op_entity = &entity;
474  tioreqht_htable_init(&ioo->ioo_nwxfer.nxr_tioreqs_hash, 1);
475 
476  ioo->ioo_nwxfer.nxr_rc = -777;
477  ioo->ioo_nwxfer.nxr_bytes = 99;
480  nw_xfer_req_complete(&ioo->ioo_nwxfer, true);
482  M0_UT_ASSERT(ioo->ioo_rc == -777);
483  M0_UT_ASSERT(ioo->ioo_nwxfer.nxr_bytes == 0);
484 
485  tioreqht_htable_fini(&ioo->ioo_nwxfer.nxr_tioreqs_hash);
487 }
488 
490 {
491 }
492 
493 static void ut_test_nw_xfer_tioreq_map(void)
494 {
495 }
496 
501 {
502  struct m0_op_io *ioo;
503  struct m0_client *instance;
504  struct nw_xfer_request *xfer;
505 
506  /* initialise client */
508 
509  /* Base case. */
510  ioo = ut_dummy_ioo_create(instance, 1);
512  xfer = &ioo->ioo_nwxfer;
513  M0_UT_ASSERT(xfer->nxr_rc == 0);
514  M0_UT_ASSERT(xfer->nxr_bytes == 0);
515  M0_UT_ASSERT(xfer->nxr_rc == 0);
519  M0_UT_ASSERT(xfer->nxr_ops == &xfer_ops);
520 
521  /* clean after the function */
522  m0_mutex_fini(&xfer->nxr_lock);
523  tioreqht_htable_fini(&xfer->nxr_tioreqs_hash);
525 }
526 
531 {
532  struct nw_xfer_request *xfer;
533 
534  /* Base case. */
535  M0_ALLOC_PTR(xfer);
536  xfer->nxr_state = NXS_COMPLETE;
537  nw_xfer_request_bob_init(xfer);
538  xfer->nxr_ops = (struct nw_xfer_ops *)DUMMY_PTR;
539  m0_mutex_init(&xfer->nxr_lock);
540  tioreqht_htable_init(&xfer->nxr_tioreqs_hash, 1);
541  nw_xfer_request_fini(xfer);
542  M0_UT_ASSERT(xfer->nxr_ops == NULL);
543  m0_free(xfer);
544 }
545 
547 {
548  int rc;
549  struct m0_client *instance;
550  struct m0_op_io *ioo;
551  struct target_ioreq *ti;
552 
553  /* init */
555  ioo = ut_dummy_ioo_create(instance, 1);
557  ti->ti_nwxfer = &ioo->ioo_nwxfer;
558 
559  /* base cases */
561  M0_UT_ASSERT(rc == 0);
562  dgmode_rwvec_dealloc_fini(ti->ti_dgvec); /* a shortcut to fix memory leak*/
563 
564  /* fini */
567 
568 }
569 
571 {
572  int rc;
573  struct m0_client *instance;
574  struct m0_op_io *ioo;
575  struct target_ioreq *ti;
576 
577  /* init */
579  ioo = ut_dummy_ioo_create(instance, 1);
581  ti->ti_nwxfer = &ioo->ioo_nwxfer;
582 
583  /* base cases */
585  M0_UT_ASSERT(rc == 0);
586 
588 
589  /* fini */
592 }
593 
594 M0_INTERNAL int m0_io_nw_xfer_ut_init(void)
595 {
596  int rc;
598 
599 #ifndef __KERNEL__
601 #endif
602 
604 
606  M0_UT_ASSERT(rc == 0);
607 
611 
612  return 0;
613 }
614 
615 M0_INTERNAL int m0_io_nw_xfer_ut_fini(void)
616 {
619  return 0;
620 }
621 
623  .ts_name = "io-nw-xfer-ut",
624  .ts_init = m0_io_nw_xfer_ut_init,
625  .ts_fini = m0_io_nw_xfer_ut_fini,
626  .ts_tests = {
627 
628  { "io_di_size",
630  { "tioreqs_hash_func",
632  { "tioreq_key_eq",
634  { "target_ioreq_invariant",
636  { "target_session",
638  { "target_ioreq_locate",
640  { "target_ioreq_seg_add",
642  { "bulk_buffer_add",
644  { "irfop_fini",
646  { "target_ioreq_iofops_prepare",
648  { "target_ioreq_init",
650  { "target_ioreq_fini",
652  { "nw_xfer_request_invariant",
654  { "nw_xfer_tioreq_get",
656  { "nw_xfer_io_distribute",
658  { "nw_xfer_req_complete",
660  { "nw_xfer_req_dispatch",
662  { "nw_xfer_tioreq_map",
664  { "nw_xfer_request_init",
666  { "nw_xfer_request_fini",
668  { "dgmode_rwvec_alloc_init",
670  { "dgmode_rwvec_dealloc_fini",
672  { NULL, NULL },
673  }
674 };
675 
676 #undef M0_TRACE_SUBSYSTEM
677 
678 /*
679  * Local variables:
680  * c-indentation-style: "K&R"
681  * c-basic-offset: 8
682  * tab-width: 8
683  * fill-column: 80
684  * scroll-step: 1
685  * End:
686  */
static uint64_t tioreqs_hash_func(const struct m0_htable *htable, const void *k)
Definition: io_nw_xfer.c:279
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:453
#define M0_ALLOC_ARR(arr, nr)
Definition: memory.h:84
static void ut_test_nw_xfer_request_invariant(void)
Definition: io_nw_xfer.c:399
static void ut_test_target_ioreq_fini(void)
Definition: io_nw_xfer.c:368
static void nw_xfer_req_complete(struct nw_xfer_request *xfer, bool rmw)
Definition: io_nw_xfer.c:1667
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:2130
M0_INTERNAL int m0_io_nw_xfer_ut_fini(void)
Definition: io_nw_xfer.c:615
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:340
#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:552
M0_INTERNAL int m0_io_nw_xfer_ut_init(void)
Definition: io_nw_xfer.c:594
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:500
struct m0_varr ti_pageattrs
static void ut_test_nw_xfer_req_complete(void)
Definition: io_nw_xfer.c:460
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:310
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:299
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:1195
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:1351
M0_INTERNAL void ut_dummy_ioo_delete(struct m0_op_io *ioo, struct m0_client *instance)
Definition: io_dummy.c:463
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:2159
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:532
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:530
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:570
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:305
M0_INTERNAL struct pargrp_iomap * ut_dummy_pargrp_iomap_create(struct m0_client *instance, int num_blocks)
Definition: io_dummy.c:301
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:493
static const struct nw_xfer_ops xfer_ops
Definition: io_nw_xfer.c:2123
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:366
static void ut_test_nw_xfer_req_dispatch(void)
Definition: io_nw_xfer.c:489
Definition: fid.h:38
struct m0_fid ti_fid
static void ut_test_nw_xfer_tioreq_get(void)
Definition: io_nw_xfer.c:418
#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:660
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:318
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:546
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:1167
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